Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I'll have to see how good the Mac port of the commercial skipping portions are.

I've been running my own version of this task as a cron job. I haven't cleaned it up to do anything but exactly what I want it to do, but here it is. There are a few things on my to do list, too

  • Figure out when tivodecode is done and launch ffmpeg to convert it to another format
  • Now see if I can figure out this commercial skipping stuff :)
#!/usr/bin/perl use strict; use warnings; use DBM::Deep; use Net::TiVo; my $mak = '...'; my $tivo = Net::TiVo->new( host => '10.0.1.9', mac => $mak, ); my $ua = make_ua(); chdir( "...." ); my $db = DBM::Deep->new( '....' ); for my $folder ( $tivo->folders ) { print "Folder: ", $folder->as_string, "\n"; foreach my $show ( $folder->shows ) { next unless $show->name =~ /..../i; if( exists $db->{ $show->program_id } ) { print "Skipping '" , $show->episode, "'\n"; next; } print show_summary( $show ); fetch_show( $ua, $show ); $db->{ $show->program_id }++; } } sub make_ua { require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->credentials( '10.0.1.9:443', "TiVo DVR", "tivo", $mak ); $ua->credentials( '10.0.1.9:80', "TiVo DVR", "tivo", $mak ); $ua->cookie_jar( {} ); return $ua; } sub fetch_show { my( $ua, $show ) = @_; my $url = $show->url . "&Format=video/x-tivo-mpeg"; my $file = $show->episode . ".TiVo"; print STDERR "My file is $file\n"; my $start = time; my $response = $ua->get( $url, #":content_cb" => sub { my($d, $r, $p ) = @_; print Dumper( $d +, $r->as_string) }, ":content_file" => $file, ); my $end = time; next unless -e $file; my $diff = $end - $start; print STDERR "Download time was $diff seconds: ", $show->size / $diff, " bytes/s\n"; unless( -s $file != $show->size ) { print STDERR "$file does not have the right size"; unlink $file; return; } tivo_decode( $file ); } sub show_summary { my $show = shift; my $string; $string = "\t" . $show->name . "\n"; $string .= "\t" . $show->url . "\n"; $string .= "\tprogram: " . $show->program_id . "\n"; $string .= "\tepisode: " . $show->episode . "\n"; $string .= "\tseries: ". $show->series_id . "\n"; $string .= "\tsize: ". $show->size . "\n"; $string .= "\n"; return $string; } sub tivo_decode { my $file = shift; ( my $output = $file ) =~ s/\.TiVo$/.mpeg/; unless( my $pid = fork ) { #child print "Exec-ing tivodecode\n"; exec qq|/usr/local/bin/tivodecode -m $mak -o "$output" "$file +"|; die "Could not exec tivodecode!"; } else { #parent return; } }
--
brian d foy <brian@stonehenge.com>
Subscribe to The Perl Review

In reply to Re: Perl app to decrypt and remove commercials from TiVo recordings. by brian_d_foy
in thread Perl app to decrypt and remove commercials from TiVo recordings. by marto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-24 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found