Setbookmark
From MythTV Official Wiki
Note: The correct title of this article is setbookmark. It appears incorrectly here due to technical restrictions.
Author | Raymond Wagner |
Description | Set a bookmark at program start if a program was recorded with start early. |
Supports |
Set a bookmark at program start if we recorded with start early.
Usage
setbookmark --chanid=$CHANID% --starttime="%STARTTIMEISO%"
The Script
#!/usr/bin/env python # Set a bookmark at progstart if we recorded with pre-roll # Invoke as a user job like so: # setbookmark --chanid=$CHANID% --starttime="%STARTTIMEISO%" from MythTV import Recorded from optparse import OptionParser import sys parser = OptionParser(usage="usage: %prog --chanid=<> --starttime=<>") parser.add_option("--chanid", action="store", type="string", dest="chanid", help="Channel ID of recording.") parser.add_option("--starttime", action="store", type="string", dest="starttime", help="Starting Time of recording.") # for backward compatibility with perl script parser.add_option("--progstart", action="store", type="string", dest="progstart", help="DO NOT USE.") opts, args = parser.parse_args() if not (opts.chanid and opts.starttime): # sanity check on inputs print "ChanID or Starttime not provided" sys.exit(1) rec = Recorded((opts.chanid, opts.starttime)) if rec.chanid is None: # check for match print "Recording not found" sys.exit(1) if rec.progstart >= rec.starttime: # no pre-roll sys.exit(0) framerate = rec.seek[-1].mark/float((rec.endtime-rec.starttime).seconds) offset = int(seconds(rec.progstart-rec.starttime)*framerate) rec.markup.add((offset, 2, None)) rec.bookmark = 1 rec.update()