Opened 13 years ago

Closed 12 years ago

#2363 closed enhancement (fixed)

new contrib script: validate recorded db table versus files stored in recording directories

Reported by: ltd@… Owned by: Robert Kulagowski
Priority: minor Milestone: 0.21
Component: mythtv Version:
Severity: low Keywords:
Cc: Ticket locked: no

Description

The attached script is intended to be part of the contrib/ directory scripts.

The intent of this script is to be able to find orphaned rows in the 'recorded' table (entries which don't have matching files). Likewise it is useful to find orphaned files (potentially taking up gigabytes of otherwise usable space) which have no matching row in the 'recorded' db table.

By default, running the script will simply return a list of problems it finds. Running with --dodbdelete will remove db recorded rows for which there is no matching media file. running with --dodelete will delete media files for which there is no matching db record.

I found this useful to fix up some orphaned db entries (causes mythweb to run verrry slow) as well as reclaim some disk space from some orphaned media files. (not sure what caused these yet, am going to see if they keep recurring)

Attachments (4)

check_recordings.pl (6.1 KB) - added by ltd@… 13 years ago.
contrib/check_recordings.pl
check_recordings.2.pl (7.2 KB) - added by ltd@… 13 years ago.
contrib/check_recordings.pl #2
check_recordings.3.pl (7.2 KB) - added by ltd@… 13 years ago.
contrib/check_recordings.pl take 3
check_recordings.4.pl (7.5 KB) - added by ltd@… 12 years ago.
updated version that handles storage groups

Download all attachments as: .zip

Change History (13)

Changed 13 years ago by ltd@…

Attachment: check_recordings.pl added

contrib/check_recordings.pl

comment:1 Changed 13 years ago by anonymous

Severity: mediumlow

comment:2 Changed 13 years ago by Robert Kulagowski

You may want to include some descriptive text about what "unknown", "valid recording", etc, means because while the descriptive text in this ticket is fine, the program needs to stand alone if it's in contrib/

Also, did you add whitespace on purpose around the following?

...35 unknown files using 27.8GB not fixed, check ...

There's extra spaces infront/behind "27.8GB"

comment:3 Changed 13 years ago by Robert Kulagowski

Owner: changed from Isaac Richards to Robert Kulagowski

comment:4 Changed 13 years ago by ltd@…

agree on comments for what the script does. have added that now. whitespace was just cosmetic (provided better output for list-of-filenames). but i digress, have removed the whitespace.

revised version of script attached (rev 0.20). so you had some orphaned media files & recorded rows also. :)

Changed 13 years ago by ltd@…

Attachment: check_recordings.2.pl added

contrib/check_recordings.pl #2

Changed 13 years ago by ltd@…

Attachment: check_recordings.3.pl added

contrib/check_recordings.pl take 3

comment:5 Changed 13 years ago by Robert Kulagowski

The status line is very very long and breaks across the right margin; if you can get it to wrap at 72 characters I'll upload it to contrib.

Create a README as well.

comment:6 Changed 13 years ago by anonymous

if a transcode is in progress (so there is a CHAN_YYYYMMDDHHMMSS.fmt.tmp) it sees the .tmp as "unknown file" and if --dodelete was enabled would that cause it to delete it? or is unknown different from orphaned files?

comment:7 Changed 13 years ago by Robert Kulagowski

Status: newassigned

comment:8 Changed 12 years ago by casey dunn

Type: defectenhancement

Does not play nice with storage groups. It doens't find any folders when run without --dirs=. All storage locations need to be specified manualy at the command line.

.png thumbs from mythweb are flagged as unknown files. line 161 cold be? next if ($this_file =~ m/.png/);

I have not checked but, does --dodelete delete w/ rerecord?

Very well done, it'll get a lot of use here.

Changed 12 years ago by ltd@…

Attachment: check_recordings.4.pl added

updated version that handles storage groups

comment:9 Changed 12 years ago by Robert Kulagowski

Resolution: fixed
Status: assignedclosed

(In [13018]) Lincoln Dale's check_recordings script. Based on check_recordings.4.pl

Broke out orphaned thumbnails, changed name of script, updated help text to reflect program names.

Closes #2363.

Note: See TracTickets for help on using tickets.