[mythtv-users] import video metadata from a script

Raymond Wagner raymond at wagnerrp.com
Sat Jul 6 01:02:28 UTC 2013


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.

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

> 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)



More information about the mythtv-users mailing list