# VidMGR



## Soapm

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



> 1. Go to the directory where you have pyhme installed. There should be a lot of subdirectories here,
> one per application. Create a new directory here named "vidmgr"


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?


----------



## wmcbrine

When jbernardis refers to "pyhme", he means HME for Python.


----------



## lrhorer

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=/


----------



## Soapm

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:


[email protected]:/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.


----------



## jbernardis

Soapm said:


> I'm not sure if this constitutes working or not since I still don't know what the application does.


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


----------



## Soapm

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:


[email protected]:/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


----------



## jbernardis

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


----------



## wmcbrine

Soapm said:


> 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!!!


I just use a lot of asterisks when I'm on the CLI.


----------



## Soapm

wmcbrine said:


> I just use a lot of asterisks when I'm on the CLI.


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.


----------



## Soapm

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


----------



## lrhorer

Soapm said:


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


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.



Soapm said:


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


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


----------



## lrhorer

Soapm said:


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


----------



## lrhorer

When all is said and done, you will have screens that look like the following (with variations for personal options):


----------



## larrs

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.


----------



## lrhorer

larrs said:


> OK, as suggested by lrhorher, I am going to try this. Everyone is willing to help me over the hump- correct?


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



larrs said:


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


OK, here is what you should do:


Close your eyes and take a deep breath. Exhale slowly.
Take things one step at a time. Get everything working at each step before moving to the next step.
Collect all the tarballs / zipfiles in one temporary place.
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.
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.
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


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.
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=/


Stop HME for Python.
Go to the directory you created for HMEfP, if you are not already there.
Unzip / untar the vidmgr file into this directory. This should create a directory named vidmgr. Change to this directory.
Rename the vidmgr.ini.dist file to vidmgr.ini.
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.
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).
Tweak the vidmgr.ini file to taste.
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.



larrs said:


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


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

Under what platform will you be running HMEfP / vidmgr?


----------



## larrs

lrhorer said:


> 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.
> 
> <snipped content>
> 
> It's really not that difficult, but post back to us if you have issues.
> 
> Under what platform will you be running HMEfP / vidmgr?


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.


----------



## larrs

lrhorer said:


> Surely. [*]Stop HME for Python.
> [*]Go to the directory you created for HMEfP, if you are not already there.
> [*]Unzip / untar the vidmgr file into this directory. This should create a directory named vidmgr. Change to this directory.
> [*]Rename the vidmgr.ini.dist file to vidmgr.ini.
> [*]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.
> [*]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).
> [*]Tweak the vidmgr.ini file to taste.
> [*]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.
> [/LIST]
> 
> It's really not that difficult, but post back to us if you have issues.
> 
> Under what platform will you be running HMEfP / vidmgr?


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.


----------



## lrhorer

larrs said:


> 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?


Step 12 



larrs said:


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


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



larrs said:


> Now there are plenty of settings to add to my config file


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.



larrs said:


> but at least it is working. I am sure I will be back with questions


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



larrs said:


> but a big THANKS to lrhorer for getting me up and running


You're welcome.


----------



## larrs

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


----------



## jbernardis

larrs said:


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


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.


----------



## larrs

jbernardis said:


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


Crap, I just noticed that. Maybe I will change them this weekend. Is there a quick rundown of the other features?


----------



## windracer

Here's the original 2.0 announcement:

http://www.tivocommunity.com/tivo-vb/showthread.php?p=8710497#post8710497


----------



## johnh123

OK, i'm trying to install this on a synology nas. I got pyhme up and running, but get this after I installed vidmgr:


DiskStation> python /usr/local/pyhme/start.py
HME Server for Python 0.19
Skipping: .git - Empty module name
Skipping: vidmgr - No module named Image
Skipping: picture - No module named Image
Wed Apr 18 15:03:37 2012 Server Starts
Registering: animate
Registering: clock
Registering: effects
Registering: fontinfo
Registering: hello
Registering: test
Registering: tictactoe
Registering: transition

any thoughts as to what I am doing wrong?


----------



## windracer

I believe you need to install the Python Imaging Library (PIL).


----------



## johnh123

Great, thanks, that seems to work.


----------



## johnh123

OK, now I get this:

192.168.1.125:41301 - - [18/Apr/2012 22:23:16] Starting HME: vidmgr
Vidmgr thread entering startup
----------------------------------------
Exception happened during processing of request from ('192.168.1.125', 41301)
Traceback (most recent call last):
File "/opt/lib/python2.5/SocketServer.py", line 464, in process_request_thread
self.finish_request(request, client_address)
File "/opt/lib/python2.5/SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "start.py", line 141, in __init__
client_address, server)
File "/opt/lib/python2.5/SocketServer.py", line 522, in __init__
self.handle()
File "/opt/lib/python2.5/BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "/opt/lib/python2.5/BaseHTTPServer.py", line 310, 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 "/usr/local/pyhme/hme.py", line 1134, in mainloop
self.startup()
File "/usr/local/pyhme/vidmgr/__init__.py", line 108, in startup
raise ConfigError("No Tivos found - exiting")
ConfigError: No Tivos found - exiting

the pyhme config.ini is like so:

[hmeserver]
apps=vidmgr

[vidmgr]
exts=.mpg .mp4 .avi .wmv .m4v .mkv
descsize=16

[tivos]
tivo1.name=Basement
tivo1.tsn=xxx-xxxx-xxxx-xxxx

[pytivos]
pytivo1.config=/usr/local/pyTivo/pyTivo.conf
pytivo1.ip=192.168.1.113
pytivo1.port=9032

what next?


----------



## windracer

johnh123 said:


> the pyhme config.ini is like so:
> 
> [hmeserver]
> apps=vidmgr
> 
> [vidmgr]
> exts=.mpg .mp4 .avi .wmv .m4v .mkv
> descsize=16
> 
> [tivos]
> tivo1.name=Basement
> tivo1.tsn=xxx-xxxx-xxxx-xxxx
> 
> [pytivos]
> pytivo1.config=/usr/local/pyTivo/pyTivo.conf
> pytivo1.ip=192.168.1.113
> pytivo1.port=9032


It looks like you've got the ini files all combined somehow. The config.ini file for HME for Python should only contain the [hmeserver] section. The [vidmgr] and [pytivos] sections should be in the vidmgr.ini in the vidmgr folder and the [tivos] section should be in your pyTivo.conf.


----------



## wmcbrine

Well I don't know what VidMGR wants, but that wouldn't be the right format to list TiVos in pyTivo.conf.


----------



## johnh123

OK, configs fixed, and here we are:

Exception happened during processing of request from ('192.168.1.125', 37346)
Traceback (most recent call last):
File "/opt/lib/python2.5/SocketServer.py", line 464, in process_request_thread
self.finish_request(request, client_address)
File "/opt/lib/python2.5/SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "./start.py", line 141, in __init__
client_address, server)
File "/opt/lib/python2.5/SocketServer.py", line 522, in __init__
self.handle()
File "/opt/lib/python2.5/BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "/opt/lib/python2.5/BaseHTTPServer.py", line 310, 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 "/usr/local/pyhme/hme.py", line 1134, in mainloop
self.startup()
File "/usr/local/pyhme/vidmgr/__init__.py", line 108, in startup
raise ConfigError("No Tivos found - exiting")
ConfigError: No Tivos found - exiting


----------



## windracer

johnh123 said:


> File "/usr/local/pyhme/vidmgr/__init__.py", line 108, in startup
> raise ConfigError("No Tivos found - exiting")
> ConfigError: No Tivos found - exiting


Ok, I misspoke in my prior post. There _should_ be a [tivos] section in your vidmgr.ini file (not pyTivo.conf). Sorry about that.


----------



## larrs

I love vidmgr and thanks for developing it!

I believe I have found an issue, or I am doing something wrong and need help rectifying it.

When I access the vidmgr app on my Tivos (and I think the issue may be that I have 5 of them listed in my config file) and select the video to push, there are 4 of them listed in the display that pops up "push to xx Tivo"- to get to the 5th Tivo, I have to scroll down and that one displays. However, if I choose that 5th one to push the video to it actually selects the 4th Tivo rather than the 5th and says "queued to push to tivo 4" and pushes the video to the 4th rather than the 5th Tivo.

If I then go back up and select the 4th tivo, it pushes to the 3rd, etc.

I went into my config and reordered them so the 5th tivo is one we never push videos to but I wanted to let everyone know. Seems once you scroll past the 4th tivo, it gets off by one.

If this was not the place to post this, please let me know.


----------



## jasondeangelo

Hi everyone...First off, I need to thank all of you for the hard work and dedication you put into this poject. Seriously, you guys go above and beyond to make Tivo so much better! I truly can't thank you enough.

That being said (lol)...I am having a bit of trouble with VidMGR. I can see my videos without issue, but when I click on one to initiate the transfer, it tells me that it has been sent to my DVR (basement) but never shows up in my Now Playing. I've followed all the guides and played around with the settings in the vidmgr.ini file, but no luck. I can post the file if you want.
I've opened up the ports on the PC firewall. Checked the port number matches in the pyTivo config.ini and vidmgr.ini. I'm clearly missing something. Any help would really be appreciated. 

Thanks so much!

Tivo: Series 3 HD
PC: Windows 7 32bit


----------



## windracer

Are you able to initiate a push from the pyTivo web interface? Do you have the correct values in tivo_password and tivo_username in your pyTivo.conf file?


----------



## jasondeangelo

I appreciate you getting back to me so quickly!

I did solve this issue, but I can&#8217;t tell you exactly what it was that I did. I tried transferring it through the pytivo web interface, and it worked without issue. I did notice, as you mentioned, that I did not have my username and password set in the config. I added that, but it still did not work&#8230;even though I did restart pytivo. I let it sit for a bit, went back, restarted pytivo again, and magically I was able to transfer the video within Tivo. Again, not sure what I did, but it works. However, I have another issue now&#8230;

While the video was transferring, I tried to play it. It gave me some sort of message that &#8220;you cannot play this until the transfer is complete, and it will take X hours, etc.&#8221;. Well, it only took 20 mins. When it was complete, I was able to play it. Isn&#8217;t the whole point of vidmgr to play while it is transferring? I&#8217;m clearly missing some sort of setting. Could this be an issue with how the file was originally transcoded? It&#8217;s an .avi. 
Also, and this is just curious to me&#8230;when I click on the &#8220;info&#8221; button of the transferred video, there is a message &#8220;Due to policy set by the copyright holder, this recording: Cannot be transferred to VCR, DVD, or any other media device. To learn more, visit tivo...&#8221; Why/how on earth does Tivo know the source of this file? It happens to be legit, but still&#8230; Is it just going by the &#8220;name&#8221; of the file/movie? Could that be the issue with not being able to stream as it copies?

Again, thank you so much for all your help!


----------



## jasondeangelo

UPDATE: Just tried another video. .MPG this time. This time I wrote down the full message: &#8220;This program is downloading. It cannot be played now because the download speed is not fast enough or not enough video has been received. Please try to play this program again after 4 hours, 5 minutes have passed.&#8221;

The transfer is already 10 mins down, and that estimated time continues to decrease, and is obviously inaccurate. 

Thanks again, everyone!


----------



## jasondeangelo

UPDATE 2: I have to apologize. The second file was a .mkv file. I just tried an .mpg and it worked! Meaning, I can play it as it copies (streams). Can you guys explain to me what this exactly means? Do I need to convert all my files to .mpg? I&#8217;m hoping not!


----------



## windracer

I've seen that message when downloading content from Amazon, but never from pyTivo. I think it has something to do with how the TiVo is calculating the transfer speed. Your .mpg file doesn't need to be transcoded so it will copy faster than the .mkv so that's probably why you're seeing that. What's your network setup like?

As for the copyright notice, that's just the generic message TiVo puts on content that cannot be transferred (copy protection flag). It has nothing to do with the name of the file or its content, so don't worry about that. I forget the exact criteria that will cause a pyTivo-transferred video to exhibit this, but I've seen it in the past and it's not really a big deal.


----------



## wmcbrine

jasondeangelo said:


> Isnt the whole point of vidmgr to play while it is transferring?


No, it's not. The point of VidMGR is to initiate "pushes", a special type of transfer, from the TiVo rather than from a browser. If your goal is to watch videos while they're transferring, then you should use the standard pyTivo "pull" interface at the bottom of the Now Playing list. You don't need VidMGR for that. (Alternatively, you could use HME/VLC and/or Streambaby.)



> _Also, and this is just curious to mewhen I click on the info button of the transferred video, there is a message Due to policy set by the copyright holder [etc.]_


TiVo Inc. attaches this absurd notice to _everything_ transferred via push, quite apart from any expressed wish of any copyright holders. The upshot of it is that you can't transfer the video back out (although you can stream it, Premiere-to-Premiere). You can, again, avoid this issue by using pull rather than push.



> _Could that be the issue with not being able to [play] as it copies?_


No.

Because push is based on the TiVoCast system (aka Video on Demand podcasts), which (depending on your Internet speed, etc.) can come in very slowly, TiVo decided not to allow instant playback unless the stream is coming in at a real-time playable rate -- to, I suppose, "improve the user experience", instead of presenting users with the equivalent of "buffering" messages.

Now, in the case of a pyTivo transfer, the stream generally _is_ coming in at an acceptable rate, but the TiVo thinks it's running slow, because pyTivo has to give the size beforehand, and when it's transcoding, it has to overestimate -- since, if it underestimated, the video would be automatically deleted once it exceeded the given size, because the TiVo didn't clear enough disk space for it.

Certain types of files don't require transcoding: MPEG-2 program streams (as you discovered), h.264 MP4 files, and a subset of VC-1 WMV's. In this case, pyTivo can give the exact size, so you won't get the warning message, because the TiVo can see that the file is coming in as expected.

The "download speed is not fast enough" message doesn't come up with pulls, because the TiVo knows they originate from the LAN, so it doesn't feel the need to improve the user experience. (Note that pulls can only pass MPEG-2 program streams without transcoding, but that doesn't matter for purposes of avoiding the blocking.)


----------



## jasondeangelo

Thanks so much!!!! You both have been so helpful! I really apprecaite it.
Also, again, thanks for all your hard work.


----------



## lrhorer

To add a bit to William's post:

1. Transcoding speed will make a big difference to how long the TiVo buffers the material. If no transcoding is done, the buffering time may be significantly decreased or eliminated. A faster processor on the server can make a significant difference if transcoding is being done.

2. It's a trade-off between initial buffering and buffering pauses during playback. With a pull, one may immediately start playing the program, but may then experience numerous pauses during playback, especially if the video bit rate is very high or the video is 720p. OTOH, when pushing, the amount of time spent pre-buffering the video should be very similar to the amount of time spent pausing during a pull.

3. Pushing h.264 content should eliminate any buffering. H.264 coding in a .mp4 container transfers more than 3 times faster than the same content coded as .mpg on an S3 and more than 4 times faster on a THD. I have never encountered the buffering message when pushing h.264 content.

4. The initial buffering estimates are usually quite far off. If one waits a minute or two before attempting to play, the estimated time required to complete buffering is much more accurate and much lower than the initial estimate.


----------



## lrhorer

wmcbrine said:


> No, it's not. The point of VidMGR is to initiate "pushes", a special type of transfer, from the TiVo rather than from a browser. If your goal is to watch videos while they're transferring, then you should use the standard pyTivo "pull" interface at the bottom of the Now Playing list.


Well, I wouldn't quite put it like that. Watching videos while they are transferring with a pull is no problem. There may be a brief delay before one can start viewing, is all, when transferring high bit rate or 720p .mpg files. Personally I find this less annoying than pauses while in the middle of viewing the material. I eliminate both, however, by recoding everything to h.264 before storing it on the hard drive.



wmcbrine said:


> Now, in the case of a pyTivo transfer, the stream generally _is_ coming in at an acceptable rate


Well, that depends. Even with an S3, 720p content just does not transfer fast enough if it is coded as .mpg, and anything whose average bit rate exceeds 17 Mbps also generally does not transfer quite fast enough if it is coded as .mpg. With the THD, the issue is even worse.



wmcbrine said:


> Certain types of files don't require transcoding: MPEG-2 program streams (as you discovered), h.264 MP4 files, and a subset of VC-1 WMV's. In this case, pyTivo can give the exact size, so you won't get the warning message, because the TiVo can see that the file is coming in as expected.


Again, that's not always true. Indeed, with most .mpg pushes, I get at least a minute or two of buffering before the program will start, even if I have both tuners disabled. Mp4 pushes are another matter, and along with the space savings, that is why I recode all my videos to h.264 in a .mp4 container.


----------



## johnh123

Anyone using vidmgr on a box in the tivo beta program? PMs welcome.


----------



## jcthorne

From prior experience, check the mind server settings in pytivo....


----------



## markmarz

lrhorer said:


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


Can't quite get this to work; vidmgr doesn't appear in 'Music, Photos & Showcases'. 
I _can _successfully run vidmgr with these console commands:

/usr/share/pyTivo/pyTivo.py &
cd /usr/share/pyhme
./start.py &
Note that if I leave out cd then start.py doesn't pick up the config.ini in /usr/share/pyhme; instead it appears as though he is running thru a default configuration.



Code:


[email protected]:/usr# find . -name "config.ini"
./share/pyhme/config.ini
./bin/kmttg/config.ini
[email protected]:/usr#

All this about config.ini may be a red herring, just thought I'd mention it in case it's a clue.

There's a few things I'm not clear on in your scripts (well, more than a few but these seem to be setup related):

both refer to mountnfs.sh script re path; I've left the path unaltered
both scripts 'Read configuration variable file if it is present'; there is no such dir on my system

/var/log/pyTivo.log & /var/log/pyhme.log & /var/log/pyhme.err do not exist. Neither do /var/run/pyHME.pid or /var/run/pyTivo.pid.

I edited /etc/insserv.conf to add:


Code:


$pyTivo         pyTivo

I've rechecked the installation of all 4 scripts and see nothing left out, but clearly something's not right. A clue would be much appreciated!


----------



## windracer

I don't know about lrhorer's init scripts, but here are mine (for Ubuntu, you'll need to change your paths accordingly where necessary):

pytivo


Code:


#!/bin/bash
### INIT INFO
# Provides: pytivo
# Short-description: pyTivo server
# Description: Start and stop the pyTivo server.
### END INIT INFO

RETVAL=0

. /lib/lsb/init-functions

start() {
        log_daemon_msg "Starting pyTivo server" "pytivo"
        pgrep -f pyTivo.py > /dev/null
        RETVAL=$?
        [ $RETVAL -eq 0 ] && echo "pyTivo already running: Exiting" &&
exit 1

        # this call actually starts pyTivo.
        /usr/bin/python /usr/local/tivo/pyTivo/pyTivo.py > /var/log/pytivo.log 2>&1 &
        # sleep for 1 second, giving the script time to start up
        sleep 1
        pgrep -f pyTivo.py > /dev/null
        RETVAL=$?
        log_end_msg $RETVAL
        return $RETVAL
}

stop() {
        log_daemon_msg "Stopping pyTivo server" "pytivo"
        pkill -f pyTivo.py > /dev/null
        RETVAL=$?
        log_end_msg $RETVAL
        return $RETVAL
}

# See how we were called.
case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
restart|reload)
        stop
        sleep 3
        start
        RETVAL=$?
        ;;
*)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        esac
        exit $RETVAL

pyhme


Code:


#! /bin/sh
### BEGIN INIT INFO
# Provides:          pyhme
# Short-Description: HME for Python Framework
# Description:       Starts/Stops/Restarts the pyhme daemon
### END INIT INFO

set -e

DESC=pyhme

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

d_start() {
    cd /etc/tivo/pyhme
    /etc/tivo/pyhme/start.py > /var/log/pyhme.log 2>&1 &
}

d_stop() {
    pkill -f start.py
}

case "$1" in
  start)
        echo -n "Starting $DESC"
        d_start
        echo "."
        ;;
  stop)
        echo -n "Stopping $DESC"
        d_stop
        echo "."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC"
        d_stop
        sleep 2
        d_start
        echo "."
        ;;
  *)
        echo "Usage: pyhme {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
esac

exit 0


----------



## markmarz

windracer said:


> I don't know about lrhorer's init scripts, but here are mine (for Ubuntu, you'll need to change your paths accordingly where necessary):


Thanks very much! BTW I'm running Debian, not Ubuntu. Are you running Debian?


----------



## markmarz

windracer said:


> I don't know about lrhorer's init scripts, but here are mine ...


Perfect! I'm able to run these scripts while root in /etc/init.d, the daemons are running and vidmgr looks great.

But on reboot the daemons are not running. Afraid I'm pretty ignorant about linux .. is there something obvious that needs to be stated for a newbie? I don't fully understand how to get daemons running on boot re /etc/init.d and so on.

BTW as part of lrhorer's setup, I did edit /etc/insserv.conf to add:


Code:


$pyTivo         pyTivo

Should that remain in /etc/insserv.conf and is there something analogous for your scripts?


----------



## windracer

markmarz said:


> Thanks very much! BTW I'm running Debian, not Ubuntu. Are you running Debian?


I'm running Ubuntu (Precise) but since it's Debian based ... 



markmarz said:


> Perfect! I'm able to run these scripts while root in /etc/init.d, the daemons are running and vidmgr looks great.


Great!



markmarz said:


> But on reboot the daemons are not running. Afraid I'm pretty ignorant about linux .. is there something obvious that needs to be stated for a newbie?


To add the init scripts to boot, I do this:

$ sudo update-rc.d pytivo defaults
$ sudo update-rc.d pyhme defaults

Those two commands will add the start/stop links to your init.d scripts under the default runlevels. If you have it installed on your system, you can also use sysv-rc-conf to customize which services start at which runlevels.



markmarz said:


> Should that remain in /etc/insserv.conf and is there something analogous for your scripts?


I've never touched insserv.conf.


----------



## jbernardis

I run my programs on my NAS which is debian based and I use the same scripts and procedures as windracer. Without close inspection they appear to be identical - apparently these scripts have made the rounds


----------



## markmarz

windracer said:


> To add the init scripts to boot, I do this:
> 
> $ sudo update-rc.d pytivo defaults
> $ sudo update-rc.d pyhme defaults


Both of these commands give complaints, but pytivo does come up on reboot; pyhme does not. Took a look with sysv-rc-conf and saw only pytivo was activated for runlevels 2-5. I activated pyhme with sysv-rc-conf, but it didn't fix it.

After boot, with pytivo daemon running & pyhme not, I started pyhme manually and vidmgr is happy.

Here's the errors reported by *update-rc.d pytivo defaults*; in my naive interpretation it's due to not specifying every possible invoke argument in the switch statement which I assumed was okay else you'd have problems.


Code:


[email protected]:/etc/init.d#  update-rc.d pytivo defaults
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'K01pytivo' missing LSB tags and overrides
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: warning: script 'pytivo' missing LSB tags and overrides
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `pyhme'
insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `pyhme'
[email protected]:/etc/init.d#

Here's the errors reported by *update-rc.d pyhme defaults*; same naive interpretation


Code:


[email protected]:/etc/init.d#  update-rc.d pyhme defaults
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'K01pytivo' missing LSB tags and overrides
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `pyhme'
insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `pyhme'
insserv: warning: script 'pytivo' missing LSB tags and overrides
[email protected]:/etc/init.d#

I'm guessing maybe pyhme isn't activated because of the detected 'errors' in pytivo; this is the last error msg from *update-rc.d pyhme defaults*:


Code:


insserv: warning: script 'pytivo' missing LSB tags and overrides




windracer said:


> I've never touched insserv.conf.


I've removed the line I had added earlier.

I'll go ahead and start screwing with the scripts but I'll probably get myself in trouble since I don't know the language. Hoping that there's something obvious to you; figure there must be or you'd have similar problems.


----------



## markmarz

jbernardis said:


> I run my programs on my NAS which is debian based and I use the same scripts and procedures as windracer. Without close inspection they appear to be identical - apparently these scripts have made the rounds


As if I needed more evidence, this nails it that I must be doing something wrong!


----------



## markmarz

I thought I'd verify that pytivo daemon was running & pyhme daemon not after reboot, so I rebooted again.

This time both daemons are running, vidmgr is happy.

Okay, then.

Thanks!


----------



## windracer

It might have been that line in insserv.conf. Anyway, glad it's all working for you! :up:


----------



## lrhorer

markmarz said:


> Can't quite get this to work; vidmgr doesn't appear in 'Music, Photos & Showcases'.
> I _can _successfully run vidmgr with these console commands:
> 
> /usr/share/pyTivo/pyTivo.py &
> cd /usr/share/pyhme
> ./start.py &
> Note that if I leave out cd then start.py doesn't pick up the config.ini in /usr/share/pyhme; instead it appears as though he is running thru a default configuration.


That may well be true. Jeff can chime in with more details, I expect. Note the script I use does do an explicit



Code:


RUNDIR=/usr/share/pyhme
...
cd $RUNDIR

What happens if you run the run scripts directly by typing /usr/share/pyTivo/pyTivo and /usr/share/pyhme/pyHME?



markmarz said:


> Code:
> 
> 
> [email protected]:/usr# find . -name "config.ini"
> ./share/pyhme/config.ini
> ./bin/kmttg/config.ini
> [email protected]:/usr#


Just FYI, the double quotes in the find statement are not necessary unless there are special characters (like the wildcard character * or a space) in the name being sought. In this case `find . -name config.ini` is just fine. The config.ini file in /usr/bin/kmttg is not relevant to any issues you may have here.



markmarz said:


> There's a few things I'm not clear on in your scripts (well, more than a few but these seem to be setup related):
> 
> 1. both refer to mountnfs.sh script re path; I've left the path unaltered


Well, that is a comment that is in the System V skeleton file, but it is a good idea to leave it there. What it is saying is that (in a default Debian system) /var is not properly available for reading and writing until after the mountfs.sh script is run during boot. Any application writing to /var should not be initialized until after mountfs.sh is run and should be shut down before /var is umounted. If the System V headers are intact and the system is correctly using dependency based booting, this will automatically be addressed properly, but it is a good idea to keep the note handy so one correctly assigns the dependencies. This is salient to the majority of daemons, because daemons usually write either to /var/log/syslog or to their own file in /var/log.



markmarz said:


> 2. both scripts 'Read configuration variable file if it is present'; there is no such dir on my system


Um, I'm just about absolutely certain there is a /etc/default directory on your system. Debian would have an exceedingly hard time running without it. If you mean no /etc/default/phyHME or /etc/default/pyTivo file, then that's right, there won't be. Again, this is a comment from the skeleton file. (You can take a look at the skeleton at /etc/init.d/skeleton. It is intended as a template for all init files in /etc/init.d.) If no such file as $NAME exists in /etc/default, nothing happens, either good or bad. If it does exist, then it is sourced as part of the init script. Any commands, variables, whatever from the named file are inserted into the script at that point. Since the file does not exist, nothing gets inserted. It's an easy and straightforward way to keep the init files uniform across many installations and invariant from release to release while at the same time allowing for great variability of the init configurations both from installation to installation and in general as time passes.

For more info, look up "dependency based booting in Linux".



markmarz said:


> /var/log/pyTivo.log & /var/log/pyhme.log & /var/log/pyhme.err do not exist. Neither do /var/run/pyHME.pid or /var/run/pyTivo.pid.


They won't until the scripts run successfully. The .pid files are created near the bottom of each $NAME run file. You can see the next to last line is



Code:


echo $! > $PIDFILE

That writes the PID of the application to the /var/run/pyTivo.pid or /var/run/pyHME.pid file, as the case may be. The system variable "$!" contains the PID of the most recently run command in the script. The variable $PIDFILE is assigned at the top of each script, and is the name of the file where the PID of the daemon is kept.

The .log and .err files are created when the applications write to what would normally be stdout and stderr. These streams are re-directed by the run scripts when nohup is invoked. (Actually, the .err file redirection is disabled in the scripts I posted.)



markmarz said:


> I edited /etc/insserv.conf to add:
> 
> 
> Code:
> 
> 
> $pyTivo         pyTivo


That registers pyTivo as a service. Note the two lines near the top of the pyHME init script:



Code:


# Required-Start:    $remote_fs $syslog $network $pyTivo
# Required-Stop:     $remote_fs $syslog $network $pyTivo

This insures that the specified services remote_fs, syslog, network, and pyTivo have had their init scripts run at boot time before pyHME is started and that in this case pyHME is stopped before those same four services are stopped whenever a runlevel is entered that shuts down any or all of those services. Typically this would be during shutdown or perhaps when dropping to single user mode. Usually, any dependent daemons are shut down before the services upon which they depend are shut down, but there can be exceptions. An obvious one is where an init script does not start a daemon, but rather initializes some utility that then terminates. In that case, the Required-Stop line would have noting in it beyond the colon. The two lines labeled Default-Start and Default-Stop contain the runlevels where the scripts are started and stopped. Usually, unless the service is a system default, the union of the two lines will contain every number from 0 - 6. There should never be a duplicate between the two. If the service is a system default, then the Default-Start line will have an S in it and the Default-Stop line will be empty. This means the service is started only at boot time, before any runlevel is entered.

In any case, to simplify, registering pyTivo as a service and then specifying it as a Required-Start and Required-Stop makes sure the update-rc.d utility creates the init links so that pyTivo is started before those scripts are run and that they are stopped cleanly before pyTivo is shut down. I'm not sure, strictly speaking, that it would cause a huge problem if vidmgr or jukebox tried to do something with pyTivo not loaded, but the action would most certainly fail. Other HME for Python apps could not care less.



markmarz said:


> I've rechecked the installation of all 4 scripts and see nothing left out, but clearly something's not right. A clue would be much appreciated!


As I mentioned above, with both utilities unloaded, what happens if you run the run files directly? If they both work, then unload them again and run the init files, first with `/etc/init.d/<utility> start` and then with `/etc/init.d/<utility> stop`.

Check the files permissions.


----------



## lrhorer

windracer said:


> I don't know about lrhorer's init scripts, but here are mine (for Ubuntu, you'll need to change your paths accordingly where necessary):


Those are not valid System V dependency-based init scripts, I'm afraid. At a bare minimum, every System V init script is required to have the following, with each line modified to fit the script parameters:



Code:


#! /bin/sh
### BEGIN INIT INFO
# Provides:          skeleton
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Example initscript
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.
### END INIT INFO

# Author: Foo Bar <[email protected]>
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.

Without this header, insserv cannot proplerly assign the link names in the /etc/rcX.d directories. Non-dependency based booting can live without the headers, but non-dep booting can get very manual and can easily wind up with dependency conflicts if one is not very careful.


----------



## lrhorer

windracer said:


> $ sudo update-rc.d pytivo defaults
> $ sudo update-rc.d pyhme defaults


He is running Debian. After he logs in (assuming he does not log in as root) he can simply issue the `su` command to assume the mantle of root. Sudo is then not necessary. In a secure environment, disabling root logins, especially via ssh, is not really necessary. Preventing a su to root is blankly stupid, if you ask me. It's one of the things I really dislike about Ubuntu. Let the sysadmin decide what security is appropriate. The distro maintainers should keep their paternalistic noses out of it. [/rant]



windracer said:


> I've never touched insserv.conf.


It may not be absolutely necessary in this case, but since vidmgr and jukebox both depend on pyTivo being loaded, I prefer to make sure pyTivo is running before loading HME for Python and that HME for Python is stopped cleanly before pyTivo is shut down. With dependency-based booting, by far the best way to insure that is to register the service (in this case pyTivo) upon which the dependent apps depend.


----------



## lrhorer

markmarz said:


> Both of these commands give complaints, but pytivo does come up on reboot; pyhme does not. Took a look with sysv-rc-conf


I definitely do not recommend the use of sysv-rc-conf for managing any dependency based System V distro. It's probably OK to view it, but I would let insserv manage it.



markmarz said:


> and saw only pytivo was activated for runlevels 2-5. I activated pyhme with sysv-rc-conf, but it didn't fix it.


Well, look at the errors, if any, from the scripts as I mentioned. I definitely do not recommend using non-compliant init scripts, but of course it is your system, not mine.



markmarz said:


> Here's the errors reported by *update-rc.d pytivo defaults*


I suggest you read through the man page for update-rc.d and insserv.



markmarz said:


> in my naive interpretation it's due to not specifying every possible invoke argument in the switch statement which I assumed was okay else you'd have problems.


No. The errors you encountered are due to the missing LSB tags at the top of the init headers in the init scripts. The Required-Start, Required-Stop, Default-Start and Default-Stop tags are required to be there, even if they are blank beyond the colons. Failure to have the proper tags will likely result in the links being named inappropriately, which in turn may cause the daemons to fail.



Code:


[email protected]:/etc/init.d#  update-rc.d pytivo defaults
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'K01pytivo' missing LSB tags and overrides
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: warning: script 'pytivo' missing LSB tags and overrides
insserv: Script pyhme is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `pyhme'
insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `pyhme'
[email protected]:/etc/init.d#

Those are all errors due to insserv not knowing what to do with the scripts. This will in turn cause the links to either be wrong or not be created at all. Take a look in /etc/rc2.d (runlevel 2, which is the default boot runlevel for Debian), for example:



Code:


RAID-Server:/etc/rc2.d# ll
total 24
drwxr-xr-x   2 root root  4096 Dec 25 09:22 .
drwxr-xr-x 165 root root 16384 Jun 17 16:29 ..
-rw-r--r--   1 root root   677 Dec 31  2010 README
lrwxrwxrwx   1 root root    17 May 30  2011 S01dirmngr -> ../init.d/dirmngr
lrwxrwxrwx   1 root root    15 Nov 24  2011 S01ncidd -> ../init.d/ncidd
lrwxrwxrwx   1 root root    17 May 30  2011 S01netperf -> ../init.d/netperf
lrwxrwxrwx   1 root root    18 Nov 24  2011 S01sip2ncid -> ../init.d/sip2ncid
lrwxrwxrwx   1 root root    14 May 30  2011 S01sudo -> ../init.d/sudo
lrwxrwxrwx   1 root root    17 May 30  2011 S02rsyslog -> ../init.d/rsyslog
lrwxrwxrwx   1 root root    17 May 30  2011 S03apache2 -> ../init.d/apache2
lrwxrwxrwx   1 root root    15 May 30  2011 S04acpid -> ../init.d/acpid
lrwxrwxrwx   1 root root    17 May 30  2011 S04anacron -> ../init.d/anacron
lrwxrwxrwx   1 root root    13 May 30  2011 S04atd -> ../init.d/atd
lrwxrwxrwx   1 root root    14 May 30  2011 S04atop -> ../init.d/atop
lrwxrwxrwx   1 root root    14 May 30  2011 S04cron -> ../init.d/cron
lrwxrwxrwx   1 root root    14 May 30  2011 S04dbus -> ../init.d/dbus
lrwxrwxrwx   1 root root    15 May 30  2011 S04exim4 -> ../init.d/exim4
lrwxrwxrwx   1 root root    17 May 30  2011 S04galleon -> ../init.d/galleon
lrwxrwxrwx   1 root root    17 May 30  2011 S04hddtemp -> ../init.d/hddtemp
lrwxrwxrwx   1 root root    22 May 30  2011 S04hotkey-setup -> ../init.d/hotkey-setup
lrwxrwxrwx   1 root root    25 Dec 25 09:22 S04isc-dhcp-server -> ../init.d/isc-dhcp-server
lrwxrwxrwx   1 root root    20 May 30  2011 S04kerneloops -> ../init.d/kerneloops
lrwxrwxrwx   1 root root    14 May 30  2011 S04lirc -> ../init.d/lirc
lrwxrwxrwx   1 root root    14 May 30  2011 S04lisa -> ../init.d/lisa
lrwxrwxrwx   1 root root    21 May 30  2011 S04loadcpufreq -> ../init.d/loadcpufreq
lrwxrwxrwx   1 root root    15 May 30  2011 S04mdadm -> ../init.d/mdadm
lrwxrwxrwx   1 root root    18 May 30  2011 S04netatalk -> ../init.d/netatalk
lrwxrwxrwx   1 root root    13 May 30  2011 S04ntp -> ../init.d/ntp
lrwxrwxrwx   1 root root    13 May 30  2011 S04nut -> ../init.d/nut
lrwxrwxrwx   1 root root    23 May 30  2011 S04openbsd-inetd -> ../init.d/openbsd-inetd
lrwxrwxrwx   1 root root    25 May 30  2011 S04policycoreutils -> ../init.d/policycoreutils
lrwxrwxrwx   1 root root    19 May 30  2011 S04pppstatus -> ../init.d/pppstatus
lrwxrwxrwx   1 root root    16 May 30  2011 S04pyTivo -> ../init.d/pyTivo
lrwxrwxrwx   1 root root    15 May 30  2011 S04rsync -> ../init.d/rsync
lrwxrwxrwx   1 root root    18 May 30  2011 S04sendmail -> ../init.d/sendmail
lrwxrwxrwx   1 root root    17 May 30  2011 S04sensord -> ../init.d/sensord
lrwxrwxrwx   1 root root    23 May 30  2011 S04smartmontools -> ../init.d/smartmontools
lrwxrwxrwx   1 root root    27 May 30  2011 S04speech-dispatcher -> ../init.d/speech-dispatcher
lrwxrwxrwx   1 root root    13 May 30  2011 S04ssh -> ../init.d/ssh
lrwxrwxrwx   1 root root    17 May 30  2011 S04sysstat -> ../init.d/sysstat
lrwxrwxrwx   1 root root    19 Dec 25 09:22 S04tftpd-hpa -> ../init.d/tftpd-hpa
lrwxrwxrwx   1 root root    17 May 30  2011 S04winbind -> ../init.d/winbind
lrwxrwxrwx   1 root root    22 May 30  2011 S05avahi-daemon -> ../init.d/avahi-daemon
lrwxrwxrwx   1 root root    19 May 30  2011 S05bluetooth -> ../init.d/bluetooth
lrwxrwxrwx   1 root root    22 May 30  2011 S05cpufrequtils -> ../init.d/cpufrequtils
lrwxrwxrwx   1 root root    16 May 30  2011 S05dhcdbd -> ../init.d/dhcdbd
lrwxrwxrwx   1 root root    19 May 30  2011 S05fetchmail -> ../init.d/fetchmail
lrwxrwxrwx   1 root root    13 May 30  2011 S05hal -> ../init.d/hal
lrwxrwxrwx   1 root root    25 May 30  2011 S05network-manager -> ../init.d/network-manager
lrwxrwxrwx   1 root root    20 May 30  2011 S05pulseaudio -> ../init.d/pulseaudio
lrwxrwxrwx   1 root root    15 May 30  2011 S05pyHME -> ../init.d/pyHME
lrwxrwxrwx   1 root root    17 May 30  2011 S06openvpn -> ../init.d/openvpn
lrwxrwxrwx   1 root root    14 May 30  2011 S07cups -> ../init.d/cups
lrwxrwxrwx   1 root root    13 May 30  2011 S07gdm -> ../init.d/gdm
lrwxrwxrwx   1 root root    13 May 30  2011 S07kdm -> ../init.d/kdm
lrwxrwxrwx   1 root root    18 May 30  2011 S08bootlogs -> ../init.d/bootlogs
lrwxrwxrwx   1 root root    15 May 30  2011 S08samba -> ../init.d/samba
lrwxrwxrwx   1 root root    17 May 30  2011 S15portmap -> ../init.d/portmap
lrwxrwxrwx   1 root root    20 May 30  2011 S16nfs-common -> ../init.d/nfs-common
lrwxrwxrwx   1 root root    27 May 30  2011 S17nfs-kernel-server -> ../init.d/nfs-kernel-server
lrwxrwxrwx   1 root root    18 May 30  2011 S18rc.local -> ../init.d/rc.local
lrwxrwxrwx   1 root root    19 May 30  2011 S18rmnologin -> ../init.d/rmnologin
lrwxrwxrwx   1 root root    23 May 30  2011 S18stop-bootlogd -> ../init.d/stop-bootlogd

The links in each runlevel are asserted in alphabetic order. Insserv has assigned pyTivo the name S04pyTivo, which means it will run prior to pyHME which has been assigned the name S05pyHME. Init will run the scripts with a "start" parameter whenever entering any runlevel from a runlevel where the script is run with a "stop", indicated by the name being KxxpyTivo. In those directories, pyTivo will have a higher number with the K prefix, so it is killed after pyHME.



markmarz said:


> I'm guessing maybe pyhme isn't activated because of the detected 'errors' in pytivo; this is the last error msg from *update-rc.d pyhme defaults*:
> 
> 
> Code:
> 
> 
> insserv: warning: script 'pytivo' missing LSB tags and overrides


No. Other than assigning the link names in proper order, insserv doesn't really care what pyTivo does. It's possible running HME for Python before pyTivo is loaded will jam it up, but I'm not sure. If not, then simply having an error when running insserv won't stop it from coming up. If the links don't exist at all, though, then of course it won't ever come up. Ditto if there are errors in the scripts themselves.

The first task is going to be making sure the scripts work at all. Then we can worry about insserv.



markmarz said:


> I've removed the line I had added earlier.


It probably won't hurt if it isn't there at this point. It definitely will never hurt if it is there, as long as the pyTivo header is correct. The body of the init script itself could be a fracking mess, and insserv would never know it.



markmarz said:


> I'll go ahead and start screwing with the scripts but I'll probably get myself in trouble since I don't know the language. Hoping that there's something obvious to you; figure there must be or you'd have similar problems.


I strongly suspect his system is not doing dependency based booting. It may have an older init version, or else he has legacy boot ordering enabled. Insserv will have dependency based booting disabled if there is a file named .legacy-bootordering in the /etc/init.d diretory. Absent that file, insserv will implement a boot order based upon the fields in the init script headers.

Once again, see the man pages for update-rd.d and insserv.


----------



## lrhorer

markmarz said:


> As if I needed more evidence, this nails it that I must be doing something wrong!


Well, not exactly. Their systems are not the same as yours.


----------



## lrhorer

windracer said:


> It might have been that line in insserv.conf. Anyway, glad it's all working for you! :up:


No, insserv.conf is only referenced when insserv is run, and that is only when update-rc.d is run. This will, however, happen whenever he upgrades or adds any boot-time system utilities, so I really suggest he gets his boot scripts straightened out. It could save him a lot of grief in the future. Non-dependency based booting is a lot less strict than dependency based booting, but it is also a great deal frailer and a lot harder to maintain.


----------



## markmarz

lrhorer said:


> No, insserv.conf is only referenced when insserv is run, and that is only when update-rc.d is run. This will, however, happen whenever he upgrades or adds any boot-time system utilities, so I really suggest he gets his boot scripts straightened out. It could save him a lot of grief in the future. Non-dependency based booting is a lot less strict than dependency based booting, but it is also a great deal frailer and a lot harder to maintain.


Thanks for the detailed lessons; I'll go back to your dependency based booting code when I get a chance. I see the advantages and it'd be good to understand. Meantime it's all working, fragile though it may be. Thanks again to you & all!


----------



## markmarz

lrhorer said:


> Non-dependency based booting is a lot less strict than dependency based booting, but it is also a great deal frailer and a lot harder to maintain.


Got your scripts working, can't tell you what I did wrong the first go-round. Thanks!


----------



## lrhorer

OK, great. If you put pyTivo back into insserv.conf and re-run update-rc.d, it should faithfully put pyTivo before HME for Python in the boot sequence and HME before pyTivo in the shutdown sequence.

Of course, from now on, you will find log files for both applications in /var/log, and you can start, stop, or restart the applications at any time with

/etc/init.d/pyTivo start|stop|restart
/etc/init.d/pyHME start|stop|restart

You could even create aliases for the actions, but as little as you will likely be using them, it probably isn't worth it.

Once you are done getting everything set up, you can also expect to very nearly forget it exists. As long as the system has a good UPS supplying its power, it will just sit and run for months on end. Note the uptime on the screenshot I posted in your other thread: 4020 hours. That's nearly six months. The backup server has been running a similar amount of time.


----------



## markmarz

lrhorer said:


> OK, great. If you put pyTivo back into insserv.conf and re-run update-rc.d, it should faithfully put pyTivo before HME for Python in the boot sequence and HME before pyTivo in the shutdown sequence.


Done!



lrhorer said:


> Once you are done getting everything set up, you can also expect to very nearly forget it exists.


Just the way I like it!

Thanks!


----------



## techguy82

First i want to say this this is an amzaing piece of software. It is what i have been looking for, for a long long time.

I am having some trouble getting the mettadata to show when i enter Vidmgr.

The vidoes are transferring correctly and play beautiful.

I think i have my mettadata coded incorrectly.

I am using ThumbsGen to pull all the data. It is making the correct files but i still dont see any data when i log in.

All i see is the title of the movie and a green dot next to it.

Also is there any way to view the thumbs or titles in a "grid" view instead of a list.

Below is the copy of my ini file

Thanks for any help and keep up the amazing work!!!

# vidmgr.ini
#
# this is the global options file - it belongs in the vidmgr directory under pyhme
#
# Default values are specified below.

#
# NOTE:
#
# These default values do NOT need to be explicitly stated in this file. They are here for illustration
# you can leave them in here if you want, or you can remove them and only include in here the options you
# are changing
#

#
# vidmgr section is mandatory
#

[vidmgr]

#
# what file extensions are we interested in. Only files with these extensions will be
# displayed on screen
# specify a list of file extensions - with the . - separated by at least one space
#

exts=.mp4 .mpg .avi .wmv .mkv .mts

#
# the next 4 options specify format information for the info screen that pops up
# when you press the info button. 
# specify a list of metadata tags for each.
#

metaignore=isEpisode isEpisodic __fileName __filePath
metafirst=title seriesTitle episodeTitle description
metaspacebefore=
metaspaceafter=

#
# the next two options are also formatting options for the info screen. The info screen is 
# a two column layout. the infolabelpercent option indicates what percentage of the
# screen width should be devoted to the label column
#
# the inforightmargin option specifies the width of the right margin on the info screen. If
# you find the text running up against the right edge of the screen, increase this number.
#

infolabelpercent=30
inforightmargin=20

#
# the next two options control how multiple metadata files are handled. When searching for
# metadata, vidmgr looks for the files in the following sequence:
# .meta/default.txt
# default.txt
# .meta/<videofilename>.txt
# <videofilename>.txt
#
# metamergefiles determines if the contents of one file are merged with previous files or if
# it completely replaces the previous file. If this is set to true, since the files are read
# from the general to the specific, more specific information will replace more general information,
# but the end result will be the union of all the files. If this is set to false, then only the
# information in the last file read will be kept.
#
# metamergelines if only meaningful if metamergefiles is set to true. If set to true, then if
# two files contain the same metadata tag, then the values are concatenated together. If set to 
# false, then the value from the second file replaces the value from the first file. Note - 
# metadata tags that are already lists (vActor, etc) are always merged regardless of the value of
# this option.
#

metamergefiles=True
metamergelines=False

#
# specify the point size of the font used to display the descriptive text of a video on the main screen
#

descsize=50

#
# the image files that vidmgr uses for its background, etc, can be replaced. These files all reside
# in a directory named 'skins' under the vidmgr directory. If you wish to use your own image files, 
# create a directory under skins, place your files there, and name that directory with the skin option.
# Note: the files must be png files and must match the original images in size. Only the images being
# changed need be specified. If an image file is NOT found in your skin's directory, the corresponding
# file is taken from the main skins directory.
# 
# There is no default for this. Do Not include this option unless you are using your own skin
#
# skin=

# 
# can the files in this directory be deleted - specify true or false. 
#

deleteallowed=False

#
# specify how you would like the artwork for a video to be justified - specify left, center, or right
#

thumbjustify=left

#
# specify the name of the file to use for the folder and for the video file if a video specific file is not found
#

thumbfolderfn=folder.jpg

#
# what metadata tags should be used to construct the string used to identify this file on the screen
# specify a list of metadata tags - including any metadata tags you may have created yourself. In addition to the
# normal metadata tags, you can use the word 'file' to indicate the video's file name (without the directory) and 
# you can use the value 'titleNumber' to indicate the title number for a DVD video.
#

display=title episodeTitle

#
# what string should be used to separate the above metadata when constructing the title string
# specify an arbitrary string
#

displaysep=:

#
# what metadata tags should be used to construct the string that is used to sort the videos when they
# are displayed in a list specify a list of metadata tags - including any metadata tags you may have created yourself. In addition to the
# normal metadata tags, you can use the word '__fileName' (or 'file') to indicate the video's file name (without the directory),
# '__filePath' to indicate the video's full directory path, or the value 'titleNumber' to indicate the title number for a DVD video.
#

sort=title episodeTitle

#
# which direction should the sort be
# specify up for an ascending sort or down for a descending sort
#

sortdirection=up

# 
# should a leading article (the, a, an) in a 'title' or 'episodeTitle' be ignored when sorting on that title. Note that the displayed
# title will not change i.e. "The Abyss" will still show up as "The Abyss", but it will be sorted in with the A titles.
#

ignorearticle=True

# 
# the next options control the contents of the top of the navigation tree. If sharepage is set to true, the top page will
# contain an entry that says 'Browse Shares'. This will take you to a separate page where the shares are listed.
# If it is set to false, then each share will be on the top screen.
# if sortroot is true, the virtual shares and the actual shares will be sorted together. If it is false (the default)
# then the actual shares will appear above the virtual shares. Both will be sorted, but one will appear before the other
#

sharepage=true
sortroot=false

#
# what text string should be used for the subtitle on the top navigation screen. The subtitle normally gives
# a cue as to where you are in the navigation, but no such cue is necessary when at the top; this string will
# be displayed instead
# default: topsubtitle=Main Menu
#
# topsubtitle=

#
# by default, vidmgr will check file unique IDs so that it knows if two files are actually the same file with two
# different links. On windows, this is an expensive operation. This affects the amount of time needed to build
# the cache. If you are not using links in your video directories, you can essentially disable this logic by
# setting the following option to false. The default is true
#

usefileid=False

#
# the tivos section of the file is where you identify your Tivos. For each tivo, you MUST provide a name and
# a TSN. It is NOT necessary to put the dashes into the TSN - just use the digits. In the tags below, replace the
# X with a digit starting at 1 (e.g. tivo1.name). If you have multiple tivos, number them sequentially. You can have
# an arbitrary number of tivos, but vidmgr will stop parsing the file as soon as it detects a gap in the
# numbering sequence. These fields have no default values.
#

[tivos]
tivo1.name=LivingRoom
tivo1.tsn=746XXXXXXXXXX

# 
# the pytivos section is where you identify your pytivo processes. The tags are numbered as above - replace the X
# with a digit starting from 1 andproceeding sequentially from there. You MUST provide config - which is a full
# path to the pyTivo.conf file, and ip - which is the ip address of the machine on which pytivo is running. If 
# the config file does NOT specify a port number for pytivo, then you MUST specify it here. pytivoX.skip is a 
# comma-delimited list of shares that you do NOT want to include here - do NOT use extra spaces in this list.
# pytivoX.sep is the file path separator for the machine on which pytivo is running - if this is omitted, then
# the seperator character for the machine on which vidmgr is used.
#

[pytivos]
pytivo1.config=C:\PyTivo\pyTivo.conf
# pytivoX.sep=
pytivoX.ip=192.168.1.109
pytivoX.port=9032
# pytivoX.skip=

#
# now come the virtual shares - there can be an arbitrary number of these. Whatever text you put between the square
# brackets as the section name will become the text that appears on the navigation screen. Each virtual share MUST
# have a specification for which files to include. Additionally, you can override sort and display options, and you
# can specify how files should be grouped
#
[Movie Library]
values=all
#
# there are four possible ways to indicate which files to include. You must use exactly 1 of them for each virtual share:
#
# 1. specify which metadata tags are used to divide videos up into groups:
#
# tags=tag1 tag2 tag3 ... tagn
#
# each video is searched for the specified tags. If a video does not have ANY of these tags, it is skipped. If it has ANY
# of the tags, then the video file will be inserted into a group for each value. For example, if the tag was vActor, then
# for each actor in a file, that file would be inserted into a group with that actor's name as the group name. As other
# videos are found with this same actor, they will be added to the existing group. What you end up with is a main menu choice
# for the virtual share (the text in the brackets) and when you choose it, you will see all the actors found in the metadata
# as separate "folders". If you then navigate into those folders, you will see all the videos that each actor is in. In addition
# to all of the normal metadata tags, including your own, you can use titleNumber which is the title number for DVD titles.
#
#
# 2. specify metadata VALUES that must be matched for a video to be included:
#
# values = tag:val,val.../tag:val,val...
#
# each video is searched for the specified tag(s). If a video does not contain any of the tags, it is skipped. If it DOES
# contain a tag, then the value for that tag MUST be one of the values listed. If it's not, then the video is skipped. If 
# multiple tags are specified, a video will match only if 1) it contains ALL of the tags, and 2) each value for EVERY tag
# is in the specified list. Spaces are significant for the values. Do not use any unnecessary spaces in the specification.
# As an example, values=isEpisodic:true,True,TRUE will include ALL videos for which the value for isEpisodic is true, True, 
# or TRUE. As with tags, the metadata tags can be any of the normal tags, including your own, or titleNumber which is the
# title number for DVD videos.
#
#
# 3. select videos based on a metadata tag, but group them into alphabetical folders (e.g. "A", "B", ... "9", "<Other>")
#
# alpha = tag
#
# for example, specifying alpha=Title will organize all videos into title order, but it will produce a separate "folder"
# for each occurring letter or digit. Titles that do not have a leading letter or digit are placed into an "<Other>" folder.
# Only letters and digits that have at least one video will be presented. The ignorearticle option affects Alpha shares
# if the tag is either 'title' or 'episodeTitle'
#
#
# 4. include ALL videos unconditionally:
#
# values=all
#
# this is useful in conjunction with the other options below. For example if you want a share that includes all videos
# sorted by record date.
#

#
# within the videos selected for a virtual share, you can add one layer of grouping. This is provided by the groupby
# option. The tags option above already offers a layer of grouping, so this option is probably more useful for the
# values and alpha options, but it CAN be used with tags.
#
# to use this option, specify a SINGLE metadata tag. For each matching video, the value for this tag is used to create/identify
# a "folder" into which this video is placed. If the video does NOT contain the tag, then the video is placed in the root
# "folder". As a good example, let's extend the isEpisodic example from above. If you say "values=isEpisodic:true,TRUE,True"
# all videos will show up in a single flat "folder". They will be sorted, but it could be a large list. If I
# add "groupby=seriesTitle", then vidmgr will create "sub-folders" for each series title thus organizing the files.
#
# groupby=

#
# you can specify a different sort order for the tags you are organizing by as opposed to the video titles themselves. The videos
# are governed by the sortdirection and sort parameters, but the sort order of the tags is determined by the tagorder parameter, set
# to either up (default) or down. This allows, for example, for the movies to be organized by year with the newest first, but within 
# a single year the titles would be in normal alphabetical order.
#
# tagorder=up

#
# it is possible to limit the selection of videos for a virtual share to a list of physical shares by using the
# shares= statement. If omotted, ALL shares are considered as a source for videos
#
# shares=
# for example if all of your movies are in a share titled "My Movies", then then following
[Movies Alphabetically]
alpha=Title
shares=MyMovies
#
# will create a virtual share containing all videos from the My Movie share organized into alhpabetical folders

# finally, it is possible to override the sort, sortdirection, display, and displaysep options for this virtual share
# by simply specifying that option in the corresponding section. If these are missing, then the global values will be used.
#
# display=
# displaysep=
# sort=
# sortdirection=


----------



## windracer

techguy82 said:


> All i see is the title of the movie and a green dot next to it.


Refer to this section of vidmgr.ini:



Code:


# the next two options control how multiple metadata files are handled. When searching for
# metadata, vidmgr looks for the files in the following sequence:
# .meta/default.txt
# default.txt
# .meta/<videofilename>.txt
# <videofilename>.txt
#

Do your metadata files match the specified naming standard and location? For example, if you have a video called "My Movie.avi" the metadata file needs to named "My Movie.avi.txt" and reside in the same folder as the .avi file or in a subdirectory named .meta (notice the leading period, that's important).



techguy82 said:


> Also is there any way to view the thumbs or titles in a "grid" view instead of a list.


Not that I'm aware of.


----------



## techguy82

windracer said:


> Do your metadata files match the specified naming standard and location? For example, if you have a video called "My Movie.avi" the metadata file needs to named "My Movie.avi.txt" and reside in the same folder as the .avi file or in a subdirectory named .meta (notice the leading period, that's important).


I have set the Metadata files the way you suggested but still the same result.
i.e "300.mkv" i have a subdir \.meta\ and then placed 300.mkv.txt and have also have default.txt with in the dir as well.

I looked the code in the TXT and they are pointing to images links for the cover art. Is that correct or should it be pointing to the image saved in the DIR?

I am seeing this message when the Vidmgr boots "Video Cache does not exist - attempting to build..."

Could there be something else i am missing?

Off hand Question:
When the Meta Data is done correctly, will it show in the My Shows Section when you play the video?
The section that shows information about the show you are about to watch.

And Lastly:
I have 2 sources of videos. MyMovies & Television.
What i would like to do is have them to show up as two different sources with the metadata not in the directory view.
Right now they are all showing in 1 folder, unless i view them in the shares section.
Is that possible?

Thanks for all your help


----------



## lrhorer

techguy82 said:


> I have set the Metadata files the way you suggested but still the same result.
> i.e "300.mkv" i have a subdir \.meta\


That would be a .meta directory in the root of the drive. The .meta directory needs to be in the root of the share. Thus, if the share is c:\videos, the meta directory for the videos in that directory (but not its subdirectories) would be c:\videos\.meta



techguy82 said:


> and then placed 300.mkv.txt and have also have default.txt with in the dir as well.


Is 300.mkv the only video in its directory? If not, then a default.txt metafile referencing 300.mkv is probably not proper. The default.txt metafile would ordinarily hold information relevant to all the files in the directory.



techguy82 said:


> I looked the code in the TXT and they are pointing to images links for the cover art. Is that correct or should it be pointing to the image saved in the DIR?


Pointing? I'm not certain what you mean by "pointing". There should be nothing like a link in the metafiles. Any photographic images are a separate item altogether. The naming convention for them is the same as for the metafiles, except of course the extension is .jpg, not .txt.



techguy82 said:


> I am seeing this message when the Vidmgr boots "Video Cache does not exist - attempting to build..."
> 
> Could there be something else i am missing?


It sounds like it. What happens when you try to build the cache manually? I'm not sure, but this:



Code:


[pytivos]
pytivo1.config=C:\PyTivo\pyTivo.conf
# pytivoX.sep=
pytivoX.ip=192.168.1.109
pytivoX.port=9032
# pytivoX.skip=

doesn't look right, to me. I think it should be (eliminating the comment lines):



Code:


[pytivos]
pytivo1.config=C:\PyTivo\pyTivo.conf
pytivo1.ip=192.168.1.109
pytivo1.port=9032




techguy82 said:


> Off hand Question:
> When the Meta Data is done correctly, will it show in the My Shows Section when you play the video?


Yes, after the video is transferred, of course.



techguy82 said:


> And Lastly:
> I have 2 sources of videos. MyMovies & Television.
> What i would like to do is have them to show up as two different sources


'No problem. Just create two pyTivo shares or else two virtual shares in vidmgr.



techguy82 said:


> with the metadata not in the directory view.


I'm not sure what that means. If it means what I think it does, then creating of a .meta directory would seem to do what you want.



techguy82 said:


> Right now they are all showing in 1 folder, unless i view them in the shares section.


I'm not following you.


----------



## techguy82

Thanks that did the trick i can now see the meta data on the tivo!!\
However the Pix and the movie rating is not showing on the tivo screen when viewing the info. it shows up as TV-NR. Is it able to do that?

You mentioned that i can build the Cache manually. How would i do this?

Also when starting 

I am on a windows box if that matters.
Once again thank you for your help.


----------



## lrhorer

techguy82 said:


> I guess i am still doing something wrong.
> 
> I have all of my videos on a NAS connected to the same network as the tivo.
> The structure is
> \\Mybooklive\public\MKV Movies\21\21.mkv
> \\Mybooklive\public\MKV Movies\300.300.mkv
> \\Mybooklive\public\MKV Movies\8 mile.mkv
> 
> With in those DIR i have the Thumbnails
> \\Mybooklive\public\MKV Movies\21\21.mkv.jpg
> \\Mybooklive\public\MKV Movies\300.300.mkv.jpg
> \\Mybooklive\public\MKV Movies\8 mile.mkv.jpg
> 
> Then i have the Metadata
> \\Mybooklive\public\MKV Movies\21\21.mkv.txt
> \\Mybooklive\public\MKV Movies\300\300.mkv.txt
> \\Mybooklive\public\MKV Movies\8 mile.mkv.txt
> 
> Is this the correct way?


It will work, if that is what you want. There are lots of "correct" ways to skin this cat. I would say most people would not want to devote an entire directory to a single video, but it is entirely up to you. What I like to do is create a main pyTivo share with everything but the DVDs in it. (DVDs require a separate share and a different directory structure.) In that main share are all the movies except those that are part of a movie franchise. Each movie franchise or TV series, however, gets a separate directory in the main share. Thus, there are over 1000 videos plus the same number of thumbnails and metafiles sitting directly in /RAID/Recordings. In addition to those, there are about 100 subdirectories, each one containing two or more movie franchise installments or TV series episodes. Thus, "/RAID/Recordings/Harry Potter" contains the following:



Code:


RAID-Server:/RAID/Recordings/Harry Potter# ll
total 85796128
drwxrwxrwx  2 lrhorer users        4096 Jun 23 05:06 .
drwxrwxrwx 94 root    root       212992 Jun 23 19:38 ..
-rw-rw-rw-  1 lrhorer users      139436 Jun 14  2011 folder.jpg
-rw-rw-rw-  1 lrhorer users  8923517269 Jun 23 00:01 Harry Potter 01 and the Sorcerers Stone (Recorded Wed Jun 20, 2012, MAXHD).mp4
-rw-rw-rw-  1 lrhorer users       26470 Jun 23 05:05 Harry Potter 01 and the Sorcerers Stone (Recorded Wed Jun 20, 2012, MAXHD).mp4.jpg
-rw-rw-rw-  1 lrhorer users        1791 Jun 23 05:06 Harry Potter 01 and the Sorcerers Stone (Recorded Wed Jun 20, 2012, MAXHD).mp4.txt
-rw-rw-rw-  1 lrhorer users 12276088832 Dec  6  2010 Harry Potter 02 and the Chamber of Secrets (Recorded Sat Apr 12, 2008, KSATDT).mpg
-rw-rw-rw-  1 lrhorer users       24705 Sep  9  2011 Harry Potter 02 and the Chamber of Secrets (Recorded Sat Apr 12, 2008, KSATDT).mpg.jpg
-rw-rw-rw-  1 lrhorer users        2140 Apr  2 09:01 Harry Potter 02 and the Chamber of Secrets (Recorded Sat Apr 12, 2008, KSATDT).mpg.txt
-rw-rw-rw-  1 lrhorer users 13120417792 Dec  6  2010 Harry Potter 03 and the Prisoner of Azkaban (Recorded Sat Apr 19, 2008, KSATDT).mpg
-rw-rw-rw-  1 lrhorer users       28893 Sep  9  2011 Harry Potter 03 and the Prisoner of Azkaban (Recorded Sat Apr 19, 2008, KSATDT).mpg.jpg
-rw-rw-rw-  1 lrhorer users        1819 Sep 10  2011 Harry Potter 03 and the Prisoner of Azkaban (Recorded Sat Apr 19, 2008, KSATDT).mpg.txt
-rw-rw-rw-  1 lrhorer users 12921036800 Dec  6  2010 Harry Potter 04 and the Goblet of Fire (Recorded Sat Apr 26, 2008, KSATDT).mpg
-rw-rw-rw-  1 lrhorer users       26066 Sep  9  2011 Harry Potter 04 and the Goblet of Fire (Recorded Sat Apr 26, 2008, KSATDT).mpg.jpg
-rw-rw-rw-  1 lrhorer users        2150 Sep 10  2011 Harry Potter 04 and the Goblet of Fire (Recorded Sat Apr 26, 2008, KSATDT).mpg.txt
-rw-rw-rw-  1 lrhorer users 10807642112 Dec  6  2010 Harry Potter 05 and the Order of the Phoenix (Recorded Sun Jun 22, 2008, HBOHD).mpg
-rw-rw-rw-  1 lrhorer users      128713 Sep  9  2011 Harry Potter 05 and the Order of the Phoenix (Recorded Sun Jun 22, 2008, HBOHD).mpg.jpg
-rw-rw-rw-  1 lrhorer users        2241 Sep 10  2011 Harry Potter 05 and the Order of the Phoenix (Recorded Sun Jun 22, 2008, HBOHD).mpg.txt
-rw-rw-rw-  1 lrhorer users 13482008576 Dec  6  2010 Harry Potter 06 and the Half-Blood Prince (Recorded Sat Jun 19, 2010, HBOHD).mpg
-rw-rw-rw-  1 lrhorer users       24206 Sep  9  2011 Harry Potter 06 and the Half-Blood Prince (Recorded Sat Jun 19, 2010, HBOHD).mpg.jpg
-rw-rw-rw-  1 lrhorer users        1061 Sep 10  2011 Harry Potter 06 and the Half-Blood Prince (Recorded Sat Jun 19, 2010, HBOHD).mpg.txt
-rw-rw-rw-  1 lrhorer users  8575403092 Oct  9  2011 Harry Potter 07 and the Deathly Hallows Part 1 (Recorded Sat Oct 08, 2011, HBOHD).mp4
-rw-rw-rw-  1 lrhorer users       39276 Oct 18  2011 Harry Potter 07 and the Deathly Hallows Part 1 (Recorded Sat Oct 08, 2011, HBOHD).mp4.jpg
-rw-rw-rw-  1 lrhorer users        1279 Oct 18  2011 Harry Potter 07 and the Deathly Hallows Part 1 (Recorded Sat Oct 08, 2011, HBOHD).mp4.txt
-rw-rw-rw-  1 lrhorer users  7748337786 May 21 16:31 Harry Potter 08 and the Deathly Hallows Part 2 (Recorded Mon May 21, 2012, HBOHD).mp4
-rw-rw-rw-  1 lrhorer users           0 May 22 08:21 Harry Potter 08 and the Deathly Hallows Part 2 (Recorded Mon May 21, 2012, HBOHD).mp4.jpg
-rw-rw-rw-  1 lrhorer users        1237 May 22 08:21 Harry Potter 08 and the Deathly Hallows Part 2 (Recorded Mon May 21, 2012, HBOHD).mp4.txt

Then in vidmgr, I create a number of virtual folders:



Code:


[Browse by Genre]
tags = vProgramGenre

[Browse by Actor]
tags = vActor vGuestStar

[Browse by Director]
tags = vDirector

[Browse by Producer]
tags = vProducer

[Browse by Year]
tags = movieYear

[Browse Series]
values=isEpisodic:true,True,TRUE
display=episodeTitle
groupby=seriesTitle

[Videos Sorted by Alpha]
tags = firstAlpha

[Browse by Channel]
tags = callsign

[Videos Sorted by Date]
values = all
sort = recordDate

There is absolutely nothing saying you would have to do it this way, and I am not necessarily even recommending it, but it is how I like to do it, just as an example.



techguy82 said:


> Here is a sample of the meta data i pulled using Thumbgen


That is decidely not a valid metafile. That is an XML file. There are probably userspace converters available out there to create a metafile from an XML file. Here is an example of a proper metafile:



Code:


title : Harry Potter
episodeTitle : ... and the Sorcerer's Stone
movieYear : 2001
description : Rescued from the outrageous neglect of his aunt and uncle, a young boy with a great destiny proves his worth while attending Hogwarts School of Witchcraft and Wizardry.... - IMDB Score: 7.2 out of 10
isEpisode : true
callsign : KSATDT
seriesTitle : Harry Potter
starRating : x6
mpaaRating : x4
vDirector : Chris Columbus
vWriter : J.K. Rowling
vWriter : Steve Kloves
recordDate : 11921836
firstAlpha : H
vActor : Richard Harris
vActor : Maggie Smith
vActor : Robbie Coltrane
vActor : Saunders Triplets
vActor : Daniel Radcliffe
vActor : Fiona Shaw
vActor : Harry Melling
vActor : Richard Griffiths
vActor : Derek Deadman
vActor : Ian Hart
vActor : Ben Borowiecki
vActor : Verne Troyer
vActor : John Hurt
vActor : Richard Bremmer
vActor : Geraldine Somerville
vActor : Harry Taylor
vActor : Julie Walters
vActor : Bonnie Wright
vActor : Chris Rankin
vActor : James Phelps
vActor : Oliver Phelps
vActor : Rupert Grint
vActor : Emma Watson
vActor : Matthew Lewis
vActor : Tom Felton
vActor : Jamie Waylett
vActor : Josh Herdman
vActor : Devon Murray
vActor : Alfie Enoch
vActor : Leslie Phillips
vActor : Eleanor Columbus
vActor : John Cleese
vActor : David Bradley
vActor : Alan Rickman
vActor : Zoe Wanamaker
vActor : Luke Youngblood
vActor : Sean Biggerstaff
vActor : Elizabeth Spriggs
vActor : Danielle Tabor
vActor : Emily Dale
vActor : David Holmes
vActor : Adrian Rawlins
vActor : Julianne Hough
vActor : Simon Fisher-Becker
vActor : Nina Young
vActor : Scot Fearn
vActor : Paul Marc Davis
vProgramGenre : Action
vProgramGenre : Adventure
vProgramGenre : Crime
vProgramGenre : Family
vProgramGenre : Fantasy
vProgramGenre : Mystery
vProgramGenre : Thriller
recordDate : 118816




techguy82 said:


> Also you mentioned that i can build the Cache manually. How would i do this?


In your vidmgr directory there should be a script named BuildCache.py. Run it.



techguy82 said:


> I am on a windows box if that matters.


Not much, in terms of getting vidmgr running.



techguy82 said:


> Once again thank you for your help.


You're welcome.


----------



## lrhorer

Edit: Moved to the development thread where it belongs.


----------



## techguy82

Thank that was what i needed!!
As far as the metadata is that only seen in Tivo? or can that be seen in the Vidmgr as well.

Also what about the Pix and the rating will that be shown in the tivo info screen?

Thanks


----------



## lrhorer

techguy82 said:


> Thank that was what i needed!!
> As far as the metadata is that only seen in Tivo? or can that be seen in the Vidmgr as well.


The Description field pops up whenever the cursor sits over a video title. Pressing the <Info> button pops up a listing of the entire metafile, sorted in the way you specify in the vidmgr.ini file, and excluding any fields you explicitly exclude there.



techguy82 said:


> Also what about the Pix and the rating will that be shown in the tivo info screen?


Some fields transfer, and some do not. I don't recall which off the top of my head.

Any metatags you create yourself will definitely not transfer, but they are a powerful means of managing the vidmgr display. For example, if you will look at the sample virtual shares above, you will see one based on the firstAlpha tag. This tag simply contains the first capitalized character (i.e. A - Z) in the film's name, excluding any articles, unless the first character is a number, in which case the tag contains the text "0 - 9". Vidmgr then creates 27 virtual folders, one labeled "0 - 9", and 26 labeled "A", "B", "C", etc. Programs like 9 to 5 and 50 First Dates show up in the "0 - 9" folder, while The Abyss shows up in "A", Brewster's Millions shows up in "B", etc. This makes looking for a specific title much, much faster and easier.


----------



## techguy82

Is there a way to customize the visual aspects of the menu?

For example:
I would like to have it more like a Netflix layout not in a single column but in a grid Layout with the Thumbs showing for each movie. Then you would click on the thumb and it would enter into the info screen showning Meta data or a MovieInfo thumb created by ThumbsGen. At the bottom of the MovieInfo jpeg there would be the option to transfer ( then pop up to pick which Tivo you want to transfer to, if you have more then one) and any other features that i might not be aware of. 

When viewing the " browse shares" section it looks like this might be pretty easy to do, especially if you have the movies set in their own directory. The Directory would be the movie thumb and when entering the folder the thumb would be the movieinfo thumb. The layout would need to be changed to 2 or 3 row layout instead of column when entering the directory. Attached is a sample of the MovieInfo thumb.

Let me know your thoughts on this and if it would be possible. If so what type of programming language would be need to make these changes 


Also what meta editor would you suggest using. ThumbGen is not giving me the correct file structure 
Thanks


----------



## windracer

techguy82 said:


> Also what meta editor would you suggest using. ThumbGen is not giving me the correct file structure
> Thanks


I use MetaGenerator.


----------



## lrhorer

techguy82 said:


> Is there a way to customize the visual aspects of the menu?


There are a large number of config options in vidmgr.ini. I suggest you read through them.



techguy82 said:


> For example:
> I would like to have it more like a Netflix layout not in a single column but in a grid Layout with the Thumbs showing for each movie.


Nope. A list of 14 titles is the best you are going to do. It beats the heck out of 8 in the NPL, plus the vidmgr list advances 14 titles per page, not 7 like the NPL.



techguy82 said:


> Then you would click on the thumb and it would enter into the info screen showning Meta data or a MovieInfo thumb created by ThumbsGen. At the bottom of the MovieInfo jpeg there would be the option to transfer ( then pop up to pick which Tivo you want to transfer to, if you have more then one) and any other features that i might not be aware of.


No. Just highlight a video and press <Info> for more information, or to transfer it (or delete, if you have that option enabled).



techguy82 said:


> When viewing the " browse shares" section it looks like this might be pretty easy to do, especially if you have the movies set in their own directory. The Directory would be the movie thumb and when entering the folder the thumb would be the movieinfo thumb. The layout would need to be changed to 2 or 3 row layout instead of column when entering the directory.


If I follow what you are saying, Jeff would have to disable the Info and Thumbnail displays. I vote, "No."



techguy82 said:


> Attached is a sample of the MovieInfo thumb.


No, thanks. That would be a huge time waster.



techguy82 said:


> Let me know your thoughts on this and if it would be possible.


I'm sure it is possible, but it sounds like nothing I would choose to use.



techguy82 said:


> If so what type of programming language would be need to make these changes


HME for Python and its plug-ins are wtitten, strangely enough, in Python.



techguy82 said:


> Also what meta editor would you suggest using. ThumbGen is not giving me the correct file structure
> Thanks


I used to use metagenerator, but that was before I started using kmttg. If your files are not originating on the TiVo, though, you will need to use something like Metagenerator or MetaGen, or just create them by hand using a text editor.


----------



## markmarz

I should note that I'm using lrhorer's excellent Debian start up scripts.

The final boot console message is:
Starting OpenBSD Secure Shell server: sshd.
startpar: service(s) returned failure: pyTivo pyHME ... failed!​
But there's no repeat of that message in /etc/log/boot, and VidMGR is working fine. Tested pushing an .avi & .mpg thru PyTivo Video Manager, no problems.

There's no error indication in either pyTivo.log or pyhme.log, and there's no pyhme.err file. There's also no other errors in booting, except the perpetual ALSA amixer error which I've given up on and don't care about (much).

This is not a big deal, just strange. This after one of my brand new 3tb drives in my brand new server conked out, replaced it, rebuilt array (won't get into what sort of array), and all is well except this tiny anomaly.

Any ideas or pointers where to look next? Is this message emanating from the start of OpenBSD Secure Shell server or just happens to follow?


----------



## lrhorer

Hmm. That looks to me like the HME for Python script chain is returning a value other than 0, but is still getting things far enough along to have HMEfP running. Let me take a look tonight.

Edit: Upon consideration, I am thinking it is more likely this may be something from sshd, or even something else. By default, startpar runs the init scripts in parallel to save time, so it is possible an earlier script is failing by coincidence at the same time HME for Python is starting.

I suggest you try this: add the line



Code:


exit 0

to both the HME for Python and pyTivo init scripts in /etc/init.d just below the LSB header section. After you have done that, reboot. See if the error pops up again. If so, it's not pyTivo or HMEfP that is returning the error. Of course, after trying this, remove the line from both scripts and start the daemons. (There is no need to reboot a second time.)

Also, try the following:



Code:


dmesg | grep -i fail
cd /var/log
grep -i fail messages
grep -i fail syslog
grep -i fail *

If those return any failure messages, you may have found your culprit. (You can probably stop after searching in /var/log/messages if you find errors there or after syslog if you find errors there.)


----------



## techguy82

I am having some issues when trying to transfer a Blu-Ray MKV rip.

FFMEG is working correctly i think. it begins the trasncode and makes a pytivo.temp file in the dir. the transfer never takes place to the tivo and i get an error on pytivo "[Errno 10054] An existing connection was forcibly closed by the remote host."

It looks like the pytivo makes the temp file and then tries to transfer but is denied or the socket it was trying to connect is now closed because it took to long to transcode, but i am not sure

MKV Size is 22.9GB i have successfully transferred 30Gb MKV to the tivo so i dont think it has anything to do with the file size.

Any way to fix this?

Thanks Again!!

PS.
It takes about 2 hours for me to be able to play the file (not fully downloaded on to the tivo) any way to speed this up?

Running PyTivo on a E5200 with 2gb ram & Nivida GT 220

I am thinking about getting a much more powerful system but wanted to know if it would improve speeds greatly

Syetem:
i5-3450
8gb Ram
Nivida GT 640

Thanks in advance


----------



## lrhorer

techguy82 said:


> FFMEG is working correctly i think. it begins the trasncode and makes a pytivo.temp file in the dir. the transfer never takes place to the tivo and i get an error on pytivo "[Errno 10054] An existing connection was forcibly closed by the remote host."
> 
> It looks like the pytivo makes the temp file and then tries to transfer but is denied or the socket it was trying to connect is now closed because it took to long to transcode, but i am not sure


That is not an unlikely explanation.



techguy82 said:


> MKV Size is 22.9GB i have successfully transferred 30Gb MKV to the tivo so i dont think it has anything to do with the file size.


No, it shouldn't.



techguy82 said:


> Any way to fix this?


I suspect what is happening is the MOOV atom is getting in the way. Many h.264 coders put the MOOV atom at the end of the file, but TiVo needs it up front. I suspect that is why ffmpeg is creating a temp file. There may be a more sophisticated solution, but the most straightforward, I think, would be to convert the file into a format the Tivo can handle before attempting the transfer. For pushes, that might be h.264 in a .mp4 container. For pulls that would be MPEG-II.



techguy82 said:


> It takes about 2 hours for me to be able to play the file (not fully downloaded on to the tivo) any way to speed this up?


Again, I suspect that is due to the location of the MOOV atom. Use something like VideoRedo TV Suite to transcode your videos (maybe all of them) beforehand, and it should speed things up a great deal.



techguy82 said:


> I am thinking about getting a much more powerful system but wanted to know if it would improve speeds greatly


Not nearly as much as pre-transcoding the files.


----------



## wmcbrine

lrhorer said:


> That is not an unlikely explanation.


It doesn't work that way. This is what happens:

1. pyTivo sees that the file has video (h.264) that is potentially TiVo-push-compatible, but is in the wrong container format (MKV). (I'll ignore audio in this discussion for simplicity.)

2. So, pyTivo takes the file and remuxes it to a TiVo-compatible MP4 container. This is the temporary file in question. This is only done when remuxing; transcoding does not result in a temporary file.

3. pyTivo contacts the TiVo mind server to let it know there's a file available. Notice that it makes no difference how long it takes to create the temp file, because the notification doesn't occur until after it's done. Also, pyTivo never, ever makes an outgoing connection to the TiVo (except as part of the beacon system).

4. The Tivo, at some unspecified later time (usually quickly, often not; we have no control over it), contacts the mind server on its own, and receives the notification. Then it requests the file from the pyTivo server.

5. In this case, the TiVo rejects the file. This is not unusual. We don't know all the limits on what types of h.264 the TiVo will accept, and to be honest we don't even test for all the ones we do know.

The solution is just to do a straight pull of the file from the NPL, which will force it to be transcoded to MPEG-2. This very rarely fails. Alternatively, you can of course try reencoding it to h.264 (again) on your own, and re-pushing it, but that seems to me like a lot of work for an uncertain outcome.

techguy82, if you post the output from "ffmpeg -i badfile.mkv", it may be possible to figure out what the TiVo doesn't like about it. Then again, it may not.



> _I suspect what is happening is the MOOV atom is getting in the way._


No. pyTivo passes MP4 files through "qt-faststart" as it sends them, which moves the MOOV atom to the front. This is also why the MP4 remux creates a temp file -- because it's impossible to create the MOOV atom until the file is done, the MP4 can't be streamed as it's created, unlike the MPEG-2 program streams pyTivo creates.


----------



## techguy82

I just saved my file to MP4 with video redo(thanks by the way for that). I tried to send to tivo again and i got the same message. This time there was no ffmpep transcoding so that is good, but i got the same error message.

Attached is a screenshot. 

Let me know if there is something i am missing 

Thanks


----------



## wmcbrine

Your screen shot is illegible.


----------



## techguy82

Sorry about that, see attachment


----------



## wmcbrine

OK, thanks, but there's no new information in this screen shot.* Did you read my post #80?

* Also, it's still barely legible. You should stop resizing them, and use PNG compression instead of JPG. (Of course for something like this, it would be even better to just copy and paste it as text.)


----------



## techguy82

Thanks wmcbrine for your help.

When you say "The solution is just to do a straight pull of the file from the NPL, which will force it to be transcoded to MPEG-2. This very rarely fails"

how would i do this?

i used makemkv for blu-ray to make these files into mkv. then used videredo to save them as mp4

when i try to send to tivo i get the message below:

INFOyTivo.video.video:[28/Jun/2012 21:39:04] Queued "\\Mybooklive\public\Blu-R
ay Movies\BluRay MKVs\Sherlock Holmes A Game of Shadows (BluRay) (02).mp4" for P
ush to DVR-0B92
INFOyTivo:192.168.1.109 [28/Jun/2012 21:39:04] "POST /TivoConnect HTTP/1.0" 20
0 -
INFOyTivo:192.168.1.107 [28/Jun/2012 21:40:55] "GET /Blu-Ray/BluRay%20MKVs/She
rlock%20Holmes%20A%20Game%20of%20Shadows%20(BluRay)%20(02).mp4?Format=video%2Fmp
4 HTTP/1.1" 200 -
INFOyTivo.video.video:[28/Jun/2012 21:40:55] Start sending "\\Mybooklive\publi
c\Blu-Ray Movies\BluRay MKVs\Sherlock Holmes A Game of Shadows (BluRay) (02).mp4
" to DVR-0B92
INFOyTivo.video.video:[Errno 10054] An existing connection was forcibly closed
by the remote host
INFOyTivo.video.video:[Errno 10054] An existing connection was forcibly closed
by the remote host
INFOyTivo.video.video:[28/Jun/2012 21:40:57] Done sending "\\Mybooklive\public
\Blu-Ray Movies\BluRay MKVs\Sherlock Holmes A Game of Shadows (BluRay) (02).mp4"
to DVR-0B92, 0 bytes, 0.00 Mb/s
ERRORyTivo:Exception during request from ('192.168.1.107', 41500)
Traceback (most recent call last):
File "C:\Python27\lib\SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\PyTivo\httpserver.py", line 85, in __init__
client_address, server)
File "C:\Python27\lib\SocketServer.py", line 640, in __init__
self.finish()
File "C:\Python27\lib\SocketServer.py", line 693, in finish
self.wfile.flush()
File "C:\Python27\lib\socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 10054] An existing connection was forcibly closed by the remote ho
st


----------



## wmcbrine

techguy82 said:


> When you say "The solution is just to do a straight pull of the file from the NPL, which will force it to be transcoded to MPEG-2. This very rarely fails"
> 
> how would i do this?


The NPL is the main interface to pyTivo. All this push stuff is an add-on. Just go down to the bottom of the Now Playing list (or "My Shows" in the HDUI). You should see your share name(s) there. Select one. Pick a program. Transfer it.


----------



## lrhorer

wmcbrine said:


> It doesn't work that way.


OK.



wmcbrine said:


> This is what happens:
> 
> 1. pyTivo sees that the file has video (h.264) that is potentially TiVo-push-compatible, but is in the wrong container format (MKV). (I'll ignore audio in this discussion for simplicity.)


Of course. If it were fully compatible, ffmpeg would never get called for the transfer. It of course does get called to identify the file's attributes prior to the transfer operation.



wmcbrine said:


> 2. So, pyTivo takes the file and remuxes it to a TiVo-compatible MP4 container. This is the temporary file in question. This is only done when remuxing; transcoding does not result in a temporary file.


OK. The point is, the remux is required because, among other things, the MOOV atom is in the wrong place, right? Or not?



wmcbrine said:


> 3. pyTivo contacts the TiVo mind server to let it know there's a file available. Notice that it makes no difference how long it takes to create the temp file, because the notification doesn't occur until after it's done. Also, pyTivo never, ever makes an outgoing connection to the TiVo (except as part of the beacon system).


Well, yeah. This bit of the transaction has nothing to do with whether the file is remuxed, or not, AFAICT.



wmcbrine said:


> 5. In this case, the TiVo rejects the file. This is not unusual. We don't know all the limits on what types of h.264 the TiVo will accept, and to be honest we don't even test for all the ones we do know.
> 
> The solution is just to do a straight pull of the file from the NPL which will force it to be transcoded to MPEG-2. This very rarely fails.


Well, yes, except with that processor, the full recode to MPEG-II is liable to take quite a while, I think. Yes? I've never actually done a recode from h.264 to MPEG-II, but I did quite a large number of recodes from MPEG-II on a similar processor, and it took hours to recode a single movie. Even with a 3.0GHz, 6 core monster, it doesn't happen in real time. OTOH, perhaps recoding from h.264 to MPEG-II doesn't take as many resources. I don't really know for sure.



wmcbrine said:


> Alternatively, you can of course try reencoding it to h.264 (again) on your own, and re-pushing it, but that seems to me like a lot of work


Not so much. I've done thousands of recodes from MPEG-II to h.264 in .mp4. I just select a couple of hundred video files, start the VRD batch manager, and walk away. A week or so later, it's done. 'No trouble, at all, really.



wmcbrine said:


> for an uncertain outcome.


Howso? As I said, I've done a couple of thousand of them, and I continue to do three or four a day using VRD. I've never had one fail.



wmcbrine said:


> No. pyTivo passes MP4 files through "qt-faststart" as it sends them, which moves the MOOV atom to the front. This is also why the MP4 remux creates a temp file -- because it's impossible to create the MOOV atom until the file is done, the MP4 can't be streamed as it's created, unlike the MPEG-2 program streams pyTivo creates.


Yeah, I thought I said that. Not in such detail, of course, but the point was the entire file has to be muxed in a temp file, the MOOV atom re-created, and then the entire thing has to be spooled back from the temp file to the final file, starting with the MOOV atom, because the TiVo won't accept a file with the MOOV atom at the end. Any edit to an H.264 file, BTW, requires the MOOV atom to be re-created, which means the temp file creation followed by a copy.


----------



## lrhorer

wmcbrine said:


> * Also, it's still barely legible.


Amen.



wmcbrine said:


> You should stop resizing them, and use PNG compression instead of JPG. (Of course for something like this, it would be even better to just copy and paste it as text.)


Or better yet, redirect stdout and stderr to a log file.


----------



## wmcbrine

lrhorer said:


> OK. The point is, the remux is required because, among other things, the MOOV atom is in the wrong place, right? Or not?


No. It has nothing at all to do with the MOOV atom. MOOV atoms don't even exist in MKV containers, only in MP4 and MOV containers (MP4 is a variant of MOV). The MOOV problem is fully handled by qt-faststart. It does not enter into remuxing, and ffmpeg is not involved.


----------



## lrhorer

techguy82 said:


> i used makemkv for blu-ray to make these files into mkv. then used videredo to save them as mp4


What profile are you using? It should be h.264 in a .mp4 container:



















Or in the batch manager:












techguy82 said:


> when i try to send to tivo i get the message below:
> 
> INFOyTivo.video.video:[28/Jun/2012 21:39:04] Queued "\\Mybooklive\public\Blu-R
> ay Movies\BluRay MKVs\Sherlock Holmes A Game of Shadows (BluRay) (02).mp4" for P
> ush to DVR-0B92
> INFOyTivo:192.168.1.109 [28/Jun/2012 21:39:04] "POST /TivoConnect HTTP/1.0" 20
> 0 -
> INFOyTivo:192.168.1.107 [28/Jun/2012 21:40:55] "GET /Blu-Ray/BluRay%20MKVs/She
> rlock%20Holmes%20A%20Game%20of%20Shadows%20(BluRay)%20(02).mp4?Format=video%2Fmp
> 4 HTTP/1.1" 200 -


Please use code tags around such dumps so instead of looking like the above, they look like:



Code:


INFO:pyTivo.video.video:[28/Jun/2012 21:39:04] Queued "\\Mybooklive\public\Blu-Ray Movies\BluRay MKVs\Sherlock Holmes A Game of Shadows (BluRay) (02).mp4" for Push to DVR-0B92
INFO:pyTivo:192.168.1.109 [28/Jun/2012 21:39:04] "POST /TivoConnect HTTP/1.0" 200 -
INFO:pyTivo:192.168.1.107 [28/Jun/2012 21:40:55] "GET /Blu-Ray/BluRay%20MKVs/Sherlock%20Holmes%20A%20Game%20of%20Shadows%20(BluRay)%20(02).mp4?Format=video%2Fmp4 HTTP/1.1" 200 -


----------



## lrhorer

wmcbrine said:


> No. It has nothing at all to do with the MOOV atom. MOOV atoms don't even exist in MKV containers, only in MP4 and MOV containers (MP4 is a variant of MOV). The MOOV problem is fully handled by qt-faststart. It does not enter into remuxing, and ffmpeg is not involved.


Oh, OK. I thought MKV was also a variant of MOV. Obviously I don't know much about the MKV container, but that is not surprising since I have never dealt with an MKV container.


----------



## lrhorer

wmcbrine said:


> The NPL is the main interface to pyTivo. All this push stuff is an add-on.


Well, this is the vidmgr thread.



wmcbrine said:


> Just go down to the bottom of the Now Playing list (or "My Shows" in the HDUI).


Hmm. Are you saying on your Premier, the list is still named NPL in the SDUI? On the CATV leased Premier my new CATV provider just gave me, it is "My Shows" in both the SDUI and the HDUI.



wmcbrine said:


> You should see your share name(s) there. Select one. Pick a program. Transfer it.


Perhaps a little clarification is in order.

If one is going to recode, anyway, and one is going to mostly pull videos from the server using the NPL / My Shows screen, it may well be best to code the videos as MPEG-II (.mpg). This will result in the fastest transcode or no recode at all when transferring using the pull method. If one intends to transfer using primarily a push method, either from the pyTivo web interface or via vidmgr (or via any other method - I often use curl), then MPEG-II is still a fairly good choice for many situations.

The other good choice is to recode to h.264 in a .mp4 container. There are a few disadvantages, especially if the audio is not AC3, or especially if the user chooses to transfer via pull. AAC audio cannot be handled properly by the TiVo, and a pull cannot handle h.264, necessitating a recode by pyTivo via ffmpeg, which rather defeats the main purpose of recoding to h.264 in the first place.

Bearing those caveats in mind, h.264 coding is more compact than MPEG-II coding for the same PQ. In the case of the default h.264 profiles in VRD, smaller by about 30%. That means one can store almost 1/3 more video in the same space if one employs h.264 coding. Not only that, but h.264 files pushed to the TiVo transfer much, much faster than MPEG-II files. On the Premier, almost a factor of 2, or roughly 15X real-time for 1080i content. On the S3, a factor of more than 3, especially with 720p content. On the THD it transfers beter than 4 times faster than the same 720p content coded as MPEG-II.


----------



## markmarz

lrhorer said:


> I suggest you try this: ...


Sorry, didn't see your response till just now. Thought I had monitoring on this thread ..

Anyway, I wound up reinstalling Debian on my server for a completely unrelated set of reasons. Now this strangeness has disappeared. But thanks the same!


----------



## markmarz

lrhorer said:


> Bearing those caveats in mind, h.264 coding is more compact than MPEG-II coding for the same PQ. In the case of the default h.264 profiles in VRD, smaller by about 30%.


Just one question about this .. if it needs more than one reply, I'll open a new thread in some other forum. If you're not using the default h.264 profile .. and maybe you are .. could you share your tweaked profile here? There's a million opinions in a thousand thickets and brambles. Yours I value from experience.

This is tangentially related to the thread, since it's in the context of fast pushes via vidmgr. But I won't press that.


----------



## lrhorer

markmarz said:


> Sorry, didn't see your response till just now. Thought I had monitoring on this thread ..
> 
> Anyway, I wound up reinstalling Debian on my server for a completely unrelated set of reasons. Now this strangeness has disappeared. But thanks the same!


It is very rare that a Linux system ever actually requires a full re-install. Finding and stamping out problems is a breeze compared with certain other operating systems. In the worst case, one can do a distro download to a temporary directory and pick out files to overwrite the damaged area(s), even if the damage is to the kernel. This allows one to keep one's configurations and all installed applications without having to re-install or re-configure everything. More often than not, however, one can simply fix a config file, a damaged script, or simply issue an apt-get remove xxxx followed by an apt-get install xxxx. For Debian based distros, that is. Red Hat based distros are a little bit different, but a similar approach applies.



markmarz said:


> Just one question about this .. if it needs more than one reply, I'll open a new thread in some other forum.


Actually, I think maybe I will start a Linux support thread over in the main Home Media / TTG forum. The number of Linux users is not vast, but the topics are detailed enough to warrant it, I think.



markmarz said:


> If you're not using the default h.264 profile .. and maybe you are .. could you share your tweaked profile here?


Well, there is more than one h.264 profile. You want the h.264 - MP4 profile as you can see here

As far as tweaks are concerned, I only implemented a small handful. I don't recall if the "Move MOOV atom to start of file" check box was checked by default, or not, but if not, it definitely needs to be checked. This slows down processing a huge amount, but it is absolutely necessary for natively pushing to a TiVo.

The second was the "MP4 temporary file location override". This is not essential, but it recovers some of the speed lost by forcing the MOOV atom to be written to the beginning of the file if one points this to a directory on the local hard drive when the target file is on the LAN, assuming you have a fairly decent local hard drive. This is under Tools => Options => H.264 Options.

Under Manual Parameter Setings ( Tools => <Shift>+Options ), I did change the default log file viewer (because I detest notepad.exe).

Also, I have found every once in a while VRD has problems with files that have errors in them (especially when pulled from a TiVo), and while Quick Stream Fix can take care of them, certain errors will not be caught if one leaves the "Ignore transport stream maps" check box checked, so I un-checked it. Note this should not be required if one is re-coding a raw file to h.264, but I always edit the files before re-coding them, and VRD occasionally chokes on a file unless I run QSF on it, first. In these cases, I run QSF and it invariably alleviates the issue, but again only if the default of ignoring the stream maps is disabled.


----------



## markmarz

lrhorer said:


> Actually, I think maybe I will start a Linux support thread over in the main Home Media / TTG forum. The number of Linux users is not vast, but the topics are detailed enough to warrant it, I think.


That's great! Looking forward to it.

And thanks for the h.264 info, very helpful.


----------



## djl25

Hi all - I know I'm missing something obvious, but I cannot get vidmgr to run on my TivoHD. Using Version 0.7c with hme-python-0.20, I get:


Code:


192.168.1.15:35925 - - [26/Jun/2013 10:54:47] code 403, message Forbidden
192.168.1.15:35925 - - [26/Jun/2013 10:54:47] "GET /picture/icon.png HTTP/1.0" 4
03 -

The picture viewer app runs fine, btw. How do I go about troubleshooting this?


----------

