[mythtv-users] User Job to rip subtitles from each program

David Crawford davidcrawford83 at gmail.com
Thu Feb 2 20:48:28 UTC 2012


Still havent figured quite how to make this script yet.... any pointers? i
just want the .srt subtitle file to be renamed and read:
mm-dd_hh-mm-ss_Channel(BBC)_Program(BBC News).srt

Sorry just a bit of a noob and would be really grateful for any help.

Cheers,

Dave

On 31 January 2012 01:27, Raymond Wagner <raymond at wagnerrp.com> wrote:

> On 1/30/2012 20:03, Michael T. Dean wrote:
> > fixed top-posting
> >
> > On 01/30/2012 07:09 PM, David Crawford wrote:
> >> On 30 January 2012 23:33, Jeremy Jones wrote:
> >>> On Mon, Jan 30, 2012 at 1:34 PM, David Crawford wrote:
> >>>> I managed to get the script to work as a userjob in the end (whay
> hey!)
> >>>>
> >>>> only thing is the file names system of the recordings. I use an app to
> >>>> search through the subtitles and its designed to work with files with
> a
> >>>> particular format (basicially the one used in DVBVIewer).
> >>>>
> >>>> Is there a way that I can maybe add a script that can change the
> >>>> filenames of the ripped subtitle files to read like:
> >>>> %date%-%time%-%channel%-%programme% ?
> >>> Take a look at mythlink.pl.  It is designed to create symbolic links
> >>> of your recordings with *pretty* names like you described above, but
> >>> with some string substitutions, I bet you can piece something together
> >>> to work for your user created subtitle files. (If I understand what
> >>> you are doing in your userjob correctly)
> >> Yeah, I actually took a look at that. The thing is I want to actually
> >> re-name the subtitle files only in this "pretty" format otherwise the
> >> application I have wont be able to read them properly. Just not sure
> how to
> >> piece together what i need..
> > I was thinking your script is in Python, in which case you probably want
> > to use the Python bindings' support for creating pretty names.  It works
> > with the same formatting specifiers as the Perl bindings'/mythlink.plones.
>
> Specifically
> http://www.mythtv.org/wiki/0.24_Python_bindings/Data_Handlers#formatPath
>
> You could do something like...
>
> import os
> from MythTV import MythBE, findfile
> be = MythBE()
> prog = be.getRecording(<chanid>, <starttime>)
> 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]))
> _______________________________________________
> 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/20120202/85e7e2b1/attachment.html 


More information about the mythtv-users mailing list