Regex to exclude text from recording file name?
Added by gary tan about 8 years ago
Folks, is it possible to remove certain text from a recording file name? Some new tv episodes in my epg have "New:" at the start of the filename. However if i let plex scan that tv show into its library it includes the "New" in the search and so doesn't pick it up correctly. Example is it searches "New Eastenders" instead of "Eastenders". Any way to get tvheadend to save the file without the "New" in front?
Replies (5)
RE: Regex to exclude text from recording file name? - Added by Jonathan Thomson about 8 years ago
I have a recording database FULL of this type of thing (the other one is, I'm guessing you're in the UK so you'll get this, The X Factor keep changing the programme title to things like "The X Factor Six Chair Challenge", "The X Factor Judges Houses" etc. which of course creates a new folder for each variant of "The X Factor").
There is what you might call a workaround for this, but you can specify the folder name in the recording profile - so if you want everything captured by the regex for "Eastenders" to end up in a folder called "Eastenders" then just set the "Directory" field to "Eastenders".
I'm not sure if the filename can include regex but the above will at least stop the creation of folders when episodes are prefixed with "New" or appended with anything other than the programme title
RE: Regex to exclude text from recording file name? - Added by gary tan about 8 years ago
Thanks for the suggestion!, never entered my head. Will try that for now but would be nice to have a way of automatically removing it as a lot of shows seem to have it.
cheers
RE: Regex to exclude text from recording file name? - Added by Tom Joyce over 5 years ago
I have recently upgraded to the unstable version of tvheadend to take advantage of the series and episode number scraping, but wondered if there were yet any way to do what the OP asked: exclude the string "New: " from the beginning of a programme's title.
RE: Regex to exclude text from recording file name? - Added by Tom Joyce over 5 years ago
In absentia a way of doing this I've stuck a script in the folder "New: Programme Title" to strip the leading New: from the filename and move the file to a folder without the leading New: in the folder name. It's currently called from cron: I may try to work out how to make it a genereic post-recording script.
#!/bin/bash
sudo rename -e 's/New: //' *
sudo mv * ../Programme\ Title
sudo mv ../Programme\ Title/strip.sh strip.sh
RE: Regex to exclude text from recording file name? - Added by Em Smith over 5 years ago
The scraping is meant to strip "New: ", but it only works if tvheadend is built with the pcre option.
Do you have all scraping options enabled on the epggrab in configuration?
What exactly do you have for the programme?