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

VidMGR

Discussion in 'Developers Corner' started by Soapm, Jan 8, 2012.

  1. Jan 8, 2012 #1 of 97
    Soapm

    Soapm Active Member

    1,564
    0
    May 9, 2007
    So close,...
    I was looking into taking the plunge into Vidmgr then I remembers why I stayed away from it. This is like reading a foreign language...

    https://github.com/jbernardis/pytivo-video-manager/blob/master/README.txt

    What is pyhme? Is that the same a pytivo or is this a separate application?

    I plan to run this from a debian server even though I am very much a illiterate newbie. However, I have found a savior in step by steps like this http://pytivo.sourceforge.net/wiki/index.php/Ubuntu_Install. Anyone know of a step by step for VidMGR?
     
  2. Jan 8, 2012 #2 of 97
    wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
  3. Jan 9, 2012 #3 of 97
    lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    Go to William's git site here, and download the .zip file. Unzip the repository to a convenient directory (I use /usr/share/pyhme). Follow the link William posted above to get instructions for setting up HME for Python. Once you get it working, you can contact me for assistance with setting up a System V init script. (You should have one for pyTivo, as well.) With HME for Python working, getting vidmgr to work is simply a matter of creating a vidmgr directory under the HME for Python directory with all of Jeff's files in it, and possibly entering a line for vidmgr in the HME for Python configuration. Optionally, you can also place some global config values for vidmgr in the config.ini file. This is my setup:

    Code:
    RAID-Server:/usr/share/pyhme# ll --group-directories-first
    total 48300
    drwxr-xr-x   4 root root       4096 Dec 27 00:25 .
    drwxr-xr-x 383 root root      12288 Dec  3 22:36 ..
    drwx------   4 root root    4096 Dec 27 09:28 jukebox
    drwx------   3 root root    4096 Nov 23 19:07 vidmgr
    -rw-r--r--   1 root root    7969189 Sep  9 19:16 BaseHTTPServer
    -rwxr-xr-x   1 root root         97 Sep  4 09:35 BuildCache
    -rw-r--r--   1 root root        679 Dec 27 00:04 config.ini
    -rw-r--r--   1 root root         59 Jul 23 14:06 fd.out
    -rw-r--r--   1 root root    8274692 Sep  9 19:15 getopt
    -rwxr-xr-x   1 root root        294 Jul 21 01:06 gitupgrade
    -rwxr-xr-x   1 root root      46672 Dec 24  2010 hme.py
    -rw-r--r--   1 root root      46115 Sep 14 23:00 hme.pyc
    -rw-r--r--   1 root root    8274695 Sep  9 19:15 mimetypes
    -rw-------   1 root root        147 Jul 23 13:57 nohup.out
    -rw-r--r--   1 root root    8274688 Sep  9 19:15 os
    -rwxr-xr-x   1 root root        219 Sep 14 23:14 pyHME
    -rw-r--r--   1 root root      35411 Sep  9 19:15 socket
    -rwxr-xr-x   1 root root      13115 Sep  9 20:00 start.py
    -rw-r--r--   1 root root    8274689 Sep  9 19:15 sys
    -rw-r--r--   1 root root       6186 Sep  9 19:15 time
    -rw-r--r--   1 root root    7969181 Sep  9 19:15 urllib
    -rwxr-xr-x   1 root root      55709 Feb 28  2010 Zeroconf.py
    -rw-r--r--   1 root root      53526 Sep 14 23:11 Zeroconf.pyc
    
    
    RAID-Server:/usr/share/pyhme# cat config.ini 
    [hmeserver]
    apps=vidmgr jukebox
    
    [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
    inforightmargin = 100
    displaysep==
    
    [tivos]
    tivo1.name=LivingRoom
    tivo1.tsn=648-0011-xxxx-xxxx
    tivo2.name=Theater
    tivo2.tsn=648-0001-xxxx-xxxx
    tivo3.name=TiVoHD
    tivo3.tsn=652-0001-xxxx-xxxx
    
    
    [pytivos]
    pytivo1.config=/usr/share/pyTivo/pyTivo.conf
    pytivo1.ip=192.168.1.50
    pytivo1.port=9032
    pytivo1.sep=/
     
  4. Soapm

    Soapm Active Member

    1,564
    0
    May 9, 2007
    So close,...
    I downloaded the zip file and placed it in directory /usr/share/pyhme.

    I then went to the directory and typed ./start.py and got this;

    Code:
    root@lenny:/usr/share/pyhme# ./start.py
    HME Server for Python 0.19
    Fri Jan 13 13:09:41 2012 Server Starts
    Registering: animate
    Registering: clock
    Registering: effects
    Registering: fontinfo
    Registering: hello
    Registering: picture
    Registering: test
    Registering: tictactoe
    Registering: transition
    I'm not sure if this constitutes working or not since I still don't know what the application does.
     
  5. jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    Well it's not working because you should see vidmgr in there among the registering apps.

    The zip file should NOT be unpacked in the pyhme directory - you need to create a subdirectory named vidmgr and do the unpacking there. You should end up with the following directory structure:

    Code:
    pyhme 
         vidmgr
              skins
    All of the other apps you see registering there (animate, clock, effects, fontinfo, hello, picture, test, tictactoe, transition) are just demos that wmcbrine includes with pyhme to show its capabilities and give some hints as to how to program your own apps.

    When HME for python starts up, it looks for subdirectories and tries to run the apps it finds in them. By default it runs all of them, and if vidmgr is set up properly, it will just be one of them. If you do not want to run all of them, then you will need to create/edit the config.ini file in the pyhme directory to list ONLY the apps you want. My config.ini file looks like this:
    Code:
    [hmeserver]
    apps=vidmgr jukebox
    
     
  6. Soapm

    Soapm Active Member

    1,564
    0
    May 9, 2007
    So close,...
    Wow was that a nightmare because inside the compressed files were directories like jbernardis-pytivo-video-manager-9cfdb41. Try and manipulate that from a CLI... After I got all done I remembered I could hit the tab key to complete the file names... doh!!!

    Now I get this when I start it up. Closer???

    Code:
    root@lenny:/usr/share/pyhme# ./start.py
    HME Server for Python 0.19
    Fri Jan 13 19:33:27 2012 PyTivo Video Manager version 0.7c starting
    Cache file does not exist - no thumbnails loaded
    Fri Jan 13 19:33:27 2012 Server Starts
    Registering: animate
    Registering: clock
    Registering: effects
    Registering: fontinfo
    Registering: hello
    Registering: picture
    Registering: test
    Registering: tictactoe
    Registering: transition
    Registering: vidmgr
     
  7. jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    Yes - vidmgr is now running. You should see it al long with all of the demo app on your tivo under 'music, photos, and showcases,

    If you set it up correctly, you will see all of your pytivo videos
     
  8. wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    I just use a lot of asterisks when I'm on the CLI. :)
     
  9. Soapm

    Soapm Active Member

    1,564
    0
    May 9, 2007
    So close,...
    I guess I should figure that one out??? I wish I had of started learning Linux at a younger age because I am having to write everything down then I forget where I wrote it...

    Ok, I see all those listed under 'music, photos, and showcases, and I pressed thumbs up 3 times then enter. However selecting pyhme vidmgre and it just loops back to the same menu so I guess I have to set something up then I tested the clock which give me a nice clock on the screen that I can't figure out how to get rid of. How do I turn off the clock and how do I set up vidmgr?

    I assume it has to do with the below but I got lost on the first sentence. I see the file config.merge but I don't have a config.ini and not sure exactly how or what I'm merging.

    Sorry the light hasn't come on for me yet bu trust me after 6 or 7 hits with a big stick I usually get it or I duck...

    Code:
    4. Configure - you will need to merge the config.merge file that was delivered with this package with
    your config.ini file that you are currently using. There are four areas you need to pay attention to:
    
    a) You may or may not have an "apps" line under the heading [hmeserver]. If you do not, then
    the hmeserver will start all apps that it finds. If you do, then it will only start the named apps.
    So if you do have this line and you do want to run vidmgr, add the word "vidmgr" to this line - no quotes
    or commas or other punctuation.
    
    b) you can specify various vidmgr options by putting entries in the [vidmgr] section of the config.ini
    as follows:
    
    [vidmgr]
    exts=.mpg .mp4 .avi .wmv .m4v
    
       this names the file extensions you are interested in
          
    descsize=20
       this gives the font point size that will be used for the description text. 20 is the default
       
    skin=name
       this is the name of the directory under skins that contains all of the png files that are used
       to draw the screen. default is "orig", although the package is also shipped with a "blue" skin
       
    deleteallowed=true
       this determines whether or not deletion of videos is permitted. Default is true, set to false
       if you do not want this capability
       
    display=value
       determines what information is displayed about videos in the various lists. allowable values are
       episodetitle - displays only the episode title
       episodenumtitle - displays the episode number followed by the title
       file - simply displays the filename
       normal - (default) displays program title followed by episode title
       
    sort=value
       determines how listings are sorted:
       episodenumber - sort based on episode number - note this is a string sort - not a numeric sort
       file - sort based on the filename
       normal - (default) sorts based on the program title and episode title
    
    metafirst = title seriesTitle episodeTitle description
    metaignore = isEpisode isEpisodic
       these two items determine which metadata is displayed first in the info screen and which is ignored.
       Spelling and case are significant - the name must match exactly. The default values are those
       values given above
    metaspace = name name
    metaspaceafter = name name
    metaspacebefore = name name
       determines that there should be a blank line in the display before or after the indicated metadata items. The
       default is an empty list so there will be no blank lines. metaspace and metaspaceafter are synonyms
    metamergefiles = False or True (default = True)
    metamergelines = False or True (default = False)
       If there are multiple metafiles that correspond to a video file, these two options control how the data is to be merged.
       metamergefiles = False indicates that the files are not to be merged at all - only the more specific file is to be used.
       If metamergefiles if True, the default value, data from the less specific files is over-written/replaced with data from more
       specific files depending on the value for metamergelines. If metamergelines is False (the default) then a repeating metadata
       key will REPLACE any previous value read. If it is true, the new data will be concatenated to the old value separated
       by a space. Note that metamergelines has NO effect on metadata items that start with a 'v' (vActor, etc). These data
       items will continue to be processed as arrays.
       
       Metadata files are searched for/processed in the following order:
        1) .meta/default.txt
        2) default.txt
        3) .meta/<title>.txt
        4) <title>.txt
       Where <title> is the base name of the video file - or "folder" for directories. DVDVideo shares have a few other
       quirks concerning metadata - see below.
       
    infolabelpercent=30
       specifies the width, in percentage of the label field on the info screen. Default is 30, but I have found that
       20 works well for HD screens
       
    inforightmargin=20
       specifies the width, in pixels of pad area on the right side of the info screen. Default is 20. 0-100 allowed
    
    thumbjustify=left
       specifies how thumbnail images should be justified. default = left, can be center or right
    
    
    c) You need to tell vidmgr about your Tivos. For each tivo, you need to specify the name and
    the TSN. The format for this is:
    [tivos]
    tivo1.name=Family Room
    tivo1.tsn=TSN1
    tivo2.name=Master Bedroom
    tivo2.tsn=TSN2
    
    You can have an arbitrary number of Tivos, but as soon as vidmgr detects a gap in the numbering
    sequence it will stop parsing. Make sure the TSN's are accurate as this is how pytivo knows which
    tivo to push to.
    
    d) You need to tell vidmgr about your PyTivo instances. There are 4 possible pytivo parameters:
    - config is mandatory and is the fully qualified name of the pytivo config file.
    vidmgr reads this file to determine the share names and locations.
    - You may specify an ip address for the machine on which this instance of pytivo is running.
    If you do not specify one, the local IP address is used.
    - If the pytivo config file names a port in the server section, then vidmgr will
    use that port number. Otherwise you need to specify the port number here.
    -Finally, if your hme server is running in a different host environment than this
    instance of pytivo, then you need to specify the directory separator character for the pytivo environment.
    
    format for specifying pytivo information:
    [pytivos]
    pytivo1.config=/usr/local/pytivo/pyTivo.conf
    pytivo1.ip=192.168.1.201
    pytivo1.port=9032
    pytivo1.sep=/
    
    You can have an arbitrary number of pytivos, but as soon as vidmgr detects a gap in the numbering
    sequence it will stop parsing.
    
    A note about the separator: If you are running both vidmgr and pytivo on the same machine, then this
    is not required. However, if (as was happening while I was developing) you are running vidmgr
    in a Windows environment (where the directory separator is unfortunately a backslash '\') and
    you are running pytivo in a linux environment (where the separator is a forward slash '/') then
    you need to specify "pytivox.sep=/". Otherwise, vidmgr will happily send its requests to
    pytivo using a backslash in the paths and this will cause pytivo to choke.
    
    =======================================================================================================
    
    Usage
    =====
    
    Vidmgr presents a directory tree to you. You can step into and out of directories using the normal
    tivo navigation keys. The directory tree is rooted at the list of shares, unless there is only 1 share
    in which case it is rooted at the topmost directory of that share.
    
    while on a list of video files, you can also navigate using the number keys. 1 takes you 10% of the
    way through the list, 5 = 50%, 7 = 70%, etc. 0 alternately takes you to the end of the list and then to the
    beginning of the list
    
    In HD mode, vidmgr will also show video artwork on the right hand side of the screen. Vidmgr looks for
    the following file: <full-video-file-name-including-extension>.jpg or, if this doesn't exist, folder.jpg.
    The view into which this graphic is placed is 620 pixels wide by 450 pixels high. If your graphic exceeds
    those dimensions it will be scaled while maintaining the aspect ratio. Folder.jpg will also be the thumbnail
    used for the enclosing folder or share. Also, if there is a folder.txt file in a directory, or in the
    subtending .meta directory, its contents - notably the description field will be shown on the display
    above the thumbnail.
    
    For dvdvideo shares, vidmgr is totally dependent on accurate metadata. Metadata (and thumbnails) all belong
    in the directory containing the VIDEO_TS directory or in a subtending .meta directory. Metadata is processed
    as follows. default.txt contains the DVD metadata. __Txx.mpg.txt contains the metadata for title xx. The
    title-specific metadata is overlaid on top of the DVD metadata according to the metamergefiles and metamergefiles
    configuration parameters. The thumbnail for the DVD is in a file named folder.jpg. In addition, it is
    possible to have a thumbnail for a specific title; the name should be __Txx.mpg.jpg. If there is no metadata
    for a dvdvideo share, vidmgr assumes that there is only 1 title, and its title is the directory name.
    
    Once you choose a video file, you will be shown some of the metadata associated with that file,
    and then have two options - push or delete (delete can be disabled - see configuration above). In
    HD mode, this detail will be on the right side of the screen as you navigate through the directories - it
    is not on a separate screen
    
    If you choose delete, you will be asked to press thumbs-up to confirm and when you do, the file and
    its associated metadata file will be deleted. If you press ANYTHING other than thumbs-up, the
    delete is cancelled.
    
    If you choose push and you only have 1 tivo, then it will simply initiate a push to that tivo and
    give you a confirmation message. If you have multiple tivos, you need to choose the one you want to
    push to from the provided list. After choosing, vidmgr will initiate the push and give you the
    confirmation message. The confirmation message can be dismissed with ANY keypress
    
    At any time on any list or on a details screen, you can press the info button to see a complete
    list of the metadata. You can control which metadata items appear at the front of this display
    and which are ignored (see configuration above). On the info display, you can press left, clear, or info
    to return to the screen you came from. If the information does not fit on one page, you will see
    paging cues and you can use either up/down or channel up/down to traverse the pages.
    PS... the clock eventually went away by itself and I guess I need to know how to start this as a dameon because every time I do ctrl +c to get the CLI back it closes shuts this application down.

    Also, my videos are in /video/video if someone can help me point this at them.
     
  10. Soapm

    Soapm Active Member

    1,564
    0
    May 9, 2007
    So close,...
    Ok, I got it working with this file. I can see I have some tweaking to do but it least I see what I've been trying to achieve all this time.

    Code:
    [vidmgr]
    exts=.mpg .mp4 .avi .wmv .m4v .mkv .vob .tivo
    descsize=20
    skin=orig
    deleteallowed=true
    display=normal
    sort=episodenumber
    metafirst = title
    infolabelpercent=30
    inforightmargin=20
    thumbjustify=left
    
    [tivos]
    tivo1.name=FamRoom
    tivo1.tsn=xxxxxxxxxxxxx
    tivo2.name=other
    tivo2.tsn=xxxxxxxxxxxxxxx
    
    [pytivos]
    pytivo1.config=/pyTivo/pyTivo.conf
    pytivo1.ip=192.168.0.199
    pytivo1.port=9032
    Now I guess I have to make a file like this one /etc/init.d/pyTivo except for this application which should get this to start up. I'll have to rest the brain a bit then I can figure this out. Thanks for all the help everyone...
     
  11. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    If you don't have an existing config.ini in the main HME for Python directory, then (after placing config.merge in the directory) you should just be able to type

    Code:
    mv config.merge config.ini
    If you do already have a config.ini in the HME for Python directory, then type

    Code:
    cat config.merge >> config.ini
    Then go in and edit whatever sections you need. My config.ini file is this:

    Code:
    [hmeserver]
    apps=vidmgr jukebox
    
    [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
    inforightmargin = 100
    displaysep==
    
    [tivos]
    tivo1.name=LivingRoom
    tivo1.tsn=648-0011-xxxx-xxxx
    tivo2.name=Theater
    tivo2.tsn=648-0001-xxxx-xxxx
    tivo3.name=TiVoHD
    tivo3.tsn=652-0001-xxxx-xxxx
    
    
    [pytivos]
    pytivo1.config=/usr/share/pyTivo/pyTivo.conf
    pytivo1.ip=192.168.1.50
    pytivo1.port=9032
    pytivo1.sep=/
    If you have an "apps=" line, then it will have to contain all the apps you want HME for Python to use. If you do not have such a line, then HME for Python will find every app and use them all.

    Most of the [Vidmgr] options can be left at default, but you may want to tweak some of them. For example, I have custom skins in my vidmgr/local directory, so the line

    Code:
    skin=local
    tells vidmgr to look in the vidmgr/local directory for skins to use. Any necessary skins not found there will be taken from the default directory.

    The options like metafirst, metaspaceafter, metaspacebefore, metaignore, inforightmargin, displaysep, etc. all set up the vidmgr display the way I like.

    You will definitely need to set the TiVo names and TSNs and the pyTivo configs to match your system. Just change the values you see above at the bottom of the config.ini file to match your system.

    You don't point vidmgr at your files. You point it toward the pyTiVo server, and vidmgr gets all its info from there.

    After that, it's just a matter of getting album art for your videos and spiffing up the metafiles.

    Hint: To make gathering the album art easier, here is what I do (modified to fit your system):

    First, I run the following command

    Code:
    find /video/video -iname "*.mp[4g]" -exec touch "{}.jpg" /;
    This creates an empty .jpg file for every .mpg or .mp4 video in /video/video if one does not already exist. (Note, it also changes the access time for any such file that does exist, if it matters.) Then I go to http://albumart.org to search for any videos that have zero byte .jpg files. When I find one I like, I click on the little magnifying glass, then right click on the enlarged image and select <Save Image As>. When the save dialogue pops up I click on the filename in the window so it automatically saves it with the correct name.

    An easy way to get a list of all the zero length files is

    Code:
    find /video/video -iname "*.mp[4g].jpg" -empty
    You may want to redirect the list to a file like so:

    Code:
    find /video/video -iname "*.mp[4g].jpg" -empty > <filename>
    Or to implement as an easy-to-call script:

    Code:
    #! /bin/bash
    find /video/video -iname "*.mp[4g]" -exec touch "{}.jpg" /;
    find /video/video -iname "*.mp[4g].jpg" -empty
     
  12. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    I suggest you call me on creating the system V init scripts in /etc/init.d. They are not too difficult, but they can be a bit tricky to get right. I also suggest registering pyTiVo as a service so everything works smoothly. This also is not very difficult, but does require a bit of knowledge concerning init daemons.

    Here are my init scripts for pyTivo and HME for Python:

    /etc/init.d/pyTivo:

    Code:
    #! /bin/sh
    ### BEGIN INIT INFO
    # Provides:          pyTivo
    # Required-Start:    $remote_fs $syslog $network
    # Required-Stop:     $remote_fs $syslog $network
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: pyTivo Multimedia Server
    # Description:       Provides the pyTivo video server for TiVo
    #                    
    ### END INIT INFO
    
    # Author: Leslie Rhorer
    #
    # Please remove the "Author" lines above and replace them
    # with your own name if you copy and modify this script.
    
    # Do NOT "set -e"
    
    # PATH should only include /usr/* if it runs after the mountnfs.sh script
    PATH=/sbin:/usr/sbin:/bin:/usr/bin
    DESC="pyTivo Multimedia Server"
    NAME=pyTivo
    DAEMON=/usr/share/pyTivo/$NAME
    DAEMON_ARGS=""
    PIDFILE=/var/run/$NAME.pid
    SCRIPTNAME=/etc/init.d/$NAME
    
    # Exit if the package is not installed
    [ -x "$DAEMON" ] || exit 0
    
    # Read configuration variable file if it is present
    [ -r /etc/default/$NAME ] && . /etc/default/$NAME
    
    # Load the VERBOSE setting and other rcS variables
    . /lib/init/vars.sh
    
    # Define LSB log_* functions.
    # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
    # and status_of_proc is working.
    . /lib/lsb/init-functions
    
    #
    # Function that starts the daemon/service
    #
    do_start()
    {
            # Return
            #   0 if daemon has been started
            #   1 if daemon was already running
            #   2 if daemon could not be started
            if [ -e "$PIDFILE" ];
            then
                    PIDVAL=$( cat $PIDFILE )
                    ps -ef | grep $PIDVAL | grep -qv grep && return 1
                    rm $PIDFILE
            fi
            start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON || return 2
    }
    
    #
    # Function that stops the daemon/service
    #
    do_stop()
    {
            # Return
            #   0 if daemon has been stopped
            #   1 if daemon was already stopped
            #   2 if daemon could not be stopped
            #   other if a failure occurred
            if [ -e $PIDFILE ];
            then
                    PIDVAL=$( cat $PIDFILE )
                    rm -f $PIDFILE
                    kill -15 $PIDVAL 2> /dev/null
                    return "$?"
            else
                    return 1
            fi
    }
    
    #
    # Function that sends a SIGHUP to the daemon/service
    #
    do_reload() {
            #
            # If the daemon can reload its configuration without
            # restarting (for example, when it is sent a SIGHUP),
            # then implement that here.
            #
            start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
            return 0
    }
    
    case "$1" in
      start)
            [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
            do_start
            case "$?" in
                    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
            esac
            ;;
      stop)
            [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
            do_stop
            case "$?" in
                    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
            esac
            ;;
      reload)
           do_reload
           ;;
      restart)
            log_daemon_msg "Restarting $DESC" "$NAME"
            do_stop
            case "$?" in
              0|1)
                    do_start
                    case "$?" in
                            0) log_end_msg 0 ;;
                            1) log_end_msg 1 ;; # Old process is still running
                            *) log_end_msg 1 ;; # Failed to start
                    esac
                    ;;
              *)
                    # Failed to stop
                    log_end_msg 1
                    ;;
            esac
            ;;
      *)
            #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
            echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
            exit 3
            ;;
    esac
    
    :
    
    /etc/init.d/pyHME:

    Code:
    #! /bin/sh
    ### BEGIN INIT INFO
    # Provides:          pyHME
    # Required-Start:    $remote_fs $syslog $network $pyTivo
    # Required-Stop:     $remote_fs $syslog $network $pyTivo
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: HME Services
    # Description:       Provides HME services for TiVo
    #
    ### END INIT INFO
    
    # Author: Leslie Rhorer
    
    # Do NOT "set -e"
    
    # PATH should only include /usr/* if it runs after the mountnfs.sh script
    PATH=/sbin:/usr/sbin:/bin:/usr/bin
    DESC="HME Services"
    NAME=pyHME
    DAEMON=/usr/share/pyhme/$NAME
    DAEMON_ARGS=""
    PIDFILE=/var/run/$NAME.pid
    SCRIPTNAME=/etc/init.d/$NAME
    
    # Exit if the package is not installed
    [ -x "$DAEMON" ] || exit 0
    
    # Read configuration variable file if it is present
    [ -r /etc/default/$NAME ] && . /etc/default/$NAME
    
    # Load the VERBOSE setting and other rcS variables
    . /lib/init/vars.sh
    
    # Define LSB log_* functions.
    # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
    # and status_of_proc is working.
    . /lib/lsb/init-functions
    
    #
    # Function that starts the daemon/service
    #
    do_start()
    {
            # Return
            #   0 if daemon has been started
            #   1 if daemon was already running
            #   2 if daemon could not be started
            if [ -e "$PIDFILE" ];
            then
                    PIDVAL=$( cat $PIDFILE )
                    ps -ef | grep $PIDVAL | grep -qv grep && return 1
                    rm $PIDFILE
            fi
            start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON || return 2
    }
    
    #
    # Function that stops the daemon/service
    #
    do_stop()
    {
            # Return
            #   0 if daemon has been stopped
            #   1 if daemon was already stopped
            #   2 if daemon could not be stopped
            #   other if a failure occurred
            if [ -e $PIDFILE ];
            then
                    PIDVAL=$( cat $PIDFILE )
                    rm -f $PIDFILE
                    kill -15 $PIDVAL 2> /dev/null
                    return "$?"
            else
                    return 1
            fi
    }
    
    case "$1" in
      start)
            [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
            do_start
            case "$?" in
                    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
            esac
            ;;
      stop)
            [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
            do_stop
            case "$?" in
                    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
            esac
            ;;
      restart)
            #
            # If the "reload" option is implemented then remove the
            # 'force-reload' alias
            #
            log_daemon_msg "Restarting $DESC" "$NAME"
            do_stop
            case "$?" in
              0|1)
                    do_start
                    case "$?" in
                            0) log_end_msg 0 ;;
                            1) log_end_msg 1 ;; # Old process is still running
                            *) log_end_msg 1 ;; # Failed to start
                    esac
                    ;;
              *)
                    # Failed to stop
                    log_end_msg 1
                    ;;
            esac
            ;;
      *)
            #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
            echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload}" >&2
            exit 3
            ;;
    esac
    
    :
    
    Each of these in turn runs a script which spawns the binary in the background, sets up logging to files in /var/log, etc.

    /usr/share/pyTivo/pyTivo:

    Code:
    #! /bin/bash
    PIDFILE=/var/run/pyTivo.pid
    RUNDIR=/usr/share/pyTivo
    LOGFILE=/var/log/pyTivo.log
    /usr/bin/nohup /usr/bin/python2.6 $RUNDIR/pyTivo.py > $LOGFILE 2>&1 &
    echo $! > $PIDFILE
    exit 0
    /usr/share/pyhme/pyHME:

    Code:
    #! /bin/bash
    PIDFILE=/var/run/pyHME.pid
    RUNDIR=/usr/share/pyhme
    LOGFILE=/var/log/pyhme.log
    ERRFILE=/var/log/pyhme.err
    cd $RUNDIR
    /usr/bin/nohup /usr/bin/python2.6 $RUNDIR/start.py > $LOGFILE &
    echo $! > $PIDFILE
    exit 0
    To register pyTivo as a service, edit the /etc/insserv.conf file and add the following line:

    Code:
    $pyTivo         pyTivo
    That way any init script which requires pyTivo's resources will not be started until pyTivo is up and running, and will be shut down prior to pyTivo being terminated during shutdown
     
  13. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    When all is said and done, you will have screens that look like the following (with variations for personal options):

    [​IMG]

    [​IMG]
     
  14. larrs

    larrs Movie Fan-Addict

    1,011
    0
    May 2, 2005
    DFW
    OK, as suggested by lrhorher, I am going to try this. Everyone is willing to help me over the hump- correct?

    I will not get to it until this weekend, but I am definitely going to need h-e-l-p.

    I am not a developer and I haven't stayed in a Holiday Inn Express in a while. :)

    I'll follow this thread's advice and see if I can get it started.
     
  15. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    Surely. Well, perhaps not everyone, but the majority of the savvy members of this forum are always prepared to help those who ask nicely and are willing to take a little bit of initiative.

    This definitely does not apply to you, but we do get a fair number of self-entitled dweebs who come in demanding all sorts of things, sometimes calling names and in general making a pest of themselves. Those mental arthritics can kiss our...

    OK, here is what you should do:

    1. Close your eyes and take a deep breath. Exhale slowly.
    2. Take things one step at a time. Get everything working at each step before moving to the next step.
    3. Collect all the tarballs / zipfiles in one temporary place.
    4. Don't get anxious and don't get wrapped up in wanting to be done or in the final outcome. If you find yourself getting uptight, repeat step #1, and keep step #2 firmly in mind. You'll be finished soon enough.
    5. Choose a location for HME for Python, and create a directory specifically for the application. I use /usr/share/pyhme, but you can put it anywhere convenient.
    6. Untar / unzip the HME for Python file into the directory you have created for the purpose. The contents should look something like:
      Code:
      drwxr-xr-x 11 root root  4096 Feb 24 03:33 .
      drwxr-xr-x  5 root root  4096 Feb 24 03:32 ..
      drwx------  2 root root    39 May  4  2009 animate
      drwx------  2 root root    39 May  4  2009 clock
      drwx------  2 root root    39 May  4  2009 effects
      drwx------  2 root root    39 May  4  2009 fontinfo
      drwx------  2 root root    39 May  4  2009 hello
      drwx------  2 root root    39 Nov 14  2009 picture
      drwx------  2 root root    55 Dec 24  2010 test
      drwx------  2 root root    67 May  4  2009 tictactoe
      drwx------  2 root root    39 Apr  5  2010 transition
      -rw-------  1 root root    39 May  1  2009 config.ini
      -rw-------  1 root root 46672 Dec 24  2010 hme.py
      -rw-------  1 root root 17890 Dec 24  2010 README.txt
      -rwx------  1 root root 12933 Dec 24  2010 start.py
      -rw-------  1 root root 55709 Feb 28  2010 Zeroconf.py
    7. At this point, you should be able to run HME for Python by running start.py from the command line. If not, you'll need to figure out why. The clock should show up as an app under the Showcase menu on the TiVo.
    8. If you like, create a custom config.ini file. It is not required, but it can make things a bit more streamlined. Mine looks like this:

      Code:
      [hmeserver]
      apps=vidmgr jukebox
      
      [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
      inforightmargin = 100
      displaysep==
      
      [tivos]
      tivo1.name=LivingRoom
      tivo1.tsn=648-****-****-****
      tivo2.name=Theater
      tivo2.tsn=648-****-****-****
      tivo3.name=TiVoHD
      tivo3.tsn=652-****-****-****
      
      
      [pytivos]
      pytivo1.config=/usr/share/pyTivo/pyTivo.conf
      pytivo1.ip=192.168.1.50
      pytivo1.port=9032
      pytivo1.sep=/
    9. Stop HME for Python.
    10. Go to the directory you created for HMEfP, if you are not already there.
    11. Unzip / untar the vidmgr file into this directory. This should create a directory named vidmgr. Change to this directory.
    12. Rename the vidmgr.ini.dist file to vidmgr.ini.
    13. Edit the vidmgr.ini file. There are a great many configuration options there. Follow the instructions / tips in the file itself to make your changes.
    14. Run start.py from the HMEfP directory again. Take note of any errors. Vidmgr should show up in the Showcase menu on your TiVo(s).
    15. Tweak the vidmgr.ini file to taste.
    16. When everything is working, you can disable any of the HME apps you don't need either by deleting their directories under the HMEfP directory, or by specifying the apps you do want to load in the config.ini file using the "apps=" directive. If that directive appears in the config.ini file, then only the apps specified by the directive are loaded by HMEfP. If not, then it loads every app it finds in subdirectories of the HMEfP directory.


    It's really not that difficult, but post back to us if you have issues.

    Under what platform will you be running HMEfP / vidmgr?
     
  16. larrs

    larrs Movie Fan-Addict

    1,011
    0
    May 2, 2005
    DFW
    thanks..I am sure I can get it up and running with a bit of input. I'll plan to do this weekend as I am out of town on business until this evening. I am in no hurry, I can take time to ask questions as necessary.

    My HTPC which feeds my Tivos is running Vista.
     
  17. larrs

    larrs Movie Fan-Addict

    1,011
    0
    May 2, 2005
    DFW
    OK, I have pyhme running. I can access the animate app, clock,etc. And, vidmgr also shows up. However, when I access it from the tivo I get "please wait" and then it exits, so it does run. However, I have no vidmgr.ini file. I have a config.ini file in the main pyhme directory which appears empty except for the pictures path put in originally by wmcbrine. In the vidmgr directory there is no .ini file at all. I do have the config.merge file in the vidmgr directory.

    What should my next step be?

    EDIT; I got it up and running by actually reading the readme in the vidmgr files and rereading this thread... **DOH!**

    Now there are plenty of settings to add to my config file, but at least it is working. I am sure I will be back with questions but a big THANKS to lrhorer for getting me up and running and to the guys that created hme, pytivo and vidmgr.
     
  18. lrhorer

    lrhorer Active Member

    6,924
    0
    Aug 31, 2003
    San...
    Step 12 :)

    I really should have made that Step 2 in the list above.

    Indeed there are, although many are a matter of personal taste and look & feel, rather than basic functionality. 'Lots of features here. If you are at all handy with creating graphics, you might look into personalized skins. I created the flat gray skin above. I prefer it to a patterned skin, and the gray provides a very readable background on my TVs.

    Indubitably. Ask away. I do recommend reading the README and the text in the vidmgr.ini file first, though.

    You're welcome.
     
  19. larrs

    larrs Movie Fan-Addict

    1,011
    0
    May 2, 2005
    DFW
    This may be an odd question and probably just the fact that I got a couple of things out of order when I installed vidmgr- but just for information, I have no vidmgr.ini file in my vidmgr directory, nor did I see the vidmgr.ini.dist file. However, I did have the config.merge file which I used with the config.ini file in pyhme.

    Did I do something out of order to kill these files?

    I thought this might help the next guy...
     
  20. jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    Not to throw a wrench into the works, but....

    Are you using vidmgr 1.0 or 2.0? Config.merge was part of 1.0. I see you have all HD tivos - if your TV's are also HD, then you really should be running 2.0. It has MANY more features, and I am more likely to add new features there.

    Links to both versions (as well as to Jukebox - my MP3 player) are in my signature below.
     

Share This Page