[mythtv] Metadata download disable patch - guidance needed

Stephen Worthington stephen_agent at jsw.gen.nz
Wed Oct 9 04:22:06 UTC 2013


When I upgraded from 0.26 to 0.27, I suddenly was having
mythmetadatalookup running and downloading artwork.  I hate having
artwork behind text - it makes it hard to read the text.  My mother
also was having a problem with this on her box, and I also suddenly
had over 1 Gibyte of downloading happening unexpectedly.  I was sure I
had disabled all metatdata lookup except for MythMusic, so after I
hurriedly temporarily disabled mythmetadatalookup by replacing its
file with a script, I have been working on a possible patch to fix
this.  It turns out the problem is something of a tangled web, and I
need some guidance from the devs involved as to what is the right way
to fix this.

There seem to be two settings in the settings table involved in
controlling global metadata lookup:

  AutoMetadataLookup (defaults to 1 if not present)
  DailyArtworkUpdates (defaults to 0 if not present)

My MythTV box and my mother's both had AutoMetadataLookup present and
set to 0, but no entry for DailyArtworkUpdates.  My laptop had
neither.

AutoMetadataLookup seems to be completely orphaned - in 0.27 it is
only referenced in mythtv/libs/libmythtv/recordingrule.cpp
RecordingRule::RecordingRule() and there is no way I can find of
setting or changing its value.  In fact, all of the GetNumSettings
calls in the RecordingRule::RecordingRule() constructor seem to be for
orphaned settings.  I have not delved too far into that, but I think
it probably has to do with the change to using a default template to
create the recording rules, and I am guessing that all the values that
are defaulted in the constructor will be overwritten from values in
the template rule when that is loaded.  But I have not checked on that
at all.  AutoMetadataLookup used to control whether a new recording
rule had the record.autometadata flag set when it was created.  The
code for setting it (in globalsettings.cpp) disappeared in 0.26.

DailyArtworkUpdates seems to be the setting that I need - in 0.26 it
was referenced in housekeeper.cpp and, as it defaulted to 0, even
though it was not present in my settings table it stopped metadata
downloads from happening.  When the housekeeper code was revamped into
a proper inheritance structure for 0.27, the code that was checking
DailyArtworkUpdates was missed out in the new setup - there are no
references to DailyArtworkUpdates except where it is set in
grabbersettings.cpp.

When I looked at backendhousekeeper.cpp I found there was another
setting MythFillEnabled being used to control whether mythfilldatabase
was run.  So I just copied how that worked, by creating an
ArtworkTask::DoCheckRun method.  But that did not work -
mythmetadatalookup was still being run at startup, although adding the
DoCheckRun method did stop it from ever being run again until
mythbackend was restarted.  It seems that MythFillDatabaseTask is
created with the default kHKNormal option so it is not run at startup.
ArtworkTask is created with the kHKRunOnStartup option to make it be
queued to be run just after the HouseKeeperTask is started.  Any task
with the kHKRunOnStartup or kHKRunImmediateOnStartup will be run on
startup without the DoCheckRun method being called to see if it should
actually be run.  What I am unable to work out is whether this is as
designed, or a bug.

DoCheckRun seems to be used for two slightly different things -
checking to see if the task should ever be run (as in
MythFillEnabled), and checking whether it is the right time to run the
task.  If I patch the code to run DoCheckRun on tasks being queued or
run at startup due to the kHKRunOnStartup or kHKRunImmediateOnStartup
options, will I be breaking things by checking whether it is time to
run the task (so it might not actually be run at startup)?  If instead
I move the check for DailyArtworkUpdates to ArtworkTask::DoRun, should
I also be moving the MythFillEnabled check to
MythFillDatabaseTask::DoRun (and any other tasks that do the same) so
that the usage is consistent?  Or should I just patch
ArtworkTask::DoRun to check DailyArtworkUpdates and ignore any other
issues?


More information about the mythtv-dev mailing list