Tagging script
Jump to navigation
Jump to search
- http://docs.puddletag.net/source/function.html
- http://docs.puddletag.net/source/scripting.html
- http://docs.puddletag.net/source/tags.html
See New new final
basic formatting tests (see bottom for final);
Puddletag directory spaces to _: $replace($validate(%artist%,,’`'/\*?;”|:)," ","_")/$replace($validate(%artist%,,’`'/\*?;”|:)," ","_")-%year%-$replace($validate(%album%,,’`'/\*?;”|:)," ","_") Puddletag file spaces to _: $replace($validate(%artist%,,’`'/\*?;”|:)," ","_")-%year%-$replace($validate(%album%,,’`'/\*?;”|:)," ","_")-$num(%track%,2)-$replace($validate(%title%,,’`'/\*?;”|:)," ","_") Puddletag directory remove spaces: $validate($if(%albumartist%,%albumartist%,%artist%),,’`'/\*?;”|: )/$validate($if(%albumartist%,%albumartist%,%artist%),,’`'/\*?;”|: )-%year%-$validate(%album%,,’`'/\*?;”|: )/ Puddletag file remove spaces: $validate($if(%albumartist%,%albumartist%,%artist%),,’`'/\*?;”|: )-$if($neql(%artist%,%albumartist%),%artist%-,)%year%-$validate(%album%,,’`'/\*?;”|: )-$num(%track%,2)-$validate(%title%,,’`'/\*?;”|: ) $validate($if(%albumartist%,%albumartist%,%artist%),,’`'/\*?;”|: )-$if($neql(%artist%,%albumartist%),%artist%-,)%year%-$validate(%album%,,’`'/\*?;”|: )-$num(%track%,2)-$validate(%title%,,’`'/\*?;”|: ) redo: %artist%/%artist%-%year%-%album%/ %artist%-%year%-%album%-%track%-%title% %albumartist%/%albumartist%-%year%-%album%/ %albumartist%-%year%-%album%-%track%-%artist%-%title% $if(%albumartist%,%albumartist%,%artist%)/$if(%albumartist%,%albumartist%,%artist%)-%year%-%album%/$if(%albumartist%,%albumartist%,%artist%)-%year%-%album%-%track%$if(%albumartist%,-%artist%,)-%title% $validate(,,’`'”-/\|;:*?!&\[],.)
Schema: albumartist = various artists compilation album. An if to see if albumartist and artist is different would fail for compilations including a track by the album artist.
Final:
Puddletag file remove spaces + albumartist ifs: $validate($if(%albumartist%,%albumartist%,%artist%),,’`'/\*?;”|: -&\[],.)/$validate($if(%albumartist%,%albumartist%,%artist%),,’`'/\*?;”|: -&\[],.)-%year%-$validate(%album%,,’`'/\*?;”|: -&\[],.)/$validate($if(%albumartist%,%albumartist%,%artist%),,’`'/\*?;”|: -&\[],.)-%year%-$validate(%album%,,’`'/\*?;”|: -&\[],.)-$num(%track%,2)$if(%albumartist%,-$validate(%artist%,,’`'/\*?;”|: -&\[],.),)-$validate(%title%,,’`'/\*?;”|: -&\[],.)
Produces directory path and filenames like this:
/media/3tb/media/music/FLAC/Decapitated/Decapitated-2000-04-17-WindsofCreation/Decapitated-2000-04-17-WindsofCreation-05-Decapitated-TheEyeofHorus.flac
New final:
Puddletag file spaces to underscores + albumartist ifs: $replace($validate($if(%albumartist%,%albumartist%,%artist%),,’`'/\*?;”|:-&\[],.)," ","_")/$replace($validate($if(%albumartist%,%albumartist%,%artist%),,’`'/\*?;”|:-&\[],.)," ","_")-%year%-$replace($validate(%album%,,’`'/\*?;”|:-&\[],.)," ","_")/$replace($validate($if(%albumartist%,%albumartist%,%artist%),,’`'/\*?;”|:-&\[],.)," ","_")-%year%-$replace($validate(%album%,,’`'/\*?;”|:-&\[],.)," ","_")-$num(%track%,2)$if(%albumartist%,-$replace($validate(%artist%,,’`'/\*?;”|:-&\[],.)," ","_"),)-$replace($validate(%title%,,’`'/\*?;”|:-&\[],.)," ","_")
New new final:
Puddletag file spaces to underscores + albumartist ifs: $replace($validate($if(%albumartist%,%albumartist%,%artist%),,’`'”-/\|;:*?!&\[],.)," ","_")/$replace($validate($if(%albumartist%,%albumartist%,%artist%),,’`'”-/\|;:*?!&\[],.)," ","_")-%year%-$replace($validate(%album%,,’`'”-/\|;:*?!&\[],.)," ","_")/$replace($validate($if(%albumartist%,%albumartist%,%artist%),,’`'”-/\|;:*?!&\[],.)," ","_")-%year%-$replace($validate(%album%,,’`'”-/\|;:*?!&\[],.)," ","_")-$num(%track%,2)$if(%albumartist%,-$replace($validate(%artist%,,’`'”-/\|;:*?!&\[],.)," ","_"),)-$replace($validate(%title%,,’`'”-/\|;:*?!&\[],.)," ","_")
How does evaluation work? test:
$replace($validate($if(%albumartist%,%albumartist%,%artist%)/$if(%albumartist%,%albumartist%,%artist%)-%year%-%album%/$if(%albumartist%,%albumartist%,%artist%)-%year%-%album%-%track%$if(%albumartist%,-%artist%,)-%title%,,’`'/\*?;”|:-&\[],.)," ","_")
Ah, evaluation stops at directory slashes.
Produces directory path and filenames like this:
/media/3tb/media/music/FLAC/Decapitated/Decapitated-2000-04-17-Winds_of_Creation/Decapitated-2000-04-17-Winds_of_Creation-05-Decapitated-The_Eye_of_Horus.flac
Be careful when copying and pasting the above - a new line character might be added to the end.