[mythtv-users] Script to check recording files?

Matt MacDonald macdonald.matthew at gmail.com
Sat Feb 9 15:38:58 UTC 2008


How about something simple like:


#!/usr/bin/perl

  use strict;
  use DBI();
  my $path = "/var/lib/mythtv/recordings/";
  my $username = "mythtv";
  my $password = "";
  my @files;
  my @recorded;
  my $line;
  # Connect to the database.
  my $dbh = DBI->connect("DBI:mysql:database=mythconverg;host=localhost",
                         $username, $password,
                         {'RaiseError' => 1});


  # Now retrieve data from the table.
  my $sth = $dbh->prepare("SELECT basename FROM recorded");
  $sth->execute();

  while (my $ref = $sth->fetchrow_hashref()) {
    push (@recorded, $ref->{'basename'});
  }
  $sth->finish();

  # Disconnect from the database.

# Get listings from $path
@files = `ls $path | grep -v .png | grep -v .lock`;
foreach $line (@files) {
  chomp $line;
  print "$line\n" unless (grep (/$line/, @recorded));
}


On Feb 9, 2008 1:11 AM, Michael T. Dean <mtdean at thirdcontact.com> wrote:

> On 02/08/2008 07:15 PM, Mike Smith wrote:
> >> You could use myth.rebuilddatabase.pl to identify files that aren't in
> >> the DB.  Whether it will still work to put them there is another
> >> question, though.  I'd copy the filename it mentions, then tell it to
> >> ignore the files.
> > find_orphans is apparently what I used last time, but the only version I
> can
> > find now is updated to work with storage groups and doesn't work on 0.20
> .
> > Anyone out there have an older version?
>
> Did you try running myth.rebuilddatabase.pl?
>
> Mike
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20080209/297f73de/attachment.htm 


More information about the mythtv-users mailing list