[mythtv-commits] mythtv/master commit: a0c822522 by Robert McNamara (rmcnamara)

MythTV noreply at mythtv.org
Thu Jul 21 05:02:52 UTC 2011


      Author:  Robert McNamara <rmcnamara at mythtv.org>
 Change Date:  2011-07-20T21:34:24-07:00
   Push Date:  2011/07/20 22:02:43 -0700
  Repository:  mythtv
      Branch:  master
New Revision:  a0c822522de15b2c99e7fdc58c118193c4493249
   Changeset:  https://github.com/MythTV/mythtv/commit/a0c822522

Log:

Add a Metadata Lookup API Service.

This adds a synchronous metadata lookup method, a new data contract and method to the video API, and some other random tweaks to make it work.

I am not completely certain that the way I've crammed the asynchronous lookups into a synchronous wrapper is the best way to handle it, but until there's some way to handle Qt Events and asynchronous code in the API, I can't see another way to do it.

This API is pretty technical, and is not for the faint of heart.  You really, really ought to be a developer to wrap it, it has little utility for the average user.  It will, however, be useful for anyone who wants to add lookups to MythWeb's scheduling or similar.

In extreme short, here are some uses:

**** How to Query ****

Arguments:

* Title  -  The title of the item being looked up.
* Subtitle  -  The subtitle of the item being looked up.
* Inetref  -  The inetref of the item being looked up.
* Season  -  The Season Number of the item being looked up.
* Episode  - The Episode Number of the item being looked up.
* GrabberType  -  A way of forcing a particular grabber to be used.  Valid arguments are "tv" and "movie."

Most people should *not* specify a GrabberType, but should instead fill in as much of the other data as they can.  However, since the decision making process *can* be imperfect, the application developer may wish to offer manual triggers for one or the other grabber to see what results are available.

Examples of how grabber detection logic would work:

==

BackendIP:6544/Video/LookupVideo?Title=Star Wars

Will always choose the movie grabber.  There's just not enough data here to do better.  However:

==

BackendIP:6544/Video/LookupVideo?Title=Star Wars&GrabberType=tv

Will force a lookup using the configured TV grabber.

==

BackendIP:6544/Video/LookupVideo?Title=Friends&Subtitle=The One With Rachel's Book

Will choose the TV grabber and attempt a lookup by title and subtitle.

==

BackendIP:6544/Video/LookupVideo?Inetref=73739

Will choose the Movie grabber and look up by Inetref, returning a single result, if any.

==

BackendIP:6544/Video/LookupVideo?InetRef=73739&Season=6&Episode=17

Will choose the Television grabber and look up by Inetref, Season, and Episode, returning a single result, if any.

==

BackendIP:6544/Video/LookupVideo?Title=Lost&Subtitle=The End&Inetref=73739&Season=6&Episode=18

This is a tricky one.  The metadata classes will attempt to use the most specific information when it's available.  This lookup will use Inetref, season, and episode with the TV grabber.

**** Interpreting Results ****

The result is a VideoLookupInfoList.  This contains information about the number of results (Count), and a <VideoLookupInfos>, which contains one or more <VideoInfo>, each of which is a result to your query.  It presently contains most of the textual metadata people care about (but not all the data returned by our grabbers).  I'll flesh this out later.

A basic workflow should work like this:

1) Query using all available information.
2) Result is returned.
   2a) If no results, stop.  Lookup failed or no match.
   2b) If one result, you are done.  Parse result.
   2c) If greater than one result, select the inetref you want from the resulting list, and perform a new query with inetref added to your data.
3) Query should now return one result.  Parse result.

You really want to perform the second query with the inetref after a multi-result.  Multiple results do not necessarily return all metadata.  For example, a search for a movie with multiple results will not return tagline and some other info you may wish to display or use.  Always perform searches, adding in new data as it is selected, until only a single result is returned.  This will be a full metadata record.

Currently the lookup API only implements the following returns:

Title
Subtitle
Season
Episode
Year
Tagline
Certification (Rating)
Inetref
Homepage
Release Date
User Rating
Length

I'll add further stuff (artwork, etc) from the metadata classes in the future, but this allows one to get started if they wanted to work on adding lookups to MythWeb.  I will also add a much easier lookup method that will work better for recordings that instead takes chanid and starttime as arguments.  I should be able to do this in the (very) near future.

The Metadata Lookup API will likely see substantial expansion in the future, and this is just a first run at it.  The basic logic will remain the same, though, so it's probably safe to start working with.

Added:

   mythtv/libs/libmythservicecontracts/datacontracts/videoLookupInfo.h
   mythtv/libs/libmythservicecontracts/datacontracts/videoLookupInfoList.h

Modified:

   mythtv/libs/libmythbase/mythversion.h
   mythtv/libs/libmythmetadata/metadatadownload.cpp
   mythtv/libs/libmythmetadata/metadatafactory.cpp
   mythtv/libs/libmythmetadata/metadatafactory.h
   mythtv/libs/libmythservicecontracts/libmythservicecontracts.pro
   mythtv/libs/libmythservicecontracts/services/videoServices.h
   mythtv/programs/mythbackend/services/video.cpp
   mythtv/programs/mythbackend/services/video.h



More information about the mythtv-commits mailing list