1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PyTivo Video Manager HME App for pyhme

Discussion in 'Developers Corner' started by jbernardis, Apr 20, 2011.

  1. Apr 29, 2011 #21 of 735
    tomm1079

    tomm1079 New Member

    567
    0
    May 10, 2005
    What exactly is this program? I am trying to figure it out by reading this thread but it doesnt tell alot.
     
  2. Apr 29, 2011 #22 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    pytivo provides the ability to "push" videos to your tivo through its web interface rather than going to your tivo and "pulling" them. The advantage to pushing is that if the file is in a compatible format (basically mp4 with H.264 video encoding and either AC3 or AAC audio encoding) the file is transfered as is without transcoding. This saves considerable time and space. The problem is that pushing can only be done from your PC.

    With this app, you can request pushes from the tivo interface (hence from the TV with your peanut remote control). You are presented with the same directory structure that pytivo knows about. You select which videos you want, and then request that that video be pushed to your tivo. While I was at it, I also added the ability to delete videos since pytivo doesn't have that capability natively.
     
  3. Apr 30, 2011 #23 of 735
    innocentfreak

    innocentfreak Active Member

    8,950
    3
    Aug 25, 2001
    Florida
    Hmm sounds interesting. I have never set up HME though so I guess I should play with that first.
     
  4. Apr 30, 2011 #24 of 735
    lew

    lew Active Member

    3,966
    3
    Mar 12, 2002
    I'm using MetaGenerator V2. It displays a copy of the DVD cover and a picture for most TV series. Does anyone know if there is a way to save the image so it can be used with PyTivo Video Manager?

    I'm not sure if MetaGenerator is open source. Doesn't look like it's been updated recently.
     
  5. Apr 30, 2011 #25 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    Metagenerator did not do it for me - the images seemed too small.

    I was able to get most of my images from amazon.com. Where they didn't adhere to the 320x444 size, I used irfanview to resize them while maintaining aspect ratio - simple.
     
  6. May 1, 2011 #26 of 735
    jcthorne

    jcthorne Active Member

    2,726
    3
    Jan 28, 2002
    Houston
    Try a utility called thumbgen. It will web scrape images from many sources including amazon, netflix, imdb and tvdb. It will also automaticly resize the image to your specs. It does alot more but I have not figured out how to format its metadata into pytivo compatible format yet.
     
  7. May 1, 2011 #27 of 735
    innocentfreak

    innocentfreak Active Member

    8,950
    3
    Aug 25, 2001
    Florida
    Hmm I must have set something up wrong. It shows up on my TiVo but I am getting an error in the window.

    ----------------------------------------
    Exception happened during processing of request from ('192.168.1.2', 54672)
    Traceback (most recent call last):
    File "C:\Python26\lib\SocketServer.py", line 560, in process_request_thread
    self.finish_request(request, client_address)
    File "C:\Python26\lib\SocketServer.py", line 322, in finish_request
    self.RequestHandlerClass(request, client_address, self)
    File "C:\PyHME\start.py", line 141, in __init__
    client_address, server)
    File "C:\Python26\lib\SocketServer.py", line 617, in __init__
    self.handle()
    File "C:\Python26\lib\BaseHTTPServer.py", line 329, in handle
    self.handle_one_request()
    File "C:\Python26\lib\BaseHTTPServer.py", line 323, in handle_one_request
    method()
    File "C:\PyHME\start.py", line 232, in do_GET
    self._page(True)
    File "C:\PyHME\start.py", line 186, in _page
    appinst.mainloop()
    File "C:\PyHME\hme.py", line 1139, in mainloop
    while self.active and self.get_event():
    File "C:\PyHME\hme.py", line 1280, in get_event
    self.set_resolution(handle())
    File "C:\PyHME\vidmgr\__init__.py", line 95, in handle_resolution
    self.snd('bonk')
    AttributeError: Vidmgr instance has no attribute 'snd'
    ----------------------------------------
     
  8. May 1, 2011 #28 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    First of all - this is a typo. 'snd' should be 'sound' I will post that fix shortly, but you can change the line if you want to move on.

    The interesting thing, though, is that you should not even be executing this line. This only executes if your optimal resolution (i.e the contents of self.resolutions[0]) does not have a horizontal resolution of 640 (SD) or 1280 (HD).

    I wrote my code by reverse engineering my series 3 Tivos. I don't know what other resolutions are out there. If there is some way that you could give me the contents of this array, it would help me greatly. You could put the following print statement at the beginning of the handle_resolution routine:

    print self.resolutions

    you will also need some way to capture the output. If you run interactively from a command window, the output will appear in that window and you can cut and paste it here. Then maybe I could be a bit more defensive in my code - perhaps choose an alternate resolution from the array.
     
  9. May 1, 2011 #29 of 735
    innocentfreak

    innocentfreak Active Member

    8,950
    3
    Aug 25, 2001
    Florida
    Like I said, my config maybe off so it might just be due to a bad config. I have never tried to use PyHME prior to this.

    My knowledge is very limited so I will try to help as much as I can.

    I am assuming you are talking about below in _init_.py in the vidmgr folder?

    class Vidmgr(Application):
    def handle_resolution(self):
    """ Choose the 'optimal' resolution. """
    if (self.resolutions[0][0] == 640):
    self.res = RES_SD
    elif (self.resolutions[0][0] == 1280):
    self.res = RES_HD
    else:
    self.active = False
    self.snd('bonk')

    return self.resolutions[0]

    Where would I insert the print line, assuming I am in the correct section?

    EDIT:Got this, not sure if this is what you are looking for
    [(720, 480, 10, 11), (1280, 720, 3, 4), (704, 480, 10, 11), (640, 480, 1, 1)]
     
  10. May 1, 2011 #30 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    OK - there is a new version in the repository.

    I made the simple snd -> sound change identified by innocentfreak, but I also changed the handle_resolutions routine to scan through the self.resolutons array for the first resolutions that has a horizontal resolution of 640 or 1280. Prior to this, it was blindly taking the first entry in the array.

    I don't know what resolutions were in the array in innocentfreak's case, but at a minimum, this new logic will AT LEAST find the SD resolution and operate in that mode.

    The only file that changed from the prior version was vidmgr/__init__.py.

    Jeff
     
  11. May 1, 2011 #31 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    You would need to add the print statement immediately before if(self.resolutions[0][0] == 640):
    It would also need to be indented using tabs to the same depth as the if statement (this is my ONLY complaint with python - indentation defines program structure)
     
  12. May 1, 2011 #32 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    This line is what I'm looking for. So your optimal resolution is 720x480.

    With my new logic, it will choose the second entry and operate in 1280x720 resolution.

    I'm not sure what the 3 and 4 are - I think they define the pixel aspect ratio, and I'm also thinking that since it is not 1:1 (like it is in my case) that things might be slightly distorted???? If so, it probably wouldn't effect the text too much - the only thing that might be obvious would be the artwork.
     
  13. May 1, 2011 #33 of 735
    innocentfreak

    innocentfreak Active Member

    8,950
    3
    Aug 25, 2001
    Florida
    Cool that seems to have fixed it so that I can access the shares. Most of my image files come from theTVDB.com along with the metadata.

    I was scrolling through a show testing it and got this error.

    Exception happened during processing of request from ('192.168.1.2', 42946)
    Traceback (most recent call last):
    File "C:\Python26\lib\SocketServer.py", line 560, in process_request_thread
    self.finish_request(request, client_address)
    File "C:\Python26\lib\SocketServer.py", line 322, in finish_request
    self.RequestHandlerClass(request, client_address, self)
    File "C:\PyHME\start.py", line 141, in __init__
    client_address, server)
    File "C:\Python26\lib\SocketServer.py", line 617, in __init__
    self.handle()
    File "C:\Python26\lib\BaseHTTPServer.py", line 329, in handle
    self.handle_one_request()
    File "C:\Python26\lib\BaseHTTPServer.py", line 323, in handle_one_request
    method()
    File "C:\PyHME\start.py", line 232, in do_GET
    self._page(True)
    File "C:\PyHME\start.py", line 186, in _page
    appinst.mainloop()
    File "C:\PyHME\hme.py", line 1139, in mainloop
    while self.active and self.get_event():
    File "C:\PyHME\hme.py", line 1192, in get_event
    handle(keynum, rawcode)
    File "C:\PyHME\vidmgr\__init__.py", line 182, in handle_key_press
    self.handle_key_pressList(keynum, rawcode)
    File "C:\PyHME\vidmgr\__init__.py", line 286, in handle_key_pressList
    self.drawScreen()
    File "C:\PyHME\vidmgr\__init__.py", line 519, in drawScreen
    self.drawScreenDetail()
    File "C:\PyHME\vidmgr\__init__.py", line 661, in drawScreenDetail
    flags=RSRC_TEXT_WRAP + RSRC_HALIGN_LEFT + RSRC_VALIGN_TOP)
    File "C:\PyHME\hme.py", line 1033, in set_text
    self.set_resource(Text(self.app, message, font, color, colornum), flags)
    File "C:\PyHME\hme.py", line 713, in __init__
    self.put(_CMD_RSRC_ADD_TEXT, 'iis', font.id, color.id, text)
    File "C:\PyHME\hme.py", line 553, in put
    _pack('ii' + format, cmd, self.id, *params))
    File "C:\PyHME\hme.py", line 506, in _pack
    return ''.join([func(value) for i, value in zip(format, values)])
    File "C:\PyHME\hme.py", line 466, in _pack_string
    return _pack_vdata(value.encode('utf-8'))
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 196: ordina
    l not in range(128)
     
  14. May 1, 2011 #34 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    The issue is that you have a non-ascii character in your description - not sure which file it is, but one of the meta files has a non-ascii character in the description field.

    You can explore that angle of it while I see if there is some way I can be more defensive in my code.
     
  15. May 1, 2011 #35 of 735
    innocentfreak

    innocentfreak Active Member

    8,950
    3
    Aug 25, 2001
    Florida
    This appears to be the file.

    seriesTitle : 30 Rock
    title : Dealbreakers Talk Show #0001
    episodeTitle : Dealbreakers Talk Show #0001
    originalAirDate : 2009-12-03T20:30:00Z
    time : OAD
    description : The tables are turned when production begins on Liz's new talk show, "Dealbreakers," and she experiences what its like to walk a mile in Jenna's shoes. Jack, dealing with pressure from Devin, calculates to make "Dealbreakers" a success. Meanwhile, Tracy takes on the ultimate Hollywood challenge in order to prove his commitment to his wife. Everyone pitches in to help Tracy reach his goal including Kenneth, Dotcom and Grizz.
    isEpisode : true
    seriesId : SH79488
    episodeNumber : 407
    vProgramGenre : Comedy
    vSeriesGenre : Comedy
    vDirector : Don Scardino
    vWriter : Kay Cannon
    vActor : Alec Baldwin
    vActor : Tina Fey
    vActor : Tracy Morgan
    vActor : Scott Adsit
    vActor : Jack McBrayer
    vActor : Jane Krakowski
    vActor : Keith Powell
    vActor : Katrina Bowden
    vActor : Judah Friedlander
    vActor : Kevin Brown
    vActor : Maulik Pancholy
    vActor : Lonny Ross
    vActor : Grizz Chapman
     
  16. May 1, 2011 #36 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    innocentfreak,

    I'm attaching a new version of metadata.py (you will need to rename the file from metadata.txt to metadata.py). Replace the same named file in the pyhme directory (one dir above vidmgr) and see if it solves your problem. If so, I will commit the change and update the repository.

    Jeff
     

    Attached Files:

  17. May 1, 2011 #37 of 735
    innocentfreak

    innocentfreak Active Member

    8,950
    3
    Aug 25, 2001
    Florida
    Yeah that worked. Thanks, sorry I tend to break things in testing and find the odd results, ask Orangebuy :)
     
  18. May 1, 2011 #38 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    No problem - I asked that people test it - I'd rather have working software associated with my name.

    The repository will be updated in the next 10 minutes.
     
  19. May 1, 2011 #39 of 735
    innocentfreak

    innocentfreak Active Member

    8,950
    3
    Aug 25, 2001
    Florida
    Quick question is there any way to customize the font size? I find on my plasma the show descriptions are pretty tiny and wouldn't mind being able to make the show names larger also. Of course this may interfere with the images though.

    Also my format is laid out tvshows/series name/season#/episodes
    Is there a way to display show art when I am at the series name folder? I can't think of a way but thought I would throw it out there in case.
     
  20. May 1, 2011 #40 of 735
    wmcbrine

    wmcbrine Ziphead

    10,369
    22
    Aug 2, 2003

Share This Page