[mythtv-users] mythfilldatabase wrapper to fix dupe detection errors

chris at cpr.homelinux.net chris at cpr.homelinux.net
Sat Sep 16 02:49:07 UTC 2006


I've been complaining on here now and then about the fact that 
MythTV often gets the dupe detection wrong, at least in my opinion.

The two things that were bothering me are:

(1) If a program has no subtitle then Myth would record every 
episode even if I had enabled duplicate detection.  Dean said it 
was a "feature" that would prevent me from missing epsiodes if 
Zap2It somehow didn't know what show was on.  Never mind that it 
will record the same episode 5 times in one day and block all the 
lower-priority shows, and in almost every case that I've seen, 
Zap2It knew *exactly* what show was on, as evidenced by the 
"originalairdate" value that was different each time.

(2) In cases where an episode is presented in multiple parts, 0.19 
will still miss the second and subsequent part if the subtitles are 
the same (even though the "originalairdate" values are different).  
I was wondering why Space would show one episode of "The 4400" at 
the beginning of the season with no follow-up, and only just 
realized that since it was a two-parter Myth had decided that I've 
already seen the second part even though the originalairdate is 
still in the future.

In order to regain some sanity in the dupe department, I have 
modified my settings so that instead of just running 
"mythfilldatabase", the backend calls "/usr/bin/mythfilldatabase.sh 
--max-days 12" (because some channels don't provide 14 days of 
listings and Myth won't fill in the gaps when days have partial 
data).  The bash script does the actual download and then runs a 
MySQL script to patch up the tables.  The patch consists of 
appending the originalairdate (or starttime, if originalairdate 
isn't available) to the subtitle field.  I moved the original 
mythfilldatabase to mythfilldatabase.real to prevent it from being 
run without the SQL fixes.

What's really great about this (aside from the fact that Myth 
actually records both parts of two-part shows and skips episodes 
I've already seen a dozen times) is that when I look at the 
listings in MythWeb, having the original date in the subtitle (as 
opposed to just the word "rerun") makes it easier to see whether 
the rerun is a re-broadcase of last weeks show or something they 
dragged out of the vaults.  For example, "Saturday Night Live: 
~1976-06-07" is something I'll want to watch, whereas "Saturday 
Night Live: ~1989-09-02" is worth missing.

I'm just posting them here in case anyone else is as frustrated as 
I am and wants their Myth system to behave in a more rational 
manner.  Without further ado:

===
/usr/bin/mythfilldatabase.sh (root.root, 0744):
===
#!/bin/sh
/bin/date > /tmp/mythfilldatabase.log
[ ! -x /usr/bin/mythfilldatabase.real ] && exit 1
/usr/bin/mythfilldatabase.real $*
[ ! -f /usr/bin/mythfilldatabase.sql ] && exit 1
(/usr/bin/mysql -vv < /usr/bin/mythfilldatabase.sql) \
   >> /tmp/mythfilldatabase.log 2>&1
/usr/bin/mythbackend --resched >> /tmp/mythfilldatabase.log 2>&1
exit 0

===
/usr/bin/mythfilldatabase.sql (root.root, 0644):
===
USE mythconverg
;
UPDATE program
SET subtitle = CONCAT(
   subtitle,
   DATE_FORMAT(
      IF(originalairdate, originalairdate, starttime),
      ' ~%Y-%m-%d'
      )
   )
WHERE seriesid != '' AND subtitle NOT LIKE '% ~%'
;
UPDATE program
SET description = 'No description.'
WHERE seriesid != '' AND description = ''
;

The result is that for multi-part episodes I now get:
"The 4400: The New World ~2006-06-04", "No description."
"The 4400: The New World ~2006-06-11", "No description."
and for non-subtitle series I get:
"How It's Made: ~2004-01-20", "Firefighter boots; garden tools."
"How It's Made: ~2006-01-10", "Springs; pavers; pianos."



More information about the mythtv-users mailing list