mytivo.pl - Command to fetch TiVo files

Download this program

SYNOPSIS

mytivo.pl list all

mytivo.pl list folders Now Playing [11] The Daily Show With Jon Stewart [2] Major Crimes [2] Masterpiece Classic [5] Masterpiece Mystery! [3] WASHINGTON, DENZEL & Movies [1]

mytivo.pl -folder Maj list shows Title: Major Crimes Episode: Cheaters Never Prosper Description: A man is found ... Size: 1.55 GB (1663041536) ID: EP014328840009 url: http://192.168.?.???:80/download/Major%20Crimes.TiV... Title: Major Crimes Episode: Dismissed With Prejudice Description: Tao questions his ... Size: 1.58 GB (1698693120) [60 min] ID: EP014328840008 url: http://192.168.?.???:80/download/Major%20Crimes.TiV...

mytivo.pl -show Riga list show Title: Masterpiece Mystery! Episode: Wallander Series III: The Dogs of Riga Description: Wallander assists ... Size: 2.04 GB (2187329536) [60 min] ID: EP010883310069 url: http://192.168.?.???:80/download/Major%20Crimes.TiV...

mytivo.pl fetch EP010883310069 Fetching the following show: Title: Masterpiece Mystery! Episode: Wallander Series III: The Dogs of Riga Description: Wallander assists ... Size: 2.04 GB (2187329536) [60 min] ID: EP010883310069 url: http://192.168.?.???:80/download/Major%20Crimes.TiV... Saving show as 'Wallander_Series_III:_The_Dogs_of_Riga.mpg' ... Succesful fetch of file 'Wallander_Series_III:_The_Dogs_of_Riga.mpg' ... Decoding TiVo file 'Wallander_Series_III:_The_Dogs_of_Riga.mpg' Decoded mpg2 file 'Wallander_Series_III:_The_Dogs_of_Riga.mpg' created Converting MPEG2 file 'Wallander_Series_III:_The_Dogs_of_Riga.mpg' to MP4 ... MP4 file 'Wallander_Series_III:_The_Dogs_of_Riga.mpg' created (7.3 min)

mytivo.pl -folder Call fetch all Fetching the following show: Title: Call the Midwife Episode: [# 104] Description: The search for a missing ... Size: 1.26 GB (1351614464) [60 min] ID: EP015685700004 url: http://192.168.0.???:80/download/Call... Saving show as 'Call_the_Midwife_104.mpg' ... Succesful fetch of file 'Call_the_Midwife_104.mpg' ... Decoding TiVo file 'Call_the_Midwife_104.mpg' Decoded mpg2 file 'Call_the_Midwife_104.mpg' created Converting MPEG2 file 'Call_the_Midwife_104.mpg' to MP4 ... MP4 file 'Call_the_Midwife_104.mpg' created (5.3 min)

  [multiple sets repeated]


DESCRIPTION

This program provides a convenient tool to fetch data from a TiVo. It has only been tested on a Series 2 TiVo. If you find problems (or better yet have solutions), the author would be interested in hearing from you.

This script may be combined with other shell scripts to automate fetching recordings from your TiVo. For instance you might write a script to search for your favorite TV show each night and then convert it into an MP4 file for use in another environment. mytivo.pl is only intended to help you find what is waiting on the TiVo and fetch it. It is not a complete all-singing, all-dancing tool for whatever you might dream up. It just does the difficult work of communicating with the TiVo and possibly converting your video to a more useful format.

This script makes no attempt to verify certificates when communicating with the TiVo.


FILES

This program can read the Tivo hostname (IP address) and the MAK value from the file ~/.mytivo. This file must consist of one line where the first word is the MAK value and the second is the IP/hostname.


OPTIONS

-clearcache

Specify this flag to clear the cache files. This might be necessary if data on the TiVo changes while you are using this script to query and fetch data. Specifiying this flag will slow down the execution of the script but will insure you see the most recent data. Under normal conditions you should not need this.

-cookiehack

Specify this flag to work around a TiVo bug that uses an expired cookie. Details can be read about at http://www.tivocommunity.com/tivo-vb/showthread.php?p=9526368

-folder regexp

Specifies a regular expression to match for one or more particular TiVo folders. Many times you can just get away with part of the folder name (e.g. Stewart, not 'John Stewart'). This is used to restrict the information returned by the list command.

-host IP_or_hostname

Specifies the hostname or IP address of the TiVo device. For convenience you might want to change the value in %opts. Alternatively, you can specify the MAK value in the dotfile ~/.mytivo.

-help

Generates this output.

-id name

Specifies a particular TiVo unique identifier. You can get name from the output of the list command.

-mak tivoMAK

Specifies the MAK of the TiVo device. For convenience you might want to change the value in %opts. Alternatively, you can specify the MAK value in the dotfile ~/.mytivo.

-nofork

Requests that HandBrake not be forked to run concurrently while the next fetch is done. The default is to fork the invocation of handbrake. The last file that is fetched will not be forked (-nofork will be forced).

Forking has a couple of side effects you may want to avoid: First, there is no real error detection running handbrake. Secondly, when handbrake is run separately, the input file from Tivo is not deleted, so you have more to cleanup. Lastly, it's always possible you could have multiple invocations of handbrake running which could bog down your machine.

-nomp4

Requests that HandBrake not be invoked to convert the MPEG 2 file to and MPEG 4 file. The default action is to create an MP4 file. Be warned: this will likely take quite some time and fully load your machine. If the conversion is successful the original TiVo and MPEG 2 files are deleted. This only applies when -nodecode is not specified and when fetch is used.

-ofile path

Specifies the name of the file to be created when fetch is used, e.g. glee_episode_1.mpg. If you do not specify this, the script will choose a filename based on the folder or episode names used on the TiVo.

-preset name

Specifies the HandBrake preset name to be used. This defaults to Normal. You can see all the HandBrake presets with the command HandBrakeCLI --preset-list. This only applies when -mp4 is specified.

-nodecode

Specify this if you do not want the encrypted file from the TiVo to be converted into a simple MPEG2 file. By default if the tivodecode binary can be found on your PATH, your TiVo show will be converted to a useful MPEG 2 file. If the conversion is successful the original TiVo file is deleted.

-replace

Specify this if want to replace the output file (see -ofile) created when fetch is used.

-show regexp

Specifies a regular expression to match when specifying a particular TiVo show episode name. Many times you can just get away with part of the show name (e.g. Prejudice, not 'Dismissed With Prejudice'). This is used to restrict the information returned by the list command.

-usefile path

Specifies that the TiVo data should be retrieved from a particular file. This is useful in developing the program.

-verbose

Specifies that additional informaiton be generated.


PARAMETERS

fetch id

Retreives a video file from the TiVo. If id is all and if -folder is provided, all shows in the folder will be fetched. Unless -nodecode is specified, the file will be converted to MPEG 2 format. You can get the id value from the output of list show.

list all

Generates a set of details for all shows in all folders.

list folder

Generates a list of all folders.

list show

Generates a set of details for a set of shows. You must specify -folder, -show or -id.


EXIT

If no fatal errors are detected, the program exits with a return code of 0. Any error will set a non-zero return code.


AUTHOR

Written by Terry Gliedt <tpg@hps.com> in 2012 and is made available under terms of the GNU General Public License.