I have a number actions set up for my subscribed podcasts, with each Action formatting the Mp3s specific to the podcast.
There's a podcast I recently created an Action for which I change the filename, title, year, etc from existing info in the tags. However for the Comment tag I'm not so sure how to cut parts from it.
Tried using $replace() but it replaces the entire tag. Regular expression seems like a better use but I couldn't find the right way to express it. Is there some template I could use to list lines to be removed from a tag?
The original Comment tag:
No Agenda Episode 707 - "Bandwich"
Executive Producers: Baron AJ Rystad, Anonymous
Associate Executive Producers: Lynton Harry, Baronetess Dame Francine Hardaway
Club 707 Member: Baron AJ Rystad
Become a member of the 708 Club, support the show here
Sign Up for the newsletter
Thanks to MartinJJ for the backup recoding of 707
Art By: lindhartsen
ShowNotes Archive of links and Assets (clips etc) 707.noagendanotes.com
New: Directory Archive of Shownotes (includes all audio and video assets used) archive.noagendanotes.com
The No Agenda News Network- noagendanewsnetwork.com
RSS Podcast Feed
Get the No Agenda News App for your iPhone and iPad
Get the NoAgendDroid app for your Android Phone
Torrents of each episode via BitLove
New! BitTorrent Sync the No Agenda Show
Last Modified 03/26/2015 15:04:34
This page created with the FreedomController</blockquote>
And how I'm wanting to edit it using an Action, removing the leading whitespace and a number of unnecessary text lines. Depending on the episode there can be additional 'thanks' lines, but the lines I'm wanting to remove stay the same.
No Agenda Episode 707 - "Bandwich"
Executive Producers: Baron AJ Rystad, Anonymous
Associate Executive Producers: Lynton Harry, Baronetess Dame Francine Hardaway
Club 707 Member: Baron AJ Rystad
Thanks to MartinJJ for the backup recoding of 707
Art By: lindhartsen
ShowNotes Archive of links and Assets (clips etc) 707.noagendanotes.com
Last Modified 03/26/2015 15:04:34</blockquote>
In which file format do you receive the podcast?
Please provide the original text script code from the podcast message, ...
it would make it easier to think about your request.
If you are looking only to lines of the format "key:value", ...
it might be easy to reduce the incoming text to lines having this format.
First of all, you could replace (with regular expression) all double linefeeds with just a single:
Search string:(\r\n)\r\n
Replace string: $1
If you have certain keywords that indicate the text passage you want to delete and also keywords that mark the border to passages you want to keep then you could apply actions of the type "Guess value" in which you define the 2 keep strings, save them to a user-defined field and then merge these 2 fields back to the comment field.
E.g.
Guessing pattern: %keepstring_start%New:%dummy%Last Modified%keepstring_end%
Format value for try_comment
Format string: %keepstring_start%$char(13)$char(10)Last Modified%keepstring_end%
You find the result then in try_comment and can check if the pattern is OK.
if you think it works:
Action of the type format value for COMMENT
format string %try_comment%
Action of the type Remove fields for KEEPSTRING_START;KEEPSTRING_END;TRY_COMMENT
Just an idea - and probably only one of so many ways to do it.
So the original file downloaded is an Mp3. The Action is then run on the Mp3 to format some of the tags. All the tags and information is contained within the original file downloaded.
I've uploaded a clip of a podcast episode with the original tags, as well attached the current version of the action I use for formatting to this post. Hopefully it's what you wanted to know.
Thanks for the tip. Tried this but it cuts all new line spaces between lines while leaving the first new line space. I'll have to look into modifying the command to get it right
Was thinking some border between sections may be a way of doing it. Thing is that the Comment text changes, so it's not always clear where they'll begin. Edit: actually I perhaps could use this for single lines, too if the 'end' can be a newline (although it would result in a lot of custom tags ).
Got it working, yay. Thanks to ohrenkino for the tips and examples.
Stripped the new lines completely, then added one new line break per line. Next split the text into 2 parts then merged together within the Comment tag. Fingers crossed it doesn't break on future episodes.
Used a bit of Regex to cut the last line, too:
Field: COMMENT
Regular expression: (^.)This page created with the FreedomController(.$)
Replace matches with: $1$2
Although you are already satisfied, ...
I have attached a Mp3tag action group for your disposal and testing. Test2015_20150327.LaurenBacall.mta (4.69 KB)
DD.20150327.1637.CET
Woah... that's some impressive handiwork Can't understand most of what's happening, it seems to be going through line by line and checking if the line matches those to be kept?
Hmm, this is not a sequential search line by line, ...
but it looks for key-words in the leading part of the lines in question, ...
then it fetches the entire line.
This offers the possibility to arrange the output text as needed.
There is the tag-field COMMENT,which contains several lines of text.Some lines should be removed,...but some lines should remain,...which begin with this text ...'No Agenda ''Executive Producers: ''Associate Executive Producers: ''Club 707 Member: ''Thanks to ''Art By: ''ShowNotes ''Last Modified 'Step 1,Remove leading spaces or trailing spaces or empty lines:$regexp(%COMMENT%,'^ *|\s*$',)Step 2,Mark the lines,which begin with the given text strings:$regexp(%COMMENT%,'^(No Agenda[: ]+)','\7$1')$regexp(%COMMENT%,'^(Executive Producers[: ]+)','\7$1')$regexp(%COMMENT%,'^(Associate Executive Producers[: ]+)','\7$1')$regexp(%COMMENT%,'^(Club 707 Member[: ]+)','\7$1')$regexp(%COMMENT%,'^(Thanks to[: ]+)','\7$1')$regexp(%COMMENT%,'^(Art By[: ]+)','\7$1')$regexp(%COMMENT%,'^(ShowNotes[: ]+)','\7$1')$regexp(%COMMENT%,'^(Last Modified[: ]+)','\7$1')... or ...$regexp(%COMMENT%,'^((?:No Agenda|Executive Producers|Associate Executive Producers|
Club 707 Member|Thanks to|Art By|ShowNotes|Last Modified)[: ]+)','\7$1')
Step 3,Remove marked lines:$regexp(%COMMENT%,'^(?=\7).*?$',)If you apply the character'#'as the marker symbol for removing,...$regexp(%COMMENT%,'^(?=#).*?$',)
Yup, does just what I wanted This is great, have replaced the rather long Action I was using before with this more streamlined version. I can see this being useful for other podcasts, too.