[mythtv-users] import video metadata from a script

Joey Morris rjmorris.list at zoho.com
Sat Jul 6 02:13:43 UTC 2013


Raymond Wagner <raymond at wagnerrp.com> wrote on Fri, Jul 05, 2013 at 09:02:28PM -0400:
> On 7/5/2013 8:10 PM, Joey Morris wrote:
> >First, let me explain why I'm not using mythfrontend for this, because
> >maybe there's a better solution to my original problem than writing a
> >script. I want to import metadata for all 180 of my episodes of
> >Seinfeld. Later, I plan to do this for other series, too. I don't want
> >to hit W on every episode to trigger a metadata download. (With
> >Seinfeld it's even worse because TTVDB returns 3 matches, and I always
> >have to select the first one.) I also don't want to Retrieve All
> >Details, because it makes too many mistakes, and I don't learn about
> >them until I happen to go into a directory and see details for some
> >strange video that I don't own. Also, since Seinfeld matches 3 titles,
> >I'm not sure Retrieve All Details would import its metadata anyway.
> 
> Add a file named 'ttvdb.conf' to your configuration directory
> (~/.mythtv/).  Add the following lines to it...
> 
> [series_name_override]
> Seinfeld:79169
> 
> Add additional lines with the format title:inetref for any other
> data that cannot be processed correctly.
 
I forgot to mention that I'd already set that up, thinking it would
work the way you describe. However, I found that it's really just a
way to map your series names to TTVDB series names when they don't
match. It doesn't actually force ttvdb.py to look up a series by its
ID directly. I think the process goes like this:

  1. my file named "Seinfeld" => 79169  [from ttvdb.conf]
  2. 79169 => official name "Seinfeld"  [via ttvdb lookup]
  3. download metadata for official name "Seinfeld"
  4. find 3 matches for "Seinfeld", ask user for confirmation


> >2) I have to restart mythfrontend for the new metadata to be
> >displayed. Can I force mythfrontend to refresh the metadata without a
> >restart?
> 
> The Video Library caches metadata pulled from the database, but that
> cache should be flushed within a few seconds of leaving the Video
> Library. Exit it, wait on the menu briefly, and it should rescan the
> database when you open it back up.

Yes, that works. I had tried leaving the Video Library and returning,
but I was returning immediately instead of waiting a bit. I'll be more
patient.


> >3) Calling Video._postinit() from a user script doesn't seem
> >appropriate, but it was necessary to prevent an exception. Should I be
> >doing something different?
> 
> Video.create() runs DBDataWrite._create_autoincrement(), which in
> turn runs DBDataWrite._postinit(). This would only generate a fault
> if the create() method pulled an existing entry from the database,
> rather than creating a new one, of course either path should work
> (meaning its a bug that will be fixed presently).
> 
> If you want to reprocess existing videos, you would be better doing
> something like...
> 
> >>> from MythTV import MythDB, VideoGrabber
> >>> grabber = VideoGrabber('tv')
> >>> for vid in MythDB().searchVideos(title="Seinfeld"):
> >>>    vid.importMetadata(grabber.grabInetref(79169, vid.season,
> vid.episode)

Thanks. I'll give this a try.



More information about the mythtv-users mailing list