Filename to Tag Track Number Conversions


#1

I have ALL my MP3s in the following format

Satriani, Joe - Surfing With The Alien - 05-10 - Satch Boogie.mp3

Obviously I can import these tags directly with the default template, but with one minor problem. I would like the track number within the track to be in the format

nn/tt not nn-tt,

as Winamp seems a bit fussy about this.

I've tried playing around with the Filename -> Tag strings, but as soon as I start meddling with the stings, the preview description disappears, and the file preview window doesn't reflect any changes that I've made.

In the meantime I've set up a convert menu action - replace "-" in the track with "/", but this seems a bit awkward.

Any ideas?

Thanks.


#2

You are struggling with the basics of the underlying NTFS file system:

  • Legal characters in NTFS include the following: [ ] . ; = ( )
  • The period (.) cannot be the first or only character in the filename.
  • Illegal Characters: The following characters are not permitted in Windows file or directory names: / \ : * ? " < > |

These are the restrictions to convert from tag to filename.

DD.20070316.2057

To convert from filename to tag you may use the ready built in converter function or a custom built action group.

To split your filename using the [Alt-2] filename to tag converter:
'Satriani, Joe - Surfing With The Alien - 05-10 - Satch Boogie.mp3'
into parts you may use this format string:
'%artist% - %title% - %track% - %album%'.
This emits a TRACK field of '05-10'.

Another format string like this
'%artist% - %title% - %track%-%track% - %album%'
emits a TRACK field of '05 10'

Another format string like this
'%artist% - %title% - %track%-%dummy% - %album%'
emits a TRACK field of '05'

In a following step you have to replace the '-' by '/'.
There are at least two ways to do that.

  1. The manual way per album.
    In Mp3tag fileview select all tracks of one album, use the track numbering assistant [Ctrl+K], set the proper options and press OK.

  2. The action way for a group of files.
    Create an actiongroup 'TRACK Replace Hyphen by Slash'
    Create an action 'Replace'
    Field: TRACK
    Original : -
    Replacement: /
    Run this action group against the selected group of files.

DD.20070317.0718


#3

I don't think there is a way to convert the dash ("-") to backslash ("/") on-the-fly during a filename-TO-tag formation (if this is what you want).

IMHO using an proper action(as you have already done if i'm correct) to accomplish this is the best way... :wink: :wink:


#4

Thanks for then input guys.

Maybe I wasn't too clear in my post, although VaSiMpoG seemed to get it - sorry for the confusion DetlevD - my fault entirely. Or more precisely, I blame the guys who brewed the beer that I was drinking at the time. But that's another story...

I understand the NTFS/DOS filename restrictions - been programming in DOS/Win environments for 20 years - all too aware of restrictions, but still a useful bit of info for people who DON'T know which characters can/can't be used in a filename.

Should have made it clear that it was the tag that I was trying to create on the fly from the filename. With the nn-tt tag format Winamp (5.33) only displays nn, whereas with nn/tt Winamp displays nn/tt - which is what I want...

%artist% - %title% - %track% - %album% is the process that I am using at the moment to create tags from filenames, and then I use an action as described by both DetlevD and VaSiMpoG to replace '-" with "/".

What I was trying to do was (somehow) manipulate %artist% - %title% - %track% - %album% by replacing %track% with an expression that substituted a "/" in place of the "-" from the filename on the fly.

It is possible to use an expression for tag->filename that changes the "/" to a "-" - %artist% - %album% - $num(%track%,2)-$num($right(%track%,2), 2) - %title%, so why not a similar process in reverse?

While we're on the subject I can't seem to be able to access this string conversion when right-clicking on a file unless I copy/paste it in during each session although I've added it to the Tools->Options-Convert-Tag list of actions. I presume I'm doing something daft. Won't be the first time...

Cheers guys...


#5

Please disregard this section of my last post - a silly mistake by me... Sorry...


#6

If you think about it,this is not actually a change of "/" to "-".It is the formation of the filename based on certain tag elements,parsed by some scripting functions (ie. $num(),$right()).
Still, what you finaly want to achieve seems quite awkward to me,since the filename-TO-tag conversion uses information present in the filename to fill the tag in(which in our occassion is absent).
:rolleyes: :rolleyes: :rolleyes:
Have fun...!


#7

Sematically, you're right. However, if I can parse and process the tags to create a filename, why can't I similarly parse the filename correctly to get the tags? I've had a look at the regular expressions section of this forum, but can't quite seem to find what I want.

As I've made sure that my filenames are strictly delimited by " - " to separate Artist - Album - Track-Total - Title, (I make sure that there are no hyphens within the artist or album names to make sure the tag parsing works consistently in line with the existing tag import templates) it should be possible to parse each element of the filename and process each sub-section accordingly. Right?

For example,

Satriani, Joe - Surfing With The Alien - 05-10 - Satch Boogie.mp3

correlates with the following tags:

Artist, Album, [Track-Total], Title

However, I want to import tags from a filename as follows:

Satriani, Joe - Surfing With The Alien - 05-10 - Satch Boogie.mp3

to create tags like:

Artist, Album, [Track/Total], Title

Looks simple enough in concept to me... Maybe a simple choice of delimiter to be used to separate track/total in tags, specified within options would be the simple solution. Everybody's happy - but I'm sure Florian's got better things to do with his time than deal with issues like this...


#8

Just use a format string like %artist% - %album% - %track% - %title% and replace the hyphen by a slash in a secondary step using a Replace action (as DetlevD already described in the second post).

Kind regards,
Florian