IPB

Welcome Guest ( Log In | Register )

> Notice!

Please take a minute to check our Frequently Asked Questions. Use Search to reveal possible related topics.

Also make sure you've read the Forum Guidelines before posting in this forum.

 
Reply to this topicStart new topic
> Converting roman to arabic number and vice versa, - implemented as action groups -
DetlevD
post Mar 4 2007, 12:42
Post #1


Member


Group: Full Members
Posts: 4129
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.54



If someone has the need to convert roman numbers to arabic numbers or vice versa here are two action groups that can help to do so.

The action group 'Num Roman to Arab' takes as input a valid roman number string and returns an arabic number.
The input value is expected to be stored in a tag named 'NUM_ROMAN'.
At end of run the input tag 'NUM_ROMAN' will be removed from the tag list.
The result is given in the tag named 'NUM_ARAB'.

The action group 'Num Arab to Roman' takes as input an arabic number and returns a roman number string.
The input value is expected to be stored in a tag named 'NUM_ARAB'.
At end of run the input tag 'NUM_ARAB' will be removed from the tag list.
The result is given in the tag named 'NUM_ROMAN'.

CODE
Allowed roman symbolic numbers:
H = 100000
Y =  50000
T =  10000
F =   5000
M =   1000
D =    500
C =    100
L =     50
X =     10
V =      5
I =      1

Allowed arabic numbers:
1 .. 99999


The algorithm development relies on scripting code of Mp3tag version 2.37f.
It respects that there are some bugs in some Mp3tag scripting functions which have been detected recently in Mp3tag version 2.37f.
Nevertheless, by implementing appropriate workaround, I got the action groups working fine.
If those Mp3tag scripting bugs will be removed, then the code of the action groups can be further optimized.

Attached File  Num_Roman_to_Arab.mta ( 9.16K ) Number of downloads: 203

Attached File  Num_Arab_to_Roman.mta ( 1.33K ) Number of downloads: 168


DD.20070304.1230


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd May 2013 - 17:05