MythTV Python bindings

 

Mythtv Python Bindings

 

Published as http://svn.mythtv.org/trac/ticket/6245

Patch is available here:

http://www.avenard.org/files/media/mythtv/python-bindings.patch


The current python bindings 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 country.

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 database.


I have modified the MythVideo python binding to add the following new functions, hoping that someone would follow with a Perl implementation.


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


getCategoryId(category_name):

               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. getCategoryId is the same as

getGenreId


getGenresId(genre_name):

               Find the id of the given cast from MythDB.

               If the genre 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



Genres(genre_name, idvideo):

               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.


CountryId(country_name):

               Find the id of the given country from MythDB.

               If the country does not exist, insert it and return its id.


Country(country_name, idvideo):

               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.


cleanGenres(idvideo):

               Remove all cross-references of video from genres.


cleanCountry(idvideo):

               Remove all cross-references of video from country list.


cleanCast(idvideo):

               Remove all cross-references of video from cast list.

 

Monday, 9 February 2009

 
 
Made on a Mac

next >

< previous