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. cweb

    cweb New Member

    106
    0
    May 29, 2004
    Can I use video manager with my OSX Pytivo installation?
     
  2. jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    I know nothing about the MAC environment, and I have no way to test there, but it's simple python code. If hme for python runs there I see no reason why this wouldn't as well. Give it a try and let us know. We could probably even resolve simple issues by working together on it.
     
  3. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    One tiny bug, here. If I have

    Code:
    metafirst = title seriesTitle episodeTitle movieYear vWriter vDirector description
    metaspace = vDirector description vActor
    Things lay out the way I want as long as the metafile has vDirector fields, but some of the metafiles don't have that field. Would it be possible to do a Boolean, something like:

    Code:
    metafirst = title seriesTitle episodeTitle movieYear vWriter vDirector description
    metaspace = movieYear+vWriter+vDirector description vActor
    That way a newline will be added after whichever the last of the 3 which exists in the metafile.

    A value of 15% seems to work fine, here, with a font size of 20. I may increase the font size a bit, though, to make it nicer for the folks in the back row.
     
  4. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    No, it's not allowed on a Mac. The state computing police will come haul you away. :)

    Give it a shot. If you have pyHME working, the rest is a breeze. If you have to set up pyHME, it's still not really very difficult.
     
  5. jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    I anticipated this issue. I was actually thinking of doing it this way:
    I would have two config file options metaspace would become metaspaceafter and work as it does now, and metaspacebefore would put a space before - but the logic would never put out 2 consecutive spaces
     
  6. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    Hmm. It works here under IceWeasel, but not FireFox.
     
  7. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    That would work.
     
  8. jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    lrhorer:

    I have attached a new __init__.py (I had to rename it to .txt). This is not released yet and has not been thoroughly tested. This has both the key based paging mechanism you described as well as the new metaspacebefore and metaspaceafter that was discussed. metaspaceafter is a synonym for metaspace in the config.ini file.

    Give it a try and let me know. I'll release it after you get back to me.
     

    Attached Files:

  9. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    OS - level caching would be my guess, or actually more likely the hard drives. I also tried decreasing the nice value of the Python process, and, qualitatively, it seemed to help some. I need to do some more rigorous testing to be sure.

    Yeah, and I can understand if you are reticent to spend a lot of resources on it.
     
  10. jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    The main issue as I see it is that these are short-lived processes - not like pytivo that is resident at all times. The work of accessing the disk has to be done - and there is no improving the response time the first time it runs, caching will be helpful if I could somehow retain this information from run to run. But then I couldn't take it at faith - I'd still need to verify that the cache was accurate.

    All I'm really doing is processing the directory (except for loading of thumbnails). I'm not sure how much I'd save by only needing to verify the cache contents.

    I'm going to give this some thought - I'm not ruling it out entirely. I just wanted you to know that you weren't going to get a response in an hour like has been the norm :)
     
  11. wmcbrine

    wmcbrine Ziphead

    10,366
    22
    Aug 2, 2003
    They're only threads, not processes. You can store common info at the class level, or the module level. This is how I do two-player games in Reversi. pyTivo actually works in a similar way, even though it's not HME.
     
  12. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    Seems to be working perfectly, both the number jump and the metaspacebefore directive.

    I almost never use the numeric buttons on my remote. Now I'll start using them!
     
  13. jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    I understand that they're threads. I guess what it boils down to is if I exit to live TV and come back into the app, is there any memory of the previous instantiation.

    I noticed that the "mainline" code - code outside of any classes or subroutines - executes at import time, but I would think there is very little I could do here - certainly nothing with any of the HME classes. I assume this is what you are referring to as module-level. I would guess that I could create some empty data structures at this level, and then fill them in as I traverse directories while within the app. They would then be available for subsequent invocations.
     
  14. jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    Thanks much - I'll package it up and get it up on git.
     
  15. jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    OK - Version 0.5c with the above described features is now available at git
     
  16. rrr22777

    rrr22777 New Member

    532
    0
    Jul 31, 2002
    Should I see something in the pytivo log after I add this?

    Code:
    [root@linux1 pytivo]# ls
    beacon.py     hdphotos.jnlp   mind.pyc     pyTivo.conf.dist        vidmgr
    beacon.pyc    httpserver.py   mutagen      pyTivoConfigurator.pyw  xmpp
    Cheetah       httpserver.pyc  nohup.out    pyTivo.py               Zeroconf.py
    config.ini    lrucache.py     plugin.py    pyTivoService.py        Zeroconf.pyc
    config.merge  lrucache.pyc    plugin.pyc   README
    config.py     metadata.py     plugins      stager.py
    config.pyc    metadata.pyc    PYCC.pf      stager.pyc
    content       mind.py         pyTivo.conf  templates
    [root@linux1 pytivo]# cat config.ini
    [vidmgr]
    exts=.mpg .mp4 .avi .wmv .m4v
    descsize=16
    
    [tivos]
    tivo1.name=Family Room
    tivo1.tsn=748-0001-902C-E861
    
    
    [pytivos]
    pytivo1.config=pyTivo.conf
    pytivo1.ip=192.168.0.100
    pytivo1.port=9032
    pytivo1.sep=/
    [root@linux1 pytivo]# python /u03/samba/HMO/pytivo/pyTivo.py
    INFO:pyTivo.beacon:Announcing shares...
    INFO:pyTivo.beacon:Registering: MyMovies
    INFO:pyTivo.beacon:Registering: MyMusic
    INFO:pyTivo.beacon:Registering: MyPhotos
    INFO:pyTivo.beacon:Scanning for TiVos...
    INFO:pyTivo:pyTivo is ready.
    INFO:pyTivo:192.168.0.250 [14/Jun/2011 16:10:17] "GET /TiVoConnect?Command=QueryContainer&Container=%2F&DoGenres=1 HTTP/1.0" 200 -
    
    
     
  17. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    No, this doesn't run under pyTivo. It runs under HME for Python. It looks to me like you put the code in the wrong directory and modified the wrong config file. Well, sort of.

    pyTivo:
    Code:
    RAID-Server:/usr/share/pyTivo# ls
    alphagroup  Cheetah     content    httpserver.py       __init__.py   metadata.py   mind.pyc   plugin.pyc  pyTivo            pyTivoConfigurator.pyw  README      xmpp
    beacon.py   config.py   dategroup  httpserver.pyc      lrucache.py   metadata.pyc  mutagen    plugins     pyTivo.conf       pyTivo.py               templates   Zeroconf.py
    beacon.pyc  config.pyc  eyeD3      httpserver.py.orig  lrucache.pyc  mind.py       plugin.py  pyshares    pyTivo.conf.dist  pyTivoService.py        Unverified  Zeroconf.pyc
    RAID-Server:/usr/share/pyTivo# cat pyTivo.conf
    [RAID Server]
    force_alpha = True
    type = video
    path = /RAID/Recordings
    
    [_tivo_SD]
    
    [_tivo_00000DEADBEEF]
    
    [Server]
    tivo_password = xxxxxxxxxxx
    tivo_mak = yyyyyyyyyy
    ffmpeg = /usr/bin/ffmpeg
    togo_path = /RAID/Server-Main/Movies/TiVo_TS
    debug = True
    tivo_username = zzzzzzzzz
    port = 9032
    
    [_tivo_HD]
    
    [Videos by Genre]
    force_alpha = True
    type = video
    path = /usr/share/pyTivo/pyshares
    
    [Group by Alpha]
    force_alpha = True
    type = video
    path = /usr/share/pyTivo/alphagroup
    
    [Unverified]
    type = video
    path = /usr/share/pyTivo/Unverified
    
    [DVD]
    path = /RAID/DVD
    force_alpha = True
    type = dvdvideo
    fast_index = true
    
    [Videos by Date]
    force_alpha = True
    type = video
    path = /usr/share/pyTivo/dategroup
    pyHME:
    Code:
    RAID-Server:/usr/share/pyhme# ls
    config.ini  hme.py  hme.pyc  pyHME  start.py  vidmgr  Zeroconf.py  Zeroconf.pyc
    RAID-Server:/usr/share/pyhme# cat config.ini 
    [hmeserver]
    apps=vidmgr
    
    [vidmgr]
    exts=.mpg .mp4 .avi .wmv .m4v
    descsize=20
    sort=file
    skin=local
    deleteallowed=false
    metafirst = title seriesTitle episodeTitle movieYear vDirector vWriter description
    metaspaceafter = vWriter description vActor
    metaspacebefore = description vActor
    infolabelpercent = 15
    metaignore = isEpisode isEpisodic showingBits displayMajorNumber
    
    [tivos]
    tivo1.name=LivingRoom
    tivo1.tsn=###-####-####-####
    tivo2.name=Theater
    tivo2.tsn=###-####-####-####
    tivo3.name=TiVoHD
    tivo3.tsn=###-####-####-####
    
    
    [pytivos]
    pytivo1.config=/usr/share/pyTivo/pyTivo.conf
    pytivo1.ip=192.168.1.50
    pytivo1.port=9032
    pytivo1.sep=/
    And looking at the servers:
    Code:
    RAID-Server:/usr/share/pyhme# ps -ef | grep py
    root     13245     1  0 Jun13 pts/1    00:01:21 /usr/bin/python2.6 /usr/share/pyhme/start.py
    root     14763     1  0 10:03 pts/1    00:00:42 /usr/bin/python2.6 /usr/share/pyTivo/pyTivo.py /dev/null
    Except when pushing a video, the output will be from pyHME, not pyTivo. It will look someting like this:

    Code:
    RAID-Server:/usr/share/pyhme# cat /var/log/pyhme.log 
    192.168.1.101:4119 - - [13/Jun/2011 23:21:23] "GET /vidmgr/icon.png HTTP/1.0" 200 -
    192.168.1.102:1762 - - [13/Jun/2011 23:24:34] "GET /vidmgr/icon.png HTTP/1.0" 200 -
    192.168.1.102:1801 - - [13/Jun/2011 23:24:47] "GET /vidmgr/ HTTP/1.1" 200 -
    192.168.1.102:1801 - - [13/Jun/2011 23:24:47] Starting HME: vidmgr
    192.168.1.102:1801 - - [13/Jun/2011 23:29:27] Ending HME: vidmgr
    192.168.1.102:1802 - - [13/Jun/2011 23:29:43] "GET /vidmgr/ HTTP/1.1" 200 -
    192.168.1.102:1802 - - [13/Jun/2011 23:29:43] Starting HME: vidmgr
    192.168.1.102:1802 - - [13/Jun/2011 23:41:28] Ending HME: vidmgr
    192.168.1.102:1807 - - [13/Jun/2011 23:41:31] "GET /vidmgr/icon.png HTTP/1.0" 200 -
    192.168.1.102:1846 - - [13/Jun/2011 23:41:35] "GET /vidmgr/ HTTP/1.1" 200 -
    192.168.1.102:1846 - - [13/Jun/2011 23:41:35] Starting HME: vidmgr
    192.168.1.102:1846 - - [13/Jun/2011 23:49:23] Ending HME: vidmgr
    192.168.1.102:1856 - - [14/Jun/2011 00:59:53] "GET /vidmgr/ HTTP/1.1" 200 -
    192.168.1.102:1856 - - [14/Jun/2011 00:59:53] Starting HME: vidmgr
    192.168.1.102:1856 - - [14/Jun/2011 01:00:37] Ending HME: vidmgr
    192.168.1.102:1860 - - [14/Jun/2011 01:00:38] "GET /vidmgr/icon.png HTTP/1.0" 200 -
    192.168.1.102:1899 - - [14/Jun/2011 01:00:44] "GET /vidmgr/ HTTP/1.1" 200 -
    192.168.1.102:1899 - - [14/Jun/2011 01:00:44] Starting HME: vidmgr
    192.168.1.102:1899 - - [14/Jun/2011 01:04:20] Ending HME: vidmgr
    192.168.1.102:1942 - - [14/Jun/2011 01:25:02] "GET /vidmgr/icon.png HTTP/1.0" 200 -
    192.168.1.102:1982 - - [14/Jun/2011 01:25:15] "GET /vidmgr/ HTTP/1.1" 200 -
    192.168.1.102:1982 - - [14/Jun/2011 01:25:15] Starting HME: vidmgr
    192.168.1.102:1982 - - [14/Jun/2011 01:29:26] Ending HME: vidmgr
    192.168.1.102:1983 - - [14/Jun/2011 01:30:07] "GET /vidmgr/ HTTP/1.1" 200 -
    192.168.1.102:1983 - - [14/Jun/2011 01:30:07] Starting HME: vidmgr
    192.168.1.102:1983 - - [14/Jun/2011 01:35:31] Ending HME: vidmgr
    192.168.1.101:4234 - - [14/Jun/2011 10:29:46] "GET /vidmgr/icon.png HTTP/1.0" 200 -
    192.168.1.101:4273 - - [14/Jun/2011 10:30:05] "GET /vidmgr/ HTTP/1.1" 200 -
    192.168.1.101:4273 - - [14/Jun/2011 10:30:05] Starting HME: vidmgr
    192.168.1.101:4273 - - [14/Jun/2011 10:30:21] Ending HME: vidmgr
    192.168.1.101:4278 - - [14/Jun/2011 10:30:22] "GET /vidmgr/icon.png HTTP/1.0" 200 -
    rather than the output from pyTivo:
    Code:
    RAID-Server:/usr/share/pyhme# more /var/log/pyTivo.log 
    INFO:pyTivo.beacon:Announcing shares...
    INFO:pyTivo.beacon:Registering: DVD
    INFO:pyTivo.beacon:Registering: Group by Alpha
    INFO:pyTivo.beacon:Registering: RAID Server
    INFO:pyTivo.beacon:Registering: Unverified
    INFO:pyTivo.beacon:Registering: Videos by Date
    INFO:pyTivo.beacon:Registering: Videos by Genre
    INFO:pyTivo.beacon:Scanning for TiVos...
    INFO:pyTivo.beacon:HD Theater
    INFO:pyTivo.beacon:HD Livingroom
    INFO:pyTivo:pyTivo is ready.
    INFO:pyTivo:192.168.1.102 [14/Jun/2011 10:03:37] "GET /TiVoConnect?Command=QueryContainer&Container=%2F HTTP/1.0" 200 -
    INFO:pyTivo:192.168.1.101 [14/Jun/2011 10:03:37] "GET /TiVoConnect?Command=QueryContainer&Container=%2F HTTP/1.0" 200 -
    INFO:pyTivo:192.168.1.103 [14/Jun/2011 10:04:37] "GET /TiVoConnect?Command=QueryContainer&Container=%2F HTTP/1.0" 200 -
    INFO:pyTivo:192.168.1.103 [14/Jun/2011 10:11:15] "GET /TiVoConnect?Command=QueryContainer&Container=%2F HTTP/1.0" 200 -
    INFO:pyTivo:192.168.1.103 [14/Jun/2011 10:11:16] "GET /TiVoConnect?Command=QueryContainer&Container=%2F HTTP/1.0" 200 -
    INFO:pyTivo:192.168.1.103 [14/Jun/2011 10:11:16] "GET /TiVoConnect?Command=QueryContainer&Container=%2F HTTP/1.0" 200 -
    INFO:pyTivo:192.168.1.103 [14/Jun/2011 10:11:24] "GET /TiVoConnect?Command=QueryFormats&SourceFormat=video%2Fx-tivo-mpeg HTTP/1.1" 200 -
    DEBUG:pyTivo.dvdvideo:mobileagent: -1 useragent: tvhttpclient
    INFO:pyTivo:192.168.1.103 [14/Jun/2011 10:11:24] "GET /TiVoConnect?Command=QueryContainer&Container=DVD&SortOrder=!CaptureDate&ItemCount=8&Filter=x-tivo-container%2Ftivo-videos,x-tivo-container%2Ffolder,video%2Fx-tivo-
    mpeg,video%2F* HTTP/1.1" 200 -
    INFO:pyTivo:192.168.1.103 [14/Jun/2011 10:11:28] "GET /TiVoConnect?Command=QueryFormats&SourceFormat=video%2Fx-tivo-mpeg HTTP/1.1" 200 -
    DEBUG:pyTivo.dvdvideo:mobileagent: -1 useragent: tvhttpclient
    INFO:pyTivo:192.168.1.103 [14/Jun/2011 10:11:28] "GET /TiVoConnect?Command=QueryContainer&Container=DVD%2F39%20Steps&SortOrder=!CaptureDate&ItemCount=8&Filter=x-tivo-container%2Ftivo-videos,x-tivo-container%2Ffolder,vi
    deo%2Fx-tivo-mpeg,video%2F* HTTP/1.1" 200 -
    INFO:pyTivo:192.168.1.103 [14/Jun/2011 10:11:33] "GET /TiVoConnect?Command=QueryFormats&SourceFormat=video%2Fx-tivo-mpeg HTTP/1.1" 200 -
    DEBUG:pyTivo.video.transcode:starting ffmpeg, will wait 10 seconds for it to complete
    DEBUG:pyTivo.video.transcode:ffmpeg output=FFmpeg version SVN-r25838, Copyright (c) 2000-2010 the FFmpeg developers
      built on Jan 21 2011 08:21:58 with gcc 4.4.5
      configuration: --enable-libdc1394 --prefix=/usr --extra-cflags='-Wall -g ' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --en
    able-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-avfilter --enable
    -libdirac --disable-decoder=libdirac --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-libvpx --enable-librtmp --extra-libs=-lgcrypt --disable-altivec --disable-
    armv5te --disable-armv6 --disable-vis
      libavutil     50.33. 0 / 50.33. 0
      libavcore      0.14. 0 /  0.14. 0
      libavcodec    52.97. 2 / 52.97. 2
      libavformat   52.87. 1 / 52.87. 1
      libavdevice   52. 2. 2 / 52. 2. 2
      libavfilter    1.65. 0 /  1.65. 0
      libswscale     0.12. 0 /  0.12. 0
      libpostproc   51. 2. 0 / 51. 2. 0
    pipe:: Invalid data found when processing input
     
  18. orangeboy

    orangeboy yes, I AM orangeboy!

    4,083
    0
    Apr 19, 2004
    East Moline, IL
    Hooray for DEAD BEEF! It's fun to spell in Hex. :D
     
  19. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    Damn! I keep forgetting the pyTivo.conf file has some modestly sensitive information in it.
     
  20. rrr22777

    rrr22777 New Member

    532
    0
    Jul 31, 2002
    Thank you for the example. Got things working well except this error when trying to browse.

    Code:
    [root@linux1 pyhme]# python start.py
    HME Server for Python 0.19
    Tue Jun 14 19:31:19 2011 Server Starts
    Registering: vidmgr
    192.168.0.250:37550 - - [14/Jun/2011 19:31:25] "GET /vidmgr/icon.png HTTP/1.0" 200 -
    192.168.0.250:37551 - - [14/Jun/2011 19:31:28] "GET /vidmgr/ HTTP/1.1" 200 -
    192.168.0.250:37551 - - [14/Jun/2011 19:31:28] Starting HME: vidmgr
    ----------------------------------------
    Exception happened during processing of request from ('192.168.0.250', 37551)
    Traceback (most recent call last):
      File "/usr/lib64/python2.6/SocketServer.py", line 560, in process_request_thread
        self.finish_request(request, client_address)
      File "/usr/lib64/python2.6/SocketServer.py", line 322, in finish_request
        self.RequestHandlerClass(request, client_address, self)
      File "start.py", line 141, in __init__
        client_address, server)
      File "/usr/lib64/python2.6/SocketServer.py", line 617, in __init__
        self.handle()
      File "/usr/lib64/python2.6/BaseHTTPServer.py", line 329, in handle
        self.handle_one_request()
      File "/usr/lib64/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
        method()
      File "start.py", line 232, in do_GET
        self._page(True)
      File "start.py", line 186, in _page
        appinst.mainloop()
      File "/u03/samba/HMO/pyhme/hme.py", line 1139, in mainloop
        while self.active and self.get_event():
      File "/u03/samba/HMO/pyhme/hme.py", line 1192, in get_event
        handle(keynum, rawcode)
      File "/u03/samba/HMO/pyhme/vidmgr/__init__.py", line 314, in handle_key_press
        self.handle_key_pressList(keynum, rawcode)
      File "/u03/samba/HMO/pyhme/vidmgr/__init__.py", line 463, in handle_key_pressList
        self.drawScreen()
      File "/u03/samba/HMO/pyhme/vidmgr/__init__.py", line 761, in drawScreen
        self.drawScreenDetail()
      File "/u03/samba/HMO/pyhme/vidmgr/__init__.py", line 896, in drawScreenDetail
        if self.listing[self.indexDetail]['thumb']:
    IndexError: list index out of range
    ----------------------------------------
    
    
     

Share This Page