mp3tag – Advanced conversion from tags to filename

Today I collect several scripts for a program named mp3tag (Version 2.6.2):

Convert tags to filename

$validate([$left(%discnumber%,1)-][$num(%track%,2) - ]$if($grtr($len(%artist%),40),,[%artist% - ])%title%,-)

A short explanation

In Windows are restrictions to the filename, so you can not use several punctuation characters and the whole path should not be longer than 255 charaters at all. Both cases happened to me recently and I sovled the problems this way:

  • $validate(...,-)
    invalid characters like /, ?, *, ", <, >, | and : will be replaced by -. This filters the invalid characters from used tags and prevents that the file become useless.
  • $if($grtr($len(%artist%),40),,[%artist% - ])
    With this here I check how long the artist name is – is it longer than 40 characters it will not be used in the filename.

Furthermore I expect there are any albums which contains more than nine CDs (%discnumber%) so I only include only the first character. For the tracknumber I always expect a format desaster: sometimes it is like „2/18“, „02/7“, „2“ or „02“ Here I read only the first number from this tag and convert it always to two digits with a leading zero.

 

Advertisements

Hinterlasse eine Nachricht | Leave a Message

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s