[mythtv-users] import video metadata from a script

Joey Morris rjmorris.list at zoho.com
Sat Jul 6 00:10:14 UTC 2013


I'm trying to use a script to import metadata for some of my videos
(not recordings), and I'm having a few minor problems. I'm running
0.26-fixes.

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.

Therefore, I thought a script using the python bindings would be the
way to go. My script (included below) is working reasonably well. It
successfully imports the major things, like subtitle, plot,
screenshot, banner. Here are the problems I'm having:

1) The studio (network for TV - NBC in this case) and rating (TV-PG in
this case) aren't populated. These are stored in the series-level
section in the data from TTVDB instead of the episode-level section.
mythfrontend does populate these fields when you hit W. Can I use the
python bindings to populate these fields?

2) I have to restart mythfrontend for the new metadata to be
displayed. Can I force mythfrontend to refresh the metadata without a
restart?

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?

If anyone has any comments on the overall approach or the specifics of
the script, please share. Here is my script:

from MythTV import Video, VideoGrabber

# Hardcode one file for now.
inetref = "79169"
filename = "tv/Seinfeld/Season 2/Seinfeld - s02e06 - The Statue.mkv"

vid = Video.fromFilename(filename)

# Required for create() to recognize the existing record.
vid.host = "myhostname"

# Creates a record only if one doesn't already exist.
vid.create()

# Required to initialize cast, genre, country. Exception otherwise.
vid._postinit()

grab = VideoGrabber('tv')
metadata = grab.grabInetref(inetref, vid.season, vid.episode)
vid.importMetadata(metadata)



More information about the mythtv-users mailing list