Ok, so the full script would be this?<div><br></div><div><div>#!/usr/bin/env python</div><div><br></div><div>import os</div><div>from MythTV import MythBE, findfile</div><div>be = MythBE()</div><div>prog = be.getRecording(<chanid>, <starttime>)</div>
<div>oldbase = prog.basename.rsplit('.',1)[0]</div><div>newbase = prog.formatPath('...').rsplit('.',1)[0]</div><div>sg = findfile(prog.basename, prog.storagegroup)</div><div>if sg is None:</div><div>
raise Exception('file not found')</div><div>for f in os.listdir(sg.dirname):</div><div> if not (f.startswith(oldbase) and f.endswith('srt')):</div><div> continue</div><div> os.rename(os.path.join(sg.dirname, f), os.path.join(sg.dirname,</div>
<div>newbase+'.'+f.split('.',1)[1]))</div><div>from MythTV import System</div><div>ccextractor = System(path="/home/dave/uksub2srt/uksub2srt.py")</div><div>ccextractor('-i', os.path.join(sg.dirname, prog.basename),</div>
<div> '-o', '/home/subtitles/{0}.srt'.format(newbase))</div><div>import sys</div><div>if len(sys.argv) != 3:</div><div> chanid, starttime = sys.argv[1:3]</div><br><div class="gmail_quote">On 3 February 2012 01:07, Raymond Wagner <span dir="ltr"><<a href="mailto:raymond@wagnerrp.com">raymond@wagnerrp.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 2/2/2012 19:57, David Crawford wrote:<br>
> On 3 February 2012 00:53, Raymond Wagner <<a href="mailto:raymond@wagnerrp.com">raymond@wagnerrp.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:raymond@wagnerrp.com">raymond@wagnerrp.com</a>>> wrote:<br>
><br>
> On 2/2/2012 18:15, David Crawford wrote<br>
</div><div class="im">>> current command that works is:<br>
>><br>
>> python /home/dave/uksub2srt/uksub2srt.py -i "%DIR%/%FILE%" -o<br>
>> /home/subtitles/"%FILE%".srt<br>
>><br>
>> is there anyway i can include the script to rename the subtitle<br>
>> file in that command, or would it be better just to run a<br>
>> separate script after?<br>
><br>
> from MythTV import System<br>
> ccextractor = System(path="/home/dave/uksub2srt/uksub2srt.py")<br>
> ccextractor('-i', os.path.join(sg.dirname, prog.basename),<br>
> '-o', '/home/subtitles/{0}.srt'.format(newbase))<br>
><br>
><br>
</div><div class="im">> but do i run this as a python script or what? sorry still learning..<br>
<br>
</div>It would be inserted into the previous chunk of code, in place of the<br>
'for' loop, after you populated the 'sg' variable with the location of<br>
the file. Use this to grab the chanid and starttime from the command line:<br>
<br>
import sys<br>
if len(sys.argv) != 3:<br>
chanid, starttime = sys.argv[1:3]<br>
<br>
Add this to the top of the file:<br>
<br>
#!/usr/bin/env python<br>
<br>
And then set your user job to:<br>
<br>
/home/dave/bin/whatever.py %CHANID% %STARTTIME%<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
mythtv-users mailing list<br>
<a href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>
<a href="http://www.mythtv.org/mailman/listinfo/mythtv-users" target="_blank">http://www.mythtv.org/mailman/listinfo/mythtv-users</a><br>
</div></div></blockquote></div><br></div>