Ticket #5420: myth.find_orphans.pl.patch

File myth.find_orphans.pl.patch, 1.4 KB (added by junk@…, 12 years ago)

Patch for mythtv/contrib/myth.find_orphans.pl

  • mythtv/contrib/myth.find_orphans.pl

    old new  
    122122# look in recorded table, make sure we can find every file ..
    123123#
    124124
    125 my $q = "SELECT title, subtitle, starttime, endtime, chanid, basename FROM recorded WHERE hostname=(?) ORDER BY starttime";
     125my $q = "SELECT title, subtitle, description, starttime, endtime, chanid, basename FROM recorded WHERE hostname=(?) ORDER BY starttime";
    126126$sth = $dbh->prepare($q);
    127127$sth->execute($opt_host) || die "Could not execute ($q): $!\n";
    128128
    129129while (my @row=$sth->fetchrow_array) {
    130         ($title, $subtitle, $starttime, $endtime, $channel, $basename) = @row;
     130        ($title, $subtitle, $description ,$starttime, $endtime, $channel, $basename) = @row;
    131131
    132132        # see if we can find it...
    133133        $loc = find_file($basename);
     
    136136                $missing_recordings++;
    137137
    138138                if ($opt_dodbdelete) {
     139                        my $sql = sprintf "DELETE FROM oldrecorded WHERE title LIKE \"%s\" AND subtitle LIKE \"%s\" AND description LIKE \"%s\" LIMIT 1", $title, $subtitle, $description;
     140                        printf "unmarking program as recorded: %s\n",$sql;
     141                        $dbh->do($sql) || die "Could not execute $sql: $!\n";
    139142                        my $sql = sprintf "DELETE FROM recorded WHERE basename LIKE \"%s\" LIMIT 1",$basename;
    140143                        printf "performing database delete: %s\n",$sql;
    141144                        $dbh->do($sql) || die "Could not execute $sql: $!\n";