So, running all that in that not order work then?
On 3 February 2012 01:49, Raymond Wagner <raymond at wagnerrp.com> wrote:
> And... a bit of python jumble...
>>> > #!/usr/bin/env python
>> This needs to go at the top of the file... good.
>> > import os
> > from MythTV import MythBE, findfile
> > be = MythBE()
> > prog = be.getRecording(<chanid>, <starttime>)
>> When you look up the command line arguments for an application, usually
> required options are seen in diamond braces (<>). I was going for the
> same thing here. You need to give the getRecording() method the chanid
> and starttime of the recording you want it to find.
>> > oldbase = prog.basename.rsplit('.',1)[0]
> > newbase = prog.formatPath('...').rsplit('.',1)[0]
> > sg = findfile(prog.basename, prog.storagegroup)
> > if sg is None:
> > raise Exception('file not found')
>>> > for f in os.listdir(sg.dirname):
> > if not (f.startswith(oldbase) and f.endswith('srt')):
> > continue
> > os.rename(os.path.join(sg.dirname, f), os.path.join(sg.dirname,
> > newbase+'.'+f.split('.',1)[1]))
>> This was supposed to rename the potential several resultant files coming
> out of `mythccextractor`. Since you're not using `mythccextractor`,
>> > 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))
>> this down here was supposed to replace it. Additionally, unless you're
> trying to limit certain modules to certain scopes, either to keep the
> namespace clean or because that scope may never be entered and there not
> be any need to import it, it's better to do your imports at the top of
> the file just so you know where to look for them.
>> > import sys
> > if len(sys.argv) != 3:
> > chanid, starttime = sys.argv[1:3]
>> You can't do anything until you get your recording from the backend, and
> you can't do that until you know what chanid and starttime you want the
> information for. Pulling that information out of your command line
> variables at the end of the script isn't going to do you any good.
> _______________________________________________
> mythtv-users mailing list
>mythtv-users at mythtv.org>http://www.mythtv.org/mailman/listinfo/mythtv-users>-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.mythtv.org/pipermail/mythtv-users/attachments/20120203/077f29e0/attachment.html