[mythtv-users] User Job to rip subtitles from each program

Raymond Wagner raymond at wagnerrp.com
Fri Feb 3 01:07:33 UTC 2012


On 2/2/2012 19:57, David Crawford wrote:
> On 3 February 2012 00:53, Raymond Wagner <raymond at wagnerrp.com 
> <mailto:raymond at wagnerrp.com>> wrote:
>
>     On 2/2/2012 18:15, David Crawford wrote
>>     current command that works is:
>>
>>     python /home/dave/uksub2srt/uksub2srt.py -i "%DIR%/%FILE%" -o
>>     /home/subtitles/"%FILE%".srt
>>
>>     is there anyway i can include the script to rename the subtitle
>>     file in that command, or would it be better just to run a
>>     separate script after?
>
>     from MythTV import System
>     ccextractor = System(path="/home/dave/uksub2srt/uksub2srt.py")
>     ccextractor('-i', os.path.join(sg.dirname, prog.basename),
>                 '-o', '/home/subtitles/{0}.srt'.format(newbase))
>
>
> but do i run this as a python script or what? sorry still learning..

It would be inserted into the previous chunk of code, in place of the 
'for' loop, after you populated the 'sg' variable with the location of 
the file.  Use this to grab the chanid and starttime from the command line:

import sys
if len(sys.argv) != 3:
     chanid, starttime = sys.argv[1:3]

Add this to the top of the file:

#!/usr/bin/env python

And then set your user job to:

/home/dave/bin/whatever.py %CHANID% %STARTTIME%


More information about the mythtv-users mailing list