[mythtv] Suggestion for new python/perl binding API
jyavenard at gmail.com
Sun Feb 8 14:48:28 UTC 2009
The current python bindings (I haven't looked at the perl one yet)
allows you to work with the metadata of MythVideo.
However, the set of functions provided is rather limited because it
doesn't allow you to work with attributes like genres, cast or
The current API allows you to add a category attribute as well as set
the attribute of a given video ; however the function provided is
called getGenreId, which is very confusing.
You can also assign more than one genre to a video, but only one
category can be assigned.
As such the behaviour for retrieving metadata from either IMDB, TMDB
etc ... is limited in what it can actually commit to the MythTV
I have modified the MythVideo python binding to add the following new
functions, and I'd like to get your opinion on what more to add/remove
and the name of the function etc before I commit a ticket with the
patches. Hoping that someone would follow with a Perl implementation.
Find the id of the given category from MythDB.
If the category does not exist, insert it and return its id.
Comment: This function is what getGenreId really should have been.
getGenreId works on the Category attribute
Find the id of the given cast from MythDB.
If the cast does not exist, insert it and return its id.
Comment: This is what getGenreId should have been right from the
start. However I can't just replace the existing getGenreId as it
would break backward compatibility with program expecting it to work
with the category attribute. Not being sure on what to call it, I've
made the name plural... Any suggestions on another name is welcome
Insert the idvideo file in given genre list if it does already exist.
Genre will be created if it doesn't exist return its id.
Find the id of the given country from MythDB.
If the country does not exist, insert it and return its id.
Insert the idvideo file in given country list if it does already exist.
Country will be created if it doesn't exist return its id.
Remove all cross-references of video from genres.
Remove all cross-references of video from country list.
Remove all cross-references of video from cast list.
the existing pruneMetaData has also been modified to clean up
references of the removed video in the list cast, country and genre
list... A bit cleaner that way
For a start. I also modified the find_meta.py to use this new API ;
that way this program behaves exactly like what the Mythvideo Manager
does, except it's more automated of course.
Thank you in advance for your comments.
More information about the mythtv-dev