Ticket #1046: mythrename-live.diff

File mythrename-live.diff, 1.6 KB (added by tom@…, 14 years ago)
  • mythtv/contrib/mythrename.pl

     
    2222    use File::Path;
    2323
    2424# Some variables we'll use here
    25     our ($dest, $format, $usage, $underscores);
     25    our ($dest, $format, $usage, $underscores, $live);
    2626    our ($dformat, $dseparator, $dreplacement, $separator, $replacement);
    2727    our ($db_host, $db_user, $db_name, $db_pass, $video_dir, $verbose);
    2828    our ($hostname, $dbh, $sh, $sh2, $q, $q2, $count);
     
    4242# Load the cli options
    4343    GetOptions('link|dest|destination|path:s' => \$dest,
    4444               'format=s'                     => \$format,
     45               'live'                         => \$live,
    4546               'separator=s'                  => \$separator,
    4647               'replacement=s'                => \$replacement,
    4748               'usage|help|h'                 => \$usage,
     
    6566
    6667    /var/video/show_names/
    6768
     69--live
     70
     71    Include live tv recordings, affects both linking and renaming. This assumes
     72    that recgroup = "LiveTV" for live tv recordings.
     73
     74    default: do not link/rename live tv recordings
     75
    6876--format
    6977
    7078    default:  $dformat
     
    239247    }
    240248
    241249# Prepare a database queries
    242     $q  = 'SELECT * FROM recorded';
     250    if (defined($live)) {
     251        $q  = 'SELECT * FROM recorded';
     252    } else {
     253        $q  = 'SELECT * FROM recorded where recgroup != "LiveTV"';
     254    }
    243255    $sh  = $dbh->prepare($q);
    244256    $sh->execute() or die "Couldn't execute $q:  $!\n";
    245257