Opened 11 years ago

Closed 10 years ago

#6245 closed enhancement (fixed)

Additional features in API of Python bindings

Reported by: jyavenard@… Owned by: Anduin Withers
Priority: minor Milestone: unknown
Component: Bindings - Python Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

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.

Genres(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.

Attachments (1)

python-bindings.patch (6.7 KB) - added by jyavenard@… 11 years ago.
Mods for new python bindings API

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by jyavenard@…

Attachment: python-bindings.patch added

Mods for new python bindings API

comment:1 Changed 11 years ago by jyavenard@…

Forgot to mention.

The existing python bindings already provide the ability to edit the cast ; the model of this function was used for all the other one...

comment:2 Changed 11 years ago by Anduin Withers

Owner: changed from Isaac Richards to Anduin Withers
Status: newassigned

comment:3 Changed 11 years ago by jyavenard@…

by the way, trac modified the name of some functions. It is setGenres/setCast/setCountry and getGenresId/getCastId/getCountryId etc

comment:4 Changed 10 years ago by Rob Smith

Resolution: fixed
Status: assignedclosed

(In [21190]) Fixes #6245, this adds some python binding improvements related to mythvideo

Note: See TracTickets for help on using tickets.