#!/usr/bin/perl -w # # Retrieves previews for MythTV recordings # # Includes use Getopt::Long; use MythTV; # Some variables we'll use here our ($dformat, $usage); # Default format of URL $dformat='http://{HOST}:6544/Myth/GetPreviewImage?ChanId=%c&StartTime=%Y-%m-%dT%H:%i:%s&Height=100&Width=0&SecsIn=155'; # Provide default values for GetOptions $format = $dformat; # Load the cli options GetOptions('format=s' => \$format, 'usage|help' => \$usage ); # Print usage if ($usage) { print <backend_rows('QUERY_RECORDINGS Delete'); our $show; foreach my $row (@{$rows{'rows'}}) { $show = new MythTV::Program(@$row); get_preview(); sleep 5; } # Get the preview sub get_preview { my $text = $show->format_name($format, ' ', ' ', 1, 0 , 1); $text =~ s/{HOST}/$show->{'hostname'}/g; my $filename = $show->format_name('%c_%Y%m%d%H%i%s', '-', '-', 1, 0 , 0); print("Requesting: $text\n"); system("wget \'$text\' -O \'$filename.png\'\n"); }