Ok thanks,<div><br></div><div>The extractor script I&#39;m using works fine right now though so I&#39;m thinking of just adding the rename script.</div><div><br></div><div>Just to check, to get this to work can i copy the script you wrote in there and make python script with it? where would the format script go?</div>
<div>and say if i ran as a user job could i run it after the extractor script?</div><div><br></div><div>current command that works is:</div><div><br></div><div>python /home/dave/uksub2srt/uksub2srt.py -i &quot;%DIR%/%FILE%&quot; -o /home/subtitles/&quot;%FILE%&quot;.srt</div>
<div><br></div><div>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?</div><div><br></div><div>Cheers!<br><div><br><div class="gmail_quote">
On 2 February 2012 22:00, 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 bgcolor="#FFFFFF" text="#000000"><div class="im">
    On 2/2/2012 15:48, David Crawford wrote:
    </div><blockquote type="cite"><br>
      <div><div class="im">On 31 January 2012 01:27, Raymond Wagner <span dir="ltr">&lt;<a href="mailto:raymond@wagnerrp.com" target="_blank">raymond@wagnerrp.com</a>&gt;</span>
        wrote:<br>
        </div><div class="im"><div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">import os<br>
            from MythTV import MythBE, findfile<br>
            be = MythBE()<br>
            prog = be.getRecording(&lt;chanid&gt;, &lt;starttime&gt;)<br>
            oldbase = prog.basename.rsplit(&#39;.&#39;,1)[0]<br>
            newbase = prog.formatPath(&#39;...&#39;).rsplit(&#39;.&#39;,1)[0]<br>
            sg = findfile(prog.basename, prog.storagegroup)<br>
            if sg is None:<br>
                raise Exception(&#39;file not found&#39;)<br>
            for f in os.listdir(sg.dirname):<br>
                if not (f.startswith(oldbase) and f.endswith(&#39;srt&#39;)):<br>
                    continue<br>
                os.rename(os.path.join(sg.dirname, f),
            os.path.join(sg.dirname,<br>
            newbase+&#39;.&#39;+f.split(&#39;.&#39;)[1]))</blockquote>
        </div>
        <br>
      </div></div><div class="im">
      Still havent figured quite how to make this script yet.... any
      pointers? i just want the .srt subtitle file to be renamed and
      read:
      <div>mm-dd_hh-mm-ss_Channel(BBC)_Program(BBC News).srt</div>
    </div></blockquote>
    <br>
    The above script is crude, but it should work.  There may be some
    minor syntax issues because I never actually tested it.  That last
    argument in the last line should actually read &quot;f.split(&#39;.&#39;,1)[1]&quot;. 
    For the name you have listed, you would want the format string to be
    ...<br>
    <br>
    %m-%d_%H-%i-%s_%cN_%T<br>
    <br>
    The chanid and starttime used to reference the recording would be
    supplied by the jobqueue on the command line, or you could use the
    jobid itself and pull the chanid and starttime out of the database. 
    You would need to do command line parsing to get either of those,
    but there are examples on the wiki of how to do that.  As for
    running the extractor itself, try...<br>
    <br>
    from MythTV import System<br>
    from MythTV.static import INSTALL_PREFIX<br>
    ccextractor =
    System(path=os.path.join(INSTALL_PREFIX,&#39;mythccextractor&#39;))<br>
    ccextractor(&#39;--infile&#39;, os.path.join(sg.dirname, prog.basename))<br>
  </div>

<br>_______________________________________________<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>
<br></blockquote></div><br></div></div>