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

David Crawford davidcrawford83 at gmail.com
Fri Feb 3 19:30:31 UTC 2012


Sorry if I have sounded a bit too demanding, it's just it can be very
tempting to ask questions when you are desperately trying to get something
to work and when you dont really know alot about python scripts.

I have been doing a lot of reading and using trial and error and reading
and re-reading the replies but havent got it to work yet. I'm guessing "be"
is backend? Here is the latest script ive tried but still no joy
:( :

#!/usr/bin/env python

import sys
if len(sys.argv) != 3:
    raise Exception('Invalid argument count')
chanid, starttime = sys.argv[1:3]
import os
from MythTV import MythBE, findfile
be = MythBE()
prog = be.getRecording(<chanid>, <be>)
oldbase = prog.basename.rsplit('.',1)[0]
newbase = prog.formatPath('%m-%d_%H-%i-%s_%cN_%T').rsplit('.',1)[0]
sg = findfile(prog.basename, 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.basename),
            '-o', '/home/subtitles/{0}.srt'.format(newbase))

dave



On 3 February 2012 18:52, Michael T. Dean <mtdean at thirdcontact.com> wrote:

> On 02/03/2012 01:15 PM, David Crawford wrote:
> > Would it be "be" and "starttime" ?
>
> FWIW--and speaking as an outsider to this conversation looking in (I'll
> admit I haven't read all the replies in this thread)--Raymond seems to
> have gone out of his way to help you out with this script, and it seems
> that you're not doing as much as you probably should to "help him help
> you."  Perhaps you could spend a little more time trying to work through
> what the script is doing and how to make it do exactly what you want
> before asking questions--and I think if you do, you'll find that you're
> able to figure out many of the answers by yourself. This way, when you
> do ask questions they would be more-carefully-considered questions about
> things that you may not be able to figure out without guidance.
>
> Since the goal of your script seems to be very much a personal goal (and
> not one that would help the community in general--based on
> http://www.gossamer-threads.com/lists/mythtv/users/501301#501301 +
> http://www.gossamer-threads.com/lists/mythtv/users/501367#501367 , which
> are, to be honest, a bit cryptic about what exactly you're trying to
> do)--your taking the time to figure out exactly what's going on with the
> script would help you, too.  It would allow you to fix the script on
> your own when it breaks or to update or enhance it or to create your own
> scripts in the future.
>
> To do this will involve a lot of searching on the Internet, looking at
> completed/working scripts (to get an idea of how Python works in
> general, and to get an idea of how the MythTV Python bindings work--see,
> for example, http://www.mythtv.org/wiki/Category:Python_Scripts ), as
> well as trial and error.  If you pick some of the shorter scripts and
> pick apart exactly what they're doing, I think it will help you figure
> out how the script/pieces he's provided work.  You'll also need to do
> some searching on the Internet to learn what's going on.  And, you may
> need to consult some Python scripting tutorials (search for "python
> scripting tutorial" (no quotes) with your favorite search engine).  And,
> lastly, probably reading and re-reading this thread--your questions and
> his replies.
>
> This isn't meant to be "mean" or in any way say that you're on your own,
> but is just trying to suggest some approaches that might help you to
> learn a new programming language.  I know that learning programming and
> programming languages can seem like a daunting task, but with the right
> tools and approach, it's quite possible.  And, if you want to create
> customized computer programs, chances are you're going to need to figure
> it out, eventually.
>
> Mike
> _______________________________________________
> 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/efa36912/attachment.html 


More information about the mythtv-users mailing list