Ticket #3641: myth.find_orphans-patch.new

File myth.find_orphans-patch.new, 887 bytes (added by mythtv@…, 16 years ago)

Revised patch using regex for .png files and also excluding sql backups

Line 
1--- myth.find_orphans.pl 2010-03-17 12:18:35.199570862 -0400
2+++ myth.find_orphans.pl.new 2010-03-17 12:17:56.451571941 -0400
3@@ -175,7 +175,6 @@
4 } else {
5 $valid_recordings++;
6 $seen_basename{$basename}++;
7- $seen_basename{$basename.".png"}++; # thumbnail
8 }
9 }
10
11@@ -191,7 +190,10 @@
12 next if ($this_file eq "nfslockfile.lock");
13
14 my $this_filesize = -s "$this_dir/$this_file";
15- if ($seen_basename{$this_file} == 0) {
16+ $this_file =~ /(.*?)((\.[0-9]+(\.[0-9]+x[0-9]+)?)?\.png)?$/;
17+ # Strips off allowable thumbnail suffixes to get basename
18+ if ($seen_basename{$1} == 0 &&
19+ $this_file !~ /mythconverg-[0-9]+-[0-9]{14}\.sql\.gz/) {
20 $sorted_filesizes{$this_filesize} .= sprintf "unknown file [%s]: %s/%s\n",pretty_filesize($this_filesize),$this_dir,$this_file;
21 $unknown_size += $this_filesize;
22 if (substr($this_file,-4) eq ".png") {