This is a button to tag MP3 files basing on MP3 file name and directory name.
It is useful when you have perfectly named collection in file system structure, but not tagged.
Prerequisites:
- id3 tagging tool which can be found here. (Edit: See Kundal's reply below if the link is still broken.)
Assumptions:
-
The id3 tool in path
C:\Programy\id3\
-
Button is to be run with a directory with MP3 files to be tagged as active (source) directory.
-
Directory structure:
Artist name [year] Album name\Track_number Track title.mp3
For example:
Dol Ammad [2010] Winds Of The Sun (EP)\1 Winds Of The Sun.mp3
(and, of course, rest of the files to be tagged.)
-
Only v2 tags are set.
-
Genre chosen by hand.
Button:
<?xml version="1.0"?>
<button backcol="none" display="label" textcol="none">
<label>Tag MP3 from filename</label>
<icon1>#newcommand</icon1>
<function type="normal">
<instruction>@runmode hide</instruction>
<instruction>@set genre="{dlgchoose|Select genre|Metal+More Metal+Even More Metal+Rock}"</instruction>
<instruction>cmd /V:ON /C FOR /F %Q IN ('dir /b *.mp3^|find /c /v ""') DO FOR /F "delims=[]; tokens=1,2,3" %D in ({sourcepath|nopath|noterm}) DO set ART=%D&set ALB=%F& c:\programy\id3\id3 -M -2 -g {$genre} -a "!ART:~0,-1!" -y "%%E" -l "!ALB:~1!" -n %%1/%Q -m "* %%t.mp3"</instruction>
</function>
</button>
The Grisly Command Line, Featuring Some Obscure CMD Features:
cmd /V:ON /C FOR /F %Q IN ('dir /b *.mp3^|find /c /v ""') DO FOR /F "delims=[]; tokens=1,2,3" %D in ({sourcepath|nopath|noterm}) DO set ART=%D&set ALB=%F& c:\programy\id3\id3 -M -2 -g {$genre} -a "!ART:~0,-1!" -y "%%E" -l "!ALB:~1!" -n %%1/%Q -m "* %%t.mp3"
Have fun!