#!/usr/bin/perl # the IP address of your TiVO (must be running tyserver) $tivoAddress = "10.1.2.3"; # database settings $dbhost = "localhost"; $dbname = "tivo2podcast"; $dbuser = "tivo2podcast"; $dbpass = "password"; # the path where tyls, tyget, tydemux, mplex and ffmpeg live $tyls = "/usr/local/bin/tyls"; $tyget = "/usr/local/bin/tyget"; $tydemux = "/usr/local/bin/tydemux"; $mplex = "/usr/local/bin/mplex"; $ffmpeg = "/usr/local/bin/ffmpeg"; ######################################################################### @shows = qx{$tyls -t $tivoAddress}; $count = 0; foreach $show ( @shows ) { $count ++; ( $program, $episode, $day, $date, $time, $fsid ) = split /\t/, $show; print "$count\t$day $date $time - $program"; if ( $episode ne "not a episode" ) { print " - $episode"; } print "\n"; } print "\nGive me a show number: "; $number = ; $number --; $show = $shows[$number]; ( $program, $episode, $day, $date, $time, $fsid ) = split /\t/, $show; print "Getting $day $date $time - $program"; if ( $episode ne "not a episode" ) { print " - $episode"; } print ", please be patient...\n"; print "$tyget -t $tivoAddress -o file.ty -f $fsid\n"; qx{$tyget -t $tivoAddress -o file.ty -f $fsid}; print "$tydemux -s 2 -i file.ty -a file.audio -v file.video\n"; $output = qx{$tydemux -s 2 -i file.ty -a file.audio -v file.video}; $output =~ /V Sync Offset: (\d+)ms/; $syncOffset = $1; if ( $syncOffset eq "" ) { $syncOffset = 0; } print "$mplex -o file.mpg -f 3 -b 300 -O -$syncOffset -V file.audio file.video\n"; qx{$mplex -o file.mpg -f 3 -b 300 -O -$syncOffset -V file.audio file.video}; print "$ffmpeg -threads 4 -i file.mpg -s 320x240 -r 23.98 -pix_fmt yuv420p -vcodec xvid -deinterlace -g 300 -qmin 5 -b 1200 -async 1 -acodec aac file.mp4\n"; qx{$ffmpeg -threads 4 -i file.mpg -s 320x240 -r 23.98 -pix_fmt yuv420p -vcodec xvid -deinterlace -g 300 -qmin 5 -b 1200 -async 1 -acodec aac file.mp4}; if ( -e "file.mp4" ) { print "looks like it worked. You might want to delete the work files in this directory.\n" }