[mythtv-users] Issue with Transcode Wrapper Stub and mythcommflag

Joseph Fry joe at thefrys.com
Sat Sep 13 08:12:13 UTC 2014


This is directed primarly at Raymond Wagner, but I'd be happy to hear from
others.

I am working on a script using the transcode wrapper stub and it kept
failing... after much digging I think I discovered a couple of issues.

Issue 1: When the script is run, either from the commandline or as a job,
it uses local time for the 'starttime' of the target recording.  However
mythcommflag expects starttime to be UTC.

I was able to solve this by converting starttime to utc for the
mythcommflag call.
 - added 'datetime' to the from "MythTV import..."
 - in the "if build seektable:" block, I added a new line at the top:
        utcstarttime = datetime.frommythtime(starttime).mythformat()
    This works because frommythtime() converts the provided time to utc by
default.
  - replaced '% starttime' with '% utcstarttime' in the task.command block


Issue 2: mythcommflag is running after the old file is deleted, but before
the new filename is committed to the database with the "rec.update"
command.  So mythcommflag errors because it cannot find the file.

I was able to solve this by simply relocating the rec.update() call so it
runs just after the rec.basename, rec.filesize, and rec.transcoded values
are set.
  - from what I can tell, when you use rec.basename, rec.filesize, and
rec.transcoded, you are simply changing the properties in the rec object,
when you do a rec.update you are instructing it to actually commit the
values in the object to the corresponding record in the database.  Thus the
filename (aka basename) is written to the table where it can be
subsequently found by mythcommflag.


Once I made these changes everything worked, but because I am a bit of a
python hack, I wanted to run these changes by the community before
committing them to the wiki.  Am I doing anything dumb here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20140913/7248f921/attachment.html>


More information about the mythtv-users mailing list