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(&lt;chanid&gt;, &lt;starttime&gt;)</div>
<div>oldbase = prog.basename.rsplit(&#39;.&#39;,1)[0]</div><div>newbase = prog.formatPath(&#39;...&#39;).rsplit(&#39;.&#39;,1)[0]</div><div>sg = findfile(prog.basename, prog.storagegroup)</div><div>if sg is None:</div><div>
    raise Exception(&#39;file not found&#39;)</div><div>for f in os.listdir(sg.dirname):</div><div>    if not (f.startswith(oldbase) and f.endswith(&#39;srt&#39;)):</div><div>        continue</div><div>    os.rename(os.path.join(sg.dirname, f), os.path.join(sg.dirname,</div>
<div>newbase+&#39;.&#39;+f.split(&#39;.&#39;,1)[1]))</div><div>from MythTV import System</div><div>ccextractor = System(path=&quot;/home/dave/uksub2srt/uksub2srt.py&quot;)</div><div>ccextractor(&#39;-i&#39;, os.path.join(sg.dirname, prog.basename),</div>
<div>            &#39;-o&#39;, &#39;/home/subtitles/{0}.srt&#39;.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">&lt;<a href="mailto:raymond@wagnerrp.com">raymond@wagnerrp.com</a>&gt;</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>
&gt; On 3 February 2012 00:53, Raymond Wagner &lt;<a href="mailto:raymond@wagnerrp.com">raymond@wagnerrp.com</a><br>
</div><div class="im">&gt; &lt;mailto:<a href="mailto:raymond@wagnerrp.com">raymond@wagnerrp.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     On 2/2/2012 18:15, David Crawford wrote<br>
</div><div class="im">&gt;&gt;     current command that works is:<br>
&gt;&gt;<br>
&gt;&gt;     python /home/dave/uksub2srt/uksub2srt.py -i &quot;%DIR%/%FILE%&quot; -o<br>
&gt;&gt;     /home/subtitles/&quot;%FILE%&quot;.srt<br>
&gt;&gt;<br>
&gt;&gt;     is there anyway i can include the script to rename the subtitle<br>
&gt;&gt;     file in that command, or would it be better just to run a<br>
&gt;&gt;     separate script after?<br>
&gt;<br>
&gt;     from MythTV import System<br>
&gt;     ccextractor = System(path=&quot;/home/dave/uksub2srt/uksub2srt.py&quot;)<br>
&gt;     ccextractor(&#39;-i&#39;, os.path.join(sg.dirname, prog.basename),<br>
&gt;                 &#39;-o&#39;, &#39;/home/subtitles/{0}.srt&#39;.format(newbase))<br>
&gt;<br>
&gt;<br>
</div><div class="im">&gt; 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>
&#39;for&#39; loop, after you populated the &#39;sg&#39; 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>