Jump to content



Photo

mp3 File Renamer


  • Please log in to reply
7 replies to this topic

#1 Aceguy

Aceguy

    YAY ME.....

  • Active Members
  • PipPipPipPipPipPip
  • 669 posts

Posted 30 August 2008 - 10:04 AM

if your like me have loads of mp3's and cant be bothered to rename them manually.. then try this

******i have tested this EXTENSIVLEY but cannot be held responsible if i messes up your files*******

^^^^^^^^^^^^ had to say just incase someone says its gone horribly wrong.. ;) so ensure the test tick is enabled first.
Image1.jpg
Plain Text         
#include<Array.au3> #include<File.au3> #include<ButtonConstants.au3> #include<GUIConstantsEx.au3> #include<WindowsConstants.au3> #include<String.au3> Opt("GUIOnEventMode", 1) Global $file, $newname, $srce, $srDir, $srDrive, $srExt, $srFName, $suc, $typ, $sc, $List1, $files $Form1 = GUICreate("Form1", 378, 447, 582, 251) GUISetOnEvent($GUI_EVENT_CLOSE, "quit") $input = GUICtrlCreateInput("Input Folder", 16, 8, 313, 21) $output = GUICtrlCreateInput("Target Folder", 16, 40, 313, 21) $input_button = GUICtrlCreateButton("", 336, 8, 25, 25, $BS_ICON) GUICtrlSetOnEvent(-1, "input") GUICtrlSetImage(-1, "shell32.dll", 46, 0) $output_button = GUICtrlCreateButton("", 336, 40, 25, 25, $BS_ICON) GUICtrlSetOnEvent(-1, "output") GUICtrlSetImage(-1, "shell32.dll", 46, 0) $Checkbox1 = GUICtrlCreateCheckbox("Test (Output to Listview only)", 16, 72, 181, 17) GUICtrlSetOnEvent(-1, "checkbox") GUICtrlSetState(-1, $GUI_CHECKED) $List1 = GUICtrlCreateList("", 16, 104, 345, 318, BitOR($WS_BORDER, $WS_VSCROLL)) $Button3 = GUICtrlCreateButton("GO!!!", 288, 72, 73, 25, 0) GUICtrlSetOnEvent(-1, "go") ;GUICtrlSetState(-1,$GUI_DISABLE) GUISetState(@SW_SHOW) $log = GUICtrlCreateLabel("Log", 5, 430, 300, 25) While 1     Sleep(100) WEnd Func go()     GUICtrlSetData($List1, '')     GUICtrlSetData($Button3, "Running!!")     $files = _FileListToArray($sc) ;_ArrayDisplay($files)     $failed = 0     For $c = 1 To $files[0]         GUICtrlSetData($log, "Processed " & $c & " / " & $files[0])         $srce = $files[$c]         If $srce <> "" And StringInStr($srce, ".mp3") <> 0 Then GUICtrlSetData($List1, "Old     :" & $srce & "|") $newname = StringReplace($srce, '.mp3', '') $newname=StringRegExpReplace($newname,"\d"," ",0) ConsoleWrite($newname&@lf) if StringInStr($newname,"-",0,2)<>0 Then $newname=StringRegExpReplace($newname,"[\A-]"," ",1) ConsoleWrite($newname&@lf) EndIf if StringInStr($newname,"-")<4 then $newname=StringReplace($newname,"-","") ConsoleWrite($newname&@lf) EndIf $newname=StringRegExpReplace($newname,"[^\w-]", " ",0) ConsoleWrite($newname&@lf) $newname=StringRegExpReplace($newname,"_"," ") ConsoleWrite($newname&@lf) $newname=StringReplace($newname,"-"," - ",1,0) ConsoleWrite($newname&@lf) $newname=_StringProper($newname) ConsoleWrite($newname&@lf) $ss=StringSplit($newname," ") $nn='' for $x=1 to $ss[0]     if $ss[$x] <> "" Then    $nn&= $ss[$x]&" " EndIf Next $str=StringTrimRight($nn,1) ConsoleWrite(">>>"&$str&"<<<"&@lf) $s=$str&".mp3"                         $newname = $s             GUICtrlSetData($List1, "New   :" & $newname & "|")             GUICtrlSetData($List1, " |")                                     If GUICtrlRead($Checkbox1) <> 1 Then                 If GUICtrlRead($input) <> GUICtrlRead($output) Then                     $suc = FileCopy($sc & "\" & $srce, $file & "\" & $newname)                     $error=0                     If $suc <> 1 Then                         do                         $error+=1                         $newname = StringReplace($newname,".mp3",$error&".mp3")                         $suc = Filecopy($sc & "\" & $srce, $file & "\" & $newname)                                                     $failed += 1                         until $suc<>1                     EndIf                 Else                     $suc = FileMove($sc & "\" & $srce, $file & "\" & $newname)                     $error=0                     If $suc <> 1 Then                         do                         $error+=1                         $newname = StringReplace($newname,".mp3",$error&".mp3")                         $suc = FileMove($sc & "\" & $srce, $file & "\" & $newname)                                                     $failed += 1                         until $suc<>1                     EndIf                 EndIf                             EndIf                                 EndIf         Sleep(250)             Next     MsgBox(262160, "Operation Result", $failed & " Already Exists")     GUICtrlSetData($Button3, "GO!!!") EndFunc;==>go Func quit()     Exit EndFunc;==>quit Func input()     $sc = FileSelectFolder("Chose Folder to Open","")     GUICtrlSetData($input, $sc) EndFunc;==>input Func output()     $file = FileSelectFolder("Choose a folder.", '', 1 + 4)     GUICtrlSetData($output, $file) EndFunc;==>output Func checkbox() EndFunc;==>checkbox

Edited by Aceguy, 30 August 2008 - 10:13 AM.








#2 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 30 August 2008 - 10:11 AM

This could be pretty handy..
good job!
although its stupid that I can only select a folder in 'My Documents' for the input folder..

#3 Aceguy

Aceguy

    YAY ME.....

  • Active Members
  • PipPipPipPipPipPip
  • 669 posts

Posted 30 August 2008 - 10:14 AM

yep, sorry, did that for test purposes, **changed in first post

$sc = FileSelectFolder("Chose Folder to Open","")

ALSO if the target exists, (test.mp3) it will rename them.

test1.mp3
test2.mp3
test3.mp3

loops until the file can be saved

Edited by Aceguy, 30 August 2008 - 10:18 AM.


#4 UltraFine

UltraFine

    Adventurer

  • Banned (NOT IN USE)
  • 146 posts

Posted 22 November 2008 - 12:51 AM

anyway to change Tag3 of mp3 files?

#5 Mattraks

Mattraks

    Adventurer

  • Banned (NOT IN USE)
  • 117 posts

Posted 22 November 2008 - 01:16 AM

Nice except that the song "When I'm Gone" was thought to be changed to "When I M Gone". Might want to look into that.

#6 SinghIsKing

SinghIsKing

    Seeker

  • Banned (NOT IN USE)
  • 41 posts

Posted 22 November 2008 - 11:53 AM

anyway to change Tag3 of mp3 files?

are you talking about ID3v1, ID3v2.2, ID3v2.3 and ID3v2.4 tags?

#7 UltraFine

UltraFine

    Adventurer

  • Banned (NOT IN USE)
  • 146 posts

Posted 22 November 2008 - 12:43 PM

are you talking about ID3v1, ID3v2.2, ID3v2.3 and ID3v2.4 tags?

Yes, how to set ID3 Tags to mp3 files?

#8 ludocus

ludocus

    Possibly inventive crap going on right here

  • Active Members
  • PipPipPipPipPipPip
  • 664 posts

Posted 22 November 2008 - 01:14 PM

you could easely change this to autoit:
http://www.motobit.com/tips/detpg_change-id3-tags-script/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users