[mythtv-users] Rename a file problems

David Crawford davidcrawford83 at gmail.com
Fri Feb 10 14:12:05 UTC 2012


On 10 February 2012 13:52, David Crawford <davidcrawford83 at gmail.com> wrote:

>
>
> On 10 February 2012 13:51, Raymond Wagner <raymond at wagnerrp.com> wrote:
>
>>  On 2/10/2012 08:25, David Crawford wrote:
>>
>> On 10 February 2012 13:24, Raymond Wagner <raymond at wagnerrp.com> wrote:
>>
>>> On 2/10/2012 08:20, David Crawford wrote:
>>> > Are those python scripts you mention already included in 0.24?
>>>  What scripts?
>>>
>>  mythproto.py and dataheap.py
>>
>>
>> Those aren't scripts.  Those are part of the bindings.
>>
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users at mythtv.org
>> http://www.mythtv.org/mailman/listinfo/mythtv-users
>>
>> Got ya, understood. I'll test that out, thanks!


Just tested vai cmd  and eventhough it seems to be pulling the relevant
info somehow (it says BBC ONE BBC ONE.srt) in the cmd after execution, the
filename is still the same and has 1001N instead of BBC ONE. This is the
exact script that I am using, I guess do I have something in the wrong
place?:

#!/usr/bin/python

import sys
import os

if len(sys.argv) != 3:
    raise Exception('Invalid argument count')
chanid, starttime = sys.argv[1:3]

from MythTV import Channel
path = '%cn %cc %cN.srt'
chan = Channel(chanid)
for (tag, data) in (('cn', 'channum'),('cc','callsign'),('cN','name')):
    tmp = unicode(chan[data]).replace('/','-')
    path = path.replace('%'+tag, tmp)
print path

from MythTV import MythBE, findfile
be = MythBE()
prog = be.getRecording(chanid, starttime)
oldbase = prog.filename.rsplit('.',1)[0]
newbase = prog.formatPath('%m-%d_%H-%i-%s_%cN_%T').rsplit('.',1)[0]
sg = findfile(prog.filename, prog.storagegroup)
if sg is None:
    raise Exception('file not found')


from MythTV import System
ccextractor = System(path="/home/dave/uksub2srt/uksub2srt.py")
ccextractor('-i', os.path.join(sg.dirname, prog.filename),
             '-o', '/home/dave/Downloads/subtitles/{0}.srt'.format(newbase))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.mythtv.org/pipermail/mythtv-users/attachments/20120210/7b3c55fe/attachment.html 


More information about the mythtv-users mailing list