[mythtv-users] Exporting recordings

Michael T. Dean mtdean at thirdcontact.com
Sun Mar 29 16:19:32 UTC 2020


On 03/28/2020 04:45 PM, Larry Kennedy wrote:
>
> I've used mythlink with success to make mythtv recordings visible to 
> Plex, provided the Myth database has good metadata, to include Season 
> and Episode.  Unless I've overlooked something, the script seems to 
> presume that recordings are always TV shows and not movies.  For 
> example, mythlink creates poor filenames for recorded movies since it 
> looks for season and episode information in the database, but for a 
> movie it really needs the year of release.  Movies (at least in Plex) 
> need filenames such as Batman Begins (2005). However, for a TV show, I 
> need to create a file like this: Blacklist-S08E10
>
> Is there a way for mythlink to understand which recordings are movies 
> vs TV shows, and create the correct filenames?  If not, is there 
> another script that does this? I'm not sure the myth database has a 
> way to capture the year of release for a recorded movie, so maybe this 
> is a non-starter.
>

The mythlink.pl script, by itself, doesn't have any logic for 
selectively creating links, so you'd need to use something else to 
provide that logic.  Probably the best way to get what you want would be 
to use a script to call mythlink.pl with the --chanid/--starttime 
arguments to create links for only a single file.  The script that's 
calling mythlink.pl would loop over all the recordings, choosing which 
--format to pass based on the recording type.

To determine which recordings are movies and which aren't, you have many 
different options.  If you've put all the movies into specific recording 
groups, you can just get a list of all the recordings in those groups 
and loop over them with the --format for movies, then get a list of all 
the recordings not in those groups and loop over them with the --format 
for non-movies.  Similar approaches could be used for other 
user-organization options in MythTV (if you have anything you've done 
specifically to separate movies from non-movies, including storage 
groups or playback groups or user jobs or ...).

If you haven't specifically done anything to organize/separate movies, 
you have other options.  There are many 
non-ideal/not-guaranteed-to-work-consitently approaches you may be able 
to use to "guess" that something is a movie (using subtitle, programid, 
seriesid, filesize, or similar hacks that may well work for you now/with 
the movies you've previously recorded, but could stop working at any 
time/on some movies/... and definitely would not be good approaches to 
share back to the community by posting your script to the wiki).

Depending on your listings source, you may actually have proper data 
specifying which are movies in the category_type in recordedprogram.  
The Python bindings make it easy to get recording information using this 
information.  I think you basically just call the searchRecorded() 
function on the database object with something like:

MythDB().searchRecorded(category_type='movie')

See 
https://www.mythtv.org/wiki/0.25_Python_Bindings/Connection_Handlers#MythDB 
and several posted scripts use searchRecorded, including 
delete_recordings.py ( https://www.mythtv.org/wiki/Delete_recordings.py ).

So, basically the approach here is similar to the approach for using 
mythlink.pl with MythTV System Events, but rather than doing it once for 
a system event, you're looping over all the existing recordings.  See 
https://www.mythtv.org/wiki/Mythlink.pl#Using_with_MythTV_System_Events 
.  Note, too, that as described on the mythlink.pl wiki page in the 
Usage section and as re-referenced in the System Events section, when 
you call mythlink.pl with the --chanid/--starttime arguments, it does 
not delete existing links, so you would need to delete old links 
yourself (could be another script using MythTV methods or even just one 
that checks to see if there is no file at the destination, in which case 
the link is old/dead).

Mike


More information about the mythtv-users mailing list