I'm trying to create an Export script which will export to a standards-compliant podcast RSS feed.
However (as usual ) I've encountered a few problems.
1. How can I copy the weekdays and month names from the File Create timestamp, it seems Mp3Tag re-formats them into digits before inserting them into the tag.
The RFC 2822 standard for RSS feeds is: Thu, 31 05 2012 10:56:46 GMT
Seeing as I had no way to extract the weekdays I tried to at least convert the 2-digit month name into a name, one for each month, but my RegExp failed. Could anyone correct this (excuse my ignorance):
Original (in %pubdate% tag): 31 05 2012 10:56:46 GMT
What I wanted my code to do: 31 May 2012 10:56:46 GMT
My code:
$if($eql($regexp(%pubdate%,^\d\d\s(\d\d)$,$1),'05'),$regexp(%pubdate%,(\d\d\s)\d\d(\s),$1May$2),%pubdate%)
Solution (thanks to DetlevD for the brilliant code and support):
$left(%pubdate%,3)$replace($mid(%pubdate%,4,2),'01','Jan','02','Feb','03',
'Mar','04','Apr','05','May','06','Jun','07','Jul','08','Aug','09',
'Sep','10','Oct','11','Nov','12','Dec')$right(%pubdate%,18)
2. I'm trying to set a limit to the number of exported $loop entries. Using the format: $loop(%fieldname%,num) as stated in the help documents doesn't appear to work, as I'm sorting by %releasetime%, and each item's value is different.
Eg: $loop(%releasetime%,20)
%title%
$loopend()
Where '20' is the number of looped s I'd like in the Export output. However this doesn't work, so I'm guessing the number of loop entries should be controlled by some function that would wrap around the tag, but I'm unsure. I tried $repeat(.....,20) but that didn't work.
The idea is if the user had 100 items selected and then used Export that only 20 entries (with exclusions based on extension and directory name) would be appear the output. I have the conditional exclusions set up, all I need now is a way to set a limit on the number of displayed entries.
3. How can the $loop be sorted in the reverse order? Currently the newest (as sorted by the timestamp) are last, but I'd like them to be first in the list. Sorting them differently in the main Mp3Tag window doesn't change their order.
I found this topic but I'm unsure how I would apply it to the format: YYYY-MM-DDThh:mm:ssZ.
Solution:
$loop($sub(99999999999999,$regexp(%releasetime%,(\d\d\d\d)-(\d\d)-(\d\d)\w(\d\d)'[:]+'(\d\d)'[:]+'(\d\d)\w,$1$2$3$4$$5$6)))
4. How would it be possible to only include items in the $loop that match certain extensions, and hide others (similar to a conditional export)?
Eg: display Mp3s and Mp4s in the $loop, but not FLACs or WAVs.
Solution - wrap the entire tag within this conditional $if parameter:
$ifgreater($strstr('|mp3|m4a|','|'%_extension%'|'),0,
.........inner content here.........
,%dummy%)
Older solution (works, but only allows for two matching extensions, DetlevD's revised code above allows for more extensions to be added):
$if($or($eql($lower(%_extension%),'mp3'),$eql($lower(%_extension%),'m4a')),
.........inner content here.........
,%dummy%)
5. In my testing I noticed that that paragraphs and line breaks need to formatted in HTML to be displayed as such in feed readers. The text content is entered in a multi-line comment box, saved to the Comment tag, which the Export script would then format to HTML.
The first line of the Comments would start with a
and end with a
. Additionally any line of text following two carriage returns (?) would start with afollowed by the text and end with a
. Line breaks would only have to start with a.
What I'm hoping to achieve:
First line of text.....
Another line.....
Line break.
to
First line of text.....
Another line.....
Line break.
After the remainding problems have been fixed I'm thinking of submitting it to the Export configuration sub-forum for people to use who make podcasts, complete with annotations and alternative codes. The Export script would be fully automatic, turning Mp3Tag into a useful feed generator !
Thanks