Renaming Filename

Hi guys,
I have been mulling over how to do this for awhile, but I haven't gained any ground as to how to successfully code it.

Yes, this is for exporting. I would also like to extend this for action scripts to actually modify the filename - but that can come after :smiley:

So, what I basically want to do is;
Rename the filename so that it is unique and 8 characters. The unique characters must be extracted from the filename - where 4 characters are made from the Artist tag, and 4 from the Title tag. So, something similar to this;
Filename: Hybrid - Disappear Here (Orchestral Armchair Mix) [Distinctive Records].mp3
Turns into;
Filename: hybrdhoa.mp3
Strings: Hybr D H O A
Filename: Adam Nickey - Voices (Original Mix) [Anjunabeats].mp3
Turns into;
Filename: adnivoor.mp3
Strings: Ad Ni Vo Or
Filename: Barnes & Heatcliff feat. Ann Bailey - Safe and Sound (Original Mix) [Big & Dirty]
Turns into;
Filename: b&hfsaso.mp3
Strings: B & H f S a S O

If the script is trying to extract more characters than the index length, it will add 0 until it fills the required characters.
If the artist/title index has 1 value (eg; Hybrid) it will grab the first 4 characters (eg; Hybr).
If the artist/title index has 2 or 3 values (eg; Adam Nickey) it will grab the first 2 characters from the first 2 values (eg; Ad Ni).
If the artist/title index has 4 or more values (eg; Barnes & Heatcliff feat. Ann Bailey) it will grab the first character of the first 4 values (eg; B & H f).

All the best :stuck_out_tongue:


I just realised, if, say;
Brown Hill & Hitmeister D - Will You Ever Know (Hitmeister D West 'Park' Mix) [Capitain]
Will be;
If it were a different mix, it will still be the same filename..

I will ponder as to how to combat this issue..

Edit 2

Another thought. I may whip something up in Visual Basic.

Yes, this seems to be a rather crazy non intuitive sort of organizing data.
Good part is, that you have defined some rules how it should work.
Maybe other programming languages than Mp3tag Scripting Language will fit better to solve the complex problems given by the rules.
But if you want to do the challenge, then try out Mp3tag SL and you will get deep insight how to use Mp3tag SL.
Do it within Mp3tags actions, create user defined tag-fields as variable storage and so on, prepare some output tag-fields, at end it is the easiest thing to put the data out by an export script.


I work at a radio station, and the 8 character filename is a requirement which is need for our player and library database we use. If I had it my way I would not limit the filenames to 8 characters.. owell.

I have pretty much finished the Visual Basic program. Thanks though :smiley:

As far as I see your only goal is to avoid identical filenames.
With you method you can alway get identical names:
John Paul - Lost (Original Mix)
Josef Panter - Love (Original Mix)

I woul try to work with %_datetime%
I gives you the date and time of the tagging moment.
It has 14 numbers, but i think we could make a regular expression to shorten it and still keep it distinct.