diff options
author | Britney Fransen <brfransen@gmail.com> | 2014-11-20 16:30:25 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2014-11-20 16:30:25 (GMT) |
commit | 271efacb485f105f67d830ad6d6e950ea197f78f (patch) | |
tree | f731474ce65a2ba361b48828ede88d03c5cce600 /abs/core/LinHES-system/mythvidexport.py | |
parent | ddf28766b17e070a1488b7e4eb3ea67c6b7c94fe (diff) | |
download | linhes_pkgbuild-271efacb485f105f67d830ad6d6e950ea197f78f.zip linhes_pkgbuild-271efacb485f105f67d830ad6d6e950ea197f78f.tar.gz linhes_pkgbuild-271efacb485f105f67d830ad6d6e950ea197f78f.tar.bz2 |
LinHES-system: mythvidexport.py: update to v0.7.6
Diffstat (limited to 'abs/core/LinHES-system/mythvidexport.py')
-rwxr-xr-x | abs/core/LinHES-system/mythvidexport.py | 100 |
1 files changed, 49 insertions, 51 deletions
diff --git a/abs/core/LinHES-system/mythvidexport.py b/abs/core/LinHES-system/mythvidexport.py index 5fdfb6d..9160f1d 100755 --- a/abs/core/LinHES-system/mythvidexport.py +++ b/abs/core/LinHES-system/mythvidexport.py @@ -5,14 +5,12 @@ # Python Script # Author: Raymond Wagner # Purpose -# This python script is intended to function as a user job, run through -# mythjobqueue, capable of exporting recordings into MythVideo. -# https://github.com/wagnerrp/mythtv-scripts/blob/master/python/mythvidexport.py -# http://www.mythtv.org/wiki/Mythvidexport.py +# This python script is intended to function as a user job, run through +# mythjobqueue, capable of exporting recordings into MythVideo. #--------------------------- -__title__ = "MythVidExport" +__title__ = "MythVidExport" __author__ = "Raymond Wagner" -__version__= "v0.7.5" +__version__= "v0.7.6" from MythTV import MythDB, Job, Recorded, Video, VideoGrabber,\ MythLog, MythError, static, MythBE @@ -58,8 +56,10 @@ class VIDEO: # prep objects self.rec = Recorded((self.chanid,self.starttime), db=self.db) + if "_" in self.rec.inetref: + self.rec.inetref = self.rec.inetref.split("_")[1] self.log(MythLog.GENERAL, MythLog.INFO, 'Using recording', - '%s - %s' % (self.rec.title.encode('utf-8'), + '%s - %s' % (self.rec.title.encode('utf-8'), self.rec.subtitle.encode('utf-8'))) self.vid = Video(db=self.db).create({'title':'', 'filename':'', 'host':gethostname()}) @@ -151,7 +151,7 @@ class VIDEO: 'Attempting TV export.') grab = VideoGrabber(self.type) match = grab.sortedSearch(self.rec.title, self.rec.subtitle) - else: # assume movie + else: # assume movie self.type = 'MOVIE' self.log(self.log.GENERAL, self.log.INFO, 'Attempting Movie export.') @@ -189,10 +189,10 @@ class VIDEO: # replace fields from viddata #print self.vid.data ext = '.'+self.rec.basename.rsplit('.',1)[1] - rep = ( ('%TITLE%','title','%s'), ('%SUBTITLE%','subtitle','%s'), - ('%SEASON%','season','%d'), ('%SEASONPAD%','season','%02d'), - ('%EPISODE%','episode','%d'), ('%EPISODEPAD%','episode','%02d'), - ('%YEAR%','year','%s'), ('%DIRECTOR%','director','%s')) + rep = ( ('%TITLE%','title','%s'), ('%SUBTITLE%','subtitle','%s'), + ('%SEASON%','season','%d'), ('%SEASONPAD%','season','%02d'), + ('%EPISODE%','episode','%d'), ('%EPISODEPAD%','episode','%02d'), + ('%YEAR%','year','%s'), ('%DIRECTOR%','director','%s')) for tag, data, format in rep: if self.vid[data]: fmt = fmt.replace(tag,format % self.vid[data]) @@ -200,27 +200,27 @@ class VIDEO: fmt = fmt.replace(tag,'') # replace fields from program data - rep = ( ('%HOSTNAME%', 'hostname', '%s'), + rep = ( ('%HOSTNAME%', 'hostname', '%s'), ('%STORAGEGROUP%','storagegroup','%s')) for tag, data, format in rep: data = getattr(self.rec, data) fmt = fmt.replace(tag,format % data) -# fmt = fmt.replace('%CARDID%',self.rec.cardid) -# fmt = fmt.replace('%CARDNAME%',self.rec.cardid) -# fmt = fmt.replace('%SOURCEID%',self.rec.cardid) -# fmt = fmt.replace('%SOURCENAME%',self.rec.cardid) -# fmt = fmt.replace('%CHANNUM%',self.rec.channum) -# fmt = fmt.replace('%CHANNAME%',self.rec.cardid) +# fmt = fmt.replace('%CARDID%',self.rec.cardid) +# fmt = fmt.replace('%CARDNAME%',self.rec.cardid) +# fmt = fmt.replace('%SOURCEID%',self.rec.cardid) +# fmt = fmt.replace('%SOURCENAME%',self.rec.cardid) +# fmt = fmt.replace('%CHANNUM%',self.rec.channum) +# fmt = fmt.replace('%CHANNAME%',self.rec.cardid) if len(self.vid.genre): fmt = fmt.replace('%GENRE%',self.vid.genre[0].genre) else: fmt = fmt.replace('%GENRE%','') -# if len(self.country): -# fmt = fmt.replace('%COUNTRY%',self.country[0]) -# else: -# fmt = fmt.replace('%COUNTRY%','') +# if len(self.country): +# fmt = fmt.replace('%COUNTRY%',self.country[0]) +# else: +# fmt = fmt.replace('%COUNTRY%','') return fmt+ext def copy(self): @@ -235,7 +235,6 @@ class VIDEO: srcfp = self.rec.open('r') dstfp = self.vid.open('w', nooverwrite=True) - if self.job: self.job.setStatus(Job.RUNNING) tsize = 2**24 @@ -261,7 +260,7 @@ class VIDEO: self.job.setComment("Checking file hashes") self.log(MythLog.GENERAL|MythLog.FILE, MythLog.INFO, "Checking file hashes.") srchash = hashfile(self.rec.open('r')) - dsthash = hashfile(self.vid.open('r')) + dsthash = hashfile(self.rec.open('r')) if srchash != dsthash: raise MythError('Source hash (%s) does not match destination hash (%s)' \ % (srchash, dsthash)) @@ -294,30 +293,30 @@ class VIDEO: def usage_format(): usagestr = """The default strings are: - Television: Television/%TITLE%/Season %SEASON%/%TITLE% - S%SEASON%E%EPISODEPAD% - %SUBTITLE% - Movie: Movies/%TITLE% - Generic: Videos/%TITLE% +Television: Television/%TITLE%/Season %SEASON%/%TITLE% - S%SEASON%E%EPISODEPAD% - %SUBTITLE% +Movie: Movies/%TITLE% +Generic: Videos/%TITLE% Available strings: - %TITLE%: series title - %SUBTITLE%: episode title - %SEASON%: season number - %SEASONPAD%: season number, padded to 2 digits - %EPISODE%: episode number - %EPISODEPAD%: episode number, padded to 2 digits - %YEAR%: year - %DIRECTOR%: director - %HOSTNAME%: backend used to record show - %STORAGEGROUP%: storage group containing recorded show - %GENRE%: first genre listed for recording +%TITLE%: series title +%SUBTITLE%: episode title +%SEASON%: season number +%SEASONPAD%: season number, padded to 2 digits +%EPISODE%: episode number +%EPISODEPAD%: episode number, padded to 2 digits +%YEAR%: year +%DIRECTOR%: director +%HOSTNAME%: backend used to record show +%STORAGEGROUP%: storage group containing recorded show +%GENRE%: first genre listed for recording """ -# %CARDID%: ID of tuner card used to record show -# %CARDNAME%: name of tuner card used to record show -# %SOURCEID%: ID of video source used to record show -# %SOURCENAME%: name of video source used to record show -# %CHANNUM%: ID of channel used to record show -# %CHANNAME%: name of channel used to record show -# %COUNTRY%: first country listed for recording +# %CARDID%: ID of tuner card used to record show +# %CARDNAME%: name of tuner card used to record show +# %SOURCEID%: ID of video source used to record show +# %SOURCENAME%: name of video source used to record show +# %CHANNUM%: ID of channel used to record show +# %CHANNAME%: name of channel used to record show +# %COUNTRY%: first country listed for recording print usagestr def print_format(): @@ -333,9 +332,9 @@ def print_format(): if not gfmt: gfmt = 'Videos/%TITLE%' print "Current output formats:" - print " TV: "+tfmt - print " Movies: "+mfmt - print " Generic: "+gfmt + print " TV: "+tfmt + print " Movies: "+mfmt + print " Generic: "+gfmt def main(): parser = OptionParser(usage="usage: %prog [options] [jobid]") @@ -361,7 +360,7 @@ def main(): "in place of the job id.") sourcegroup.add_option("--chanid", action="store", type="int", dest="chanid", help="Use chanid for manual operation") - sourcegroup.add_option("--starttime", action="store", type="string", dest="starttime", + sourcegroup.add_option("--starttime", action="store", type="int", dest="starttime", help="Use starttime for manual operation") parser.add_option_group(sourcegroup) @@ -436,4 +435,3 @@ def main(): if __name__ == "__main__": main() - |