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

Jeremy Jones jeremy.dwain.jones at gmail.com
Fri Feb 3 20:00:05 UTC 2012


David,

I am also a novice at python, so I can empathize.

Remember that when you are learning new code: *search engines are your
friend*.  I googled:"python sys.argv list" and the second link produced
this:
http://stackoverflow.com/questions/2626026/python-sys-argv-lists-and-indexes
which
explains what the line code below is doing very well.

  chanid, starttime = sys.argv[1:3]

I still did not understand why Raymond told you use [1:3] to populate two
variables, so I again went to google with the search, "python use of colon
in list".  The second item listed was:
http://stackoverflow.com/questions/4012340/python-colon-in-list-index

Now I know from reading that page that the list is using items1 to 3, but
not including 3.  The items you passed from the command line were what you
want for input as the channel Id and the start time.  The command:

  chanid, starttime = sys.argv[1:3]

is storing those passed parameters into variables named:
chanid
starttime

Therefore the line:
  prog = be.getRecording(<chanid>, <be>)

should be:
prog = be.getRecording(chanid, starttime)

What Raymond was telling you about the brackets "< >" was that they are
generic placeholders for which one would insert the required information
into that function call, not an actual part of the syntax of the code.
 Since you are passing that information from the command line, and not
"hard coding" it in the script, you need to use the same variables that
were used to store that information from the command line.


Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.mythtv.org/pipermail/mythtv-users/attachments/20120203/ee1a1c9b/attachment.html 


More information about the mythtv-users mailing list