[mythtv] Database schema checker
Otto Kolsi
otto at kolsi.fi
Sun Aug 31 10:07:48 UTC 2008
ian dobson wrote:
>> But in addition to this, there are still couple of entries in DB that do
>> not have any corresponding file in filesystem and the script does not
>> seem to be able find them.
>
> Can you provide me with abit more info? the values from the recorded DB
> should be enough.
Here is quick and dirty patch that reveals those entries in DB that do
not have corresponding file:
--- CheckMythDB.pl.orig 2008-08-31 12:58:06.000000000 +0300
+++ CheckMythDB.pl 2008-08-31 12:55:27.000000000 +0300
@@ -280,9 +280,14 @@
if ($StorageCount eq 0) {
MyPrint (2,$bad.".No storage groups defined, cannot run FS
check\n");
} else {
- @result=SQLQuery("SELECT
chanid,starttime,basename,storagegroup,title FROM recorded ");
+ @result=SQLQuery("SELECT
chanid,starttime,basename,storagegroup,title,dirname FROM recorded LEFT
JOIN storagegroup on recorded.storagegroup=storagegroup.groupname;");
for my $XXX (@result){
+ #Check if file for recording exists
+ if (! -e @$XXX[5].@$XXX[2] ) {
+ MyPrint(2,$bad."File for recording " . @$XXX[4] . "
does not exist!\n");
+ }
+
#Check recordings against seek list
$Result1=SQLQuerySimple("SELECT count(*) FROM recordedseek
WHERE chanid=" . @$XXX[0] . " and starttime = '" . @$XXX[1] . "'" );
if ($Result1 gt 0) {
>> And to go one step further.. for some reason there are several programs
>> in LiveTV group that have all the FS<->DB info correct, but are too old.
>> So these have not been cleaned out after 1 day, but are e.g. 6-12 months
>> old. This is also a case where some info would be nice from the script.
>
> OK when I get the chance I'll have a look at adding an age warning if a
> liveTV recording is older than X days.
Just realized that those 'old' files in my LiveTV storagegroup are
probably ones that I've started to watch as a live-tv, then in the
middle chose to record them permanently and then afterwards deleted. So
they belong to Deleted recgroup, LiveTV storagegroup and will be
autoexpired correctly later on, I think.
Not sure if "older than X days" LiveTV checking should skip files
belonging to Deleted recgroup..?
--
Otto
More information about the mythtv-dev
mailing list