Jump to content

Move The Music


WolfWorld
 Share

Recommended Posts

This is a long time ago project I decide to make it a OSS

This script has been submit to softpedia, etc.

It will organise your music delete all xx - xx _ stuff

and out in Artist\AlbumTitle\Title.mp3

NEED IndexSource Engine. Can be found here http://www.autoitscript.com/forum/index.php?showtopic=59557

Download IndexSource and put it in the same place as this script

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=beta
#AutoIt3Wrapper_icon=home.ico
#AutoIt3Wrapper_outfile=Move the Music.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=softpedia for update and download
#AutoIt3Wrapper_Res_Description=Move it
#AutoIt3Wrapper_Res_Fileversion=5.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=2006-2007
#AutoIt3Wrapper_Run_AU3Check=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include<GUIConstants.au3>
#include<File.au3>
#include<Misc.au3>
#include <extprop.au3>
#include <Array.au3>
Global $errorstring = ''
Global $log = ''
Global $val = ''
Global $Szdrive, $Szdir, $Szfname, $Szext;-
If Not ProcessExists(@ScriptName) Then
    If _Singleton('movethemusic', 1) = 0 Then
        MsgBox(0, 'Warning', 'Please restart your computer the last run has an error')
        Exit
    EndIf
EndIf
HotKeySet('^{F5}', 'OnAutoItExit')
FileSetAttrib('Setting.ini', '-R+NA')
$Firstini = IniRead('Setting.ini', 'Move The Music', 'FirstDirection', @ScriptDir)
$Secondini = IniRead('Setting.ini', 'Move The Music', 'SecondDirection', 'C:\MtM\')
$OneFolderini = IniRead('Setting.ini', 'Move The Music', 'One Folder', $GUI_UNCHECKED)
$Form1_1 = GUICreate('Move the Music', 350, 90, 193, 115)
GUISetBkColor(0xFFDC72)
GUICtrlCreateLabel('From', 8, 8, 65, 17, 0)
GUICtrlCreateLabel('To', 8, 32, 65, 17, 0)
$Button1 = GUICtrlCreateButton('Copy', 272, 8, 65, 17, 0)
GUICtrlSetState(-1, $GUI_FOCUS)
$Input1 = GUICtrlCreateInput($Firstini, 50, 8, 180, 21)
$Input2 = GUICtrlCreateInput($Secondini, 50, 32, 180, 21)
$Button2 = GUICtrlCreateButton('About', 272, 32, 73, 17, 0)
$progressbar = GUICtrlCreateProgress(8, 60, 330, 20)
GUISetState(@SW_SHOW)
ProcessSetPriority(@ScriptName, 0)
$errorstring = ''
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            While 1
                $errorstring = 'ERROR'
                WinSetTrans($Form1_1, '', 170)
                WinMove($Form1_1, '', 0, 0)
                GUISetState(@SW_DISABLE)
                If Not StringInStr(GUICtrlRead($Input1), ':\') Then ExitLoop
                If Not StringInStr(GUICtrlRead($Input2), ':\') Then ExitLoop
                $FirstDirection = GUICtrlRead($Input1)
                ShellExecuteWait("IndexSource.exe", '"index:file save:' & @ScriptDir & '\index.txt' & '" meta:.*.mp3\z *+.*.mp3\z "path:' & $FirstDirection & '"')
                $SecondDirection = GUICtrlRead($Input2)
                If $SecondDirection <> '' And StringRight($SecondDirection, 1) <> '\'  Then $SecondDirection = $SecondDirection & '\' 
                IniWrite('Setting.ini', 'Move The Music', 'FirstDirection', $FirstDirection)
                IniWrite('Setting.ini', 'Move The Music', 'SecondDirection', $SecondDirection)
                IniWrite('Setting.ini', 'Move The Music', 'Downlaod At', 'Softpedia.com/Autoitscript.com')
                IniWrite('Setting.ini', 'Move The Music', 'Email', 'Athiwatc@gmail.com')
                IniWrite('Setting.ini', 'Move The Music', 'Made by', 'Athiwat Chunlakhan')
                GUICtrlSetData($Input1, $FirstDirection)
                GUICtrlSetData($Input2, $SecondDirection)
                $file = FileOpen(@ScriptDir & '\index.txt', 0) 
                If $file = -1 Then
                    MsgBox(0, "Error", "Unable to open file.")
                    Exit
                EndIf
                
                Global $path[1], $meta[1], $i = 1, $type
                While 1
                    $line = FileReadLine($file, $i)
                    If @error = -1 Then ExitLoop
                    $i += 1
                    If $line == ':path:' Then $type = 'path'
                    If $line == ':meta:' Then $type = 'meta'
                    If $type = 'path'  Then
                        _ArrayAdd($path, $line)
                    EndIf
                    If $type = 'meta'  Then
                        _ArrayAdd($meta, $line)
                    EndIf
                    WEnd
                    exit
                For $i = 1 To UBound($path) - 1
                    GUICtrlSetData($progressbar, ($i / (UBound($path) - 1)) * 100)
                    $ss = StringSplit($meta[$i], ':')
                    If $ss[1] = '' Then $ss[1] = 'unknown' 
                    If $ss[2] = '' Then $ss[2] = 'unknown' 
                    If $ss[3] = '' Then $ss[3] = StringTrimRight($path[$i], 4)
                    FileCopy($path[$i], $SecondDirection & $ss[1] & '\' & $ss[2] & '\' & $ss[3] & '.mp3',8)
                Next

                GUISetState(@SW_ENABLE)
                WinSetTrans($Form1_1, '', 255)
                MsgBox('', 'Done', 'Thanks for useing', 1)
                WinFlash($Form1_1, '', 2, 500)
                $errorstring = ''
                ExitLoop
            WEnd
        Case $Button2
            MsgBox('', 'About', 'How to use first put all you music in one direction only (Only detect ".mp3")' & @CRLF & 'Point The First Box To The Your Music Direction and the second box to the copy to direction and click copy' & @CRLF & 'It will create a file into Artist\AlbumTitle\Title.mp3' & @CRLF & 'Create by Athiwat Chunlakhan Version 5.0' & @CRLF & 'www.softpedia.com/www.autoitscript.com for information Ctrl+F5 For Quick Exit')
    EndSwitch
WEnd

Func _instring($word)
    If StringInStr($word, '{') Then Return 1
    If StringInStr($word, '}') Then Return 1
EndFunc   ;==>_instring

Func _Replace($word)
    For $r = 10 To 99
        $word = StringReplace($word, $r & ' -', '')
        $word = StringReplace($word, $r & '-', '')
        $word = StringReplace($word, $r & ' ', '')
    Next
    For $r = 1 To 9
        $word = StringReplace($word, '0' & $r & ' -', '')
        $word = StringReplace($word, '0' & $r & '-', '')
        $word = StringReplace($word, $r & ' ', '')
    Next
    $word = StringReplace($word, '_', ' ')
    While 1
        If StringLeft($word, 1) = ' '  Then $word = StringTrimLeft($word, 1)
        If StringLeft($word, 1) <> ' '  Then ExitLoop
    WEnd
    While 1
        If StringRight($word, 1) = ' '  Then $word = StringTrimRight($word, 1)
        If StringRight($word, 1) <> ' '  Then ExitLoop
    WEnd
    Return $word
EndFunc   ;==>_Replace

Func OnAutoItExit()
    If $errorstring = 'ERROR'  Then
        $PID = ProcessExists(@ScriptName)
        If $PID Then ProcessClose($PID)
    EndIf
    Exit
EndFunc   ;==>OnAutoItExit
Edited by athiwatc
Link to comment
Share on other sites

Hi,

Can you give a more detailed explanation of exactly how this works? I have a similar program that works by renaming and moving the files according to what is in the ID3 tag, I'd like to see how you've done it.

Thanks,

John

Link to comment
Share on other sites

NEED IndexSource Engine.

Why do you use this why not just use _FileListToArrayEX() it's a UDF that I use, I'll have to post it at about 4pm standard time. If you put that in then this script will be stand alone, I understand you're Idead and I could write another version of this in about 10 mins. if I had AutoIt at school..

What I think it should do is something like this

Make a GUI with 3 input boxes, a progress bar, and a start button
1=Path to perform Recursive Moving for music
2=Path to move music to
3=File Types in a format like this *.wma|*.mp3
4=Folder Format ex. \Artist\Album\SongName
and when the user clicks the start btn the program does this
1.Performs recursive search with _FileListToArrayEX()
2.Uses _GetExtProp (not ID3 beacuse ID3 can't use WMA tags)
3.Starts a for loop that performs this for each loop:
==================================
1.IF artist folder doesn't exist then: Create Aritsit Folder For Current Song
2.IF the Album folder doesn't exist then: Create Album Folder for Ablum of current song
3.Move Song into that folder
4.Update the progress
==================================

I'm not sure how exactlty your script does this but I was going to make my media player do this so I already had all the steps planned I just never made it.

Hope it helps! Good Luck!

[center][/center]

Link to comment
Share on other sites

  • 2 weeks later...

Why do you use this why not just use _FileListToArrayEX() it's a UDF that I use, I'll have to post it at about 4pm standard time. If you put that in then this script will be stand alone, I understand you're Idead and I could write another version of this in about 10 mins. if I had AutoIt at school..

What I think it should do is something like this

Make a GUI with 3 input boxes, a progress bar, and a start button
1=Path to perform Recursive Moving for music
2=Path to move music to
3=File Types in a format like this *.wma|*.mp3
4=Folder Format ex. \Artist\Album\SongName
and when the user clicks the start btn the program does this
1.Performs recursive search with _FileListToArrayEX()
2.Uses _GetExtProp (not ID3 beacuse ID3 can't use WMA tags)
3.Starts a for loop that performs this for each loop:
==================================
1.IF artist folder doesn't exist then: Create Aritsit Folder For Current Song
2.IF the Album folder doesn't exist then: Create Album Folder for Ablum of current song
3.Move Song into that folder
4.Update the progress
==================================

I'm not sure how exactlty your script does this but I was going to make my media player do this so I already had all the steps planned I just never made it.

Hope it helps! Good Luck!

I'm back sorry for the late reply

Thanks a lot it gona take some time because now i'm working on OpenIndex

Link to comment
Share on other sites

ok well if you need any help I'd be glad to help you out.

Just search the helpfile+forum before asking me and if I don't know...

Then post a new help topic because you don't want to be nagged about asking dumb questions like that..

[center][/center]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...