I regularly download podcasts and for filing purposes (to keep them all in order - sorted by name) always name the files with the following format: YYYY-MM-DD-[Episode name/title or number goes here]
For example:
2015-03-23-302
2015-03-30-304
2015-05-13-Technology Road Show
They will always be in this format and after the DD part of the filename is a dash which will always be followed by either an episode title or episode series number.
What I'd like to do is convert "filename" from YYYY-MM-DD-[Episode Title] to the following mp3tag "title" field: DD-MMM-YYYY: [Episode name/title or number goes here]
So, taking the some examples from the list above:
Original File = 2015-03-23-302 , Convert to 23-Mar-2015-302
Original File = 2015-03-30-304 , Convert to 30-Mar-2015-304
2015-05-13-Technology Road Show , Convert to 13-May-2015-Technology Road Show
MMM I want to short month form, for example if it's month "03", show "Mar" for March. The dash (-) in the last part of the filename is to be replaced by a colon ( : )
Help warmly welcomed and especially appreciated - thank you
This is not possible because the colon is not allowed within a filename, ...
but if you want to write the colon into a tag-field, that's ok.
In Mp3tag there are different ways to reach the goal, here is one ...
Action: Format ValueField: TITLEFormatstring:$regexp(%_filename%,'^(\d\d\d\d)-(\d\d)-(\d\d)(.*)$','$3')'-'$regexp('01Jan02Feb03Mar04Apr05May06Jun07Jul08Aug09Sep10Oct11Nov12Dec','^.*'$regexp(%_filename%,'^(\d\d\d\d)-(\d\d)-(\d\d)(.*)$','$2')'(\w\w\w).*$','$1')'-'$regexp(%_filename%,'^(\d\d\d\d)-(\d\d)-(\d\d)-(.*)$','$1:$4')From: 2015-03-23-302
To : 23-Mar-2015:302
Here is another example ...
Begin Action Group Test2015#20150523.waterfall
Action #1 Actiontype 5: Format value Field ______: TMP_FN1 Formatstring: $regexp(%_filename%,'^(\d\d\d\d)-(\d\d)-(\d\d)-(.+?)$','$1')
Action #2 Actiontype 5: Format value Field ______: TMP_FN2 Formatstring: $regexp(%_filename%,'^(\d\d\d\d)-(\d\d)-(\d\d)-(.+?)$','$2')
Action #3 Actiontype 5: Format value Field ______: TMP_FN3 Formatstring: $regexp(%_filename%,'^(\d\d\d\d)-(\d\d)-(\d\d)-(.+?)$','$3')
Action #4 Actiontype 5: Format value Field ______: TMP_FN4 Formatstring: $regexp(%_filename%,'^(\d\d\d\d)-(\d\d)-(\d\d)-(.+?)$','$4')
Action #5 Actiontype 5: Format value Field ______: TMP_FN2 Formatstring: $replace(%TMP_FN2%,'01','Jan','02','Feb','03','Mar','04','Apr','05','May',
'06','Jun','07','Jul','08','Aug','09','Sep','10','Oct','11','Nov','12','Dec')
Action #6 Actiontype 5: Format value Field ______: TITLE Formatstring: %TMP_FN3%'-'%TMP_FN2%'-'%TMP_FN1%':'%TMP_FN4%
End Action Group Test2015#20150523.waterfall (7 Actions)
Here is another example ...
Begin Action Group Test2015#20150523.waterfall.2
Action #1 Actiontype 7: Import tag fields (guess values) Source format __: %_FILENAME% Guessing pattern: %TMP_FN1%-%TMP_FN2%-%TMP_FN3%-%TMP_FN4%
Action #2 Actiontype 5: Format value Field ______: TMP_FN2 Formatstring: $replace(%TMP_FN2%,'01','Jan','02','Feb','03','Mar','04','Apr','05','May',
'06','Jun','07','Jul','08','Aug','09','Sep','10','Oct','11','Nov','12','Dec')
Action #3 Actiontype 5: Format value Field ______: TITLE Formatstring: %TMP_FN3%'-'%TMP_FN2%'-'%TMP_FN1%':'%TMP_FN4%
End Action Group Test2015#20150523.waterfall.2 (4 Actions)
DD.20150523.1217.CEST
With reference to post #3 ...
the target field has been changed to TITLE ...
and the last separator character has been changed from hyphen minus '-' to colon ':'.
DetlevD, firstly thanks so much for taking the time to reply and also for the fantasticly and expertly provided info!
Where you mention the colon ( : ), I'm talking about this character being withing the "title" field of the tag. In fact, I want all this to take place in the tag itself and leave the filename in tact; the filename is just used as the source to generate the value of the tag "title" field.
I've tried your first suggestion and it works almost perfectly, it does the job but I want that dash ( - ) replaced to a colon, and, all of the conversion to take place in the tag itself?
Much gratitude
Edit: If I change the "Field: _FILENAME" in your code firstly provided to "title" it works exactly as I want it to! Just need to replace the dash in that part to a colon if at all possible?
Edit:
I do apologise, I've got the intended string the wrong way around, how to modify the code to the following format: [Episode Title]: [Date] e.g. 301: 07-Apr-2015 ??
I'm trying to figure using the code but not having no joy - and apologies again, I've just realised my oversight after testing on more files :s
Original Response:
Absolutely beautiful, perfect - thanks so much!
A v.speedy reply and also perfectly understood and solution offered 100% sublime. Can I donate PayPal to you to buy a beer or coffee?
Summary - your solution is spot and bang on, perfect. I apologise again, I get the intended output the wrong way around.
Ho, waterfall, thank you very much!
Too bad for me, I have no online account to collect gifts, but I should probably set up one.
For now I will take your words as reality.
But you are also free to send my earning to Florian's depot.