» Welcome Guest
[ Log In :: Register ]

 

[ Track this topic :: Email this topic :: Print this topic ]

Topic: Roman numerals <--> track numbers< Next Oldest | Next Newest >
calberga
Ancient Board Spirit



Group: Awaiting Authorisation
Posts: 254
Joined: Oct. 2002
Posted: April 24 2006,16:07

I have a lot of files (symphony movements, for example) where the file name starts (or should start) with a roman numeral which corresponds to the track number.  Is there any reasonable way (short of sweeps on with a filter on the track number/beginning of the file name) to tag from files and rename from tags with translation from arabic <--> roman numerals?

(And -- I know it is out of your balliwick -- I wish I could define file-order in a directory using leading roman numerals.  I works up to VIII, but then it falls apart.)
Back to top
Profile PM 
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: April 24 2006,23:46

Sure, except for the fact that roman numbers aren't allowed in the track number field according to the ID3v2 specification, you can easily perform this change on-the-fly by using the casefix/substring replacement utility on the chosen fields.

--------------
Software author and website owner
Back to top
Profile PM WEB 
calberga
Ancient Board Spirit



Group: Awaiting Authorisation
Posts: 254
Joined: Oct. 2002
Posted: April 25 2006,00:50

Hummm -- I don't think I quite follow.  What I want to do is something like

rename files from tags:

<Tracknr - converted to roman> <Title>

or tag from files

<tracknr - converted from roman> <Title>

Will the casefix/substring handle this?  And how do I get

1 <--> I
9 <--> IX
19 <--> XIX

etc.?
Back to top
Profile PM 
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: April 25 2006,14:22

Hmm, the sequence-repeating nature of roman numerals might be a little obstacle, you are correct. In this case I would include the space after the numbers or similar in the replacement strings, to make sure the conversion does not convert substrings inside the roman numbers.

That should work though, see what I mean? As long as you have one substring replacement for each possible roman number (contrary to one for each digit, that should work just fine.

Example:

"1 " <--> "I "
"9 " <--> "IX "
"19 " <--> "XIX "

--------------
Software author and website owner
Back to top
Profile PM WEB 
calberga
Ancient Board Spirit



Group: Awaiting Authorisation
Posts: 254
Joined: Oct. 2002
Posted: April 25 2006,16:21

That depends on the substitutions being tested for in a specific order (in this case NOT the order shown, or "11 " fails).  Is the order fixed, and equivalent to the order they are entered in the list?  Or, which might work, but I have to think about it, in order of the lenth of the to-be-replaced strings, from longest to shortest?
Back to top
Profile PM 
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: April 25 2006,16:54

Hmm, you are right, the list is auto-alphabetized, so the order cannot be trusted.

Ok, then let's get our hands just a little bit dirty, and create a macro containing an extra operation that makes use of a special prepended "start-marker" to the numbers as well, to remove the ambiguity.

So, the macro would be, in the example case of auto-rename mentioned above:

1.
Rename from tags, with format:

$<Tracknr> <Title>.mp3


2.
Direct rename operation that translates the numbers, in any direction, as described above, with replacements like e.g.:

"$1 " <--> "I "
"$9 " <--> "IX "
"$19 " <--> "XIX "

or, in the other direction:

"$I " <--> "1 "
"$IX " <--> "9 "
"$XIX " <--> "19 "


So, are you friggin' happy now? :p ;)

--------------
Software author and website owner
Back to top
Profile PM WEB 
calberga
Ancient Board Spirit



Group: Awaiting Authorisation
Posts: 254
Joined: Oct. 2002
Posted: April 25 2006,18:16

I'm happy, I'm happy!

Since 12 to 15 is about the highest I've ever seen it wouldn't be too bad.  Besides, the old-programmer in me is drawn to an interesting challange.  I can't help thinking these things through to their ultimate implications.

Oh well, I may have found a affordable (that means free in this case) LISP system that will run on my machine.  I'll be dabbling in that next.
Back to top
Profile PM 
6 replies since April 24 2006,16:07 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]