[mythtv-users] Upgraded to 0.27, now metadata is being downloaded

Stephen Worthington stephen_agent at jsw.gen.nz
Wed Sep 25 16:29:31 UTC 2013


On Wed, 25 Sep 2013 08:09:43 -0700, you wrote:

>On Wed, Sep 25, 2013 at 1:11 AM, Stephen Worthington <
>stephen_agent at jsw.gen.nz> wrote:
>
>> On Tue, 24 Sep 2013 14:04:24 +1000, you wrote:
>> I have done very little C++, but I am intending to try the following
>> patch tomorrow when I have a big enough gap between recordings:
>>
>> diff --git a/mythtv/programs/mythbackend/backendhousekeeper.cpp
>> b/mythtv/programs/mythbackend/backendhousekeeper.cpp
>> old mode 100644
>> new mode 100755
>> index e64477e..eb4ebbd
>> --- a/mythtv/programs/mythbackend/backendhousekeeper.cpp
>> +++ b/mythtv/programs/mythbackend/backendhousekeeper.cpp
>> @@ -437,6 +437,13 @@ ArtworkTask::ArtworkTask(void) :
>> DailyHouseKeeperTask("RecordedArtworkUpdate",
>>  {
>>  }
>>
>> +bool ArtworkTask::DoCheckRun(QDateTime now)
>> +{
>> +    if (!gCoreContext->GetNumSetting("AutoMetadataLookup", 1))
>> +        return false;
>> +    return DailyHouseKeeperTask::DoCheckRun(now);
>> +}
>> +
>>  bool ArtworkTask::DoRun(void)
>>  {
>>      if (m_msMML)
>> diff --git a/mythtv/programs/mythbackend/backendhousekeeper.h
>> b/mythtv/programs/mythbackend/backendhousekeeper.h
>> old mode 100644
>> new mode 100755
>> index d24efae..12b2a46
>> --- a/mythtv/programs/mythbackend/backendhousekeeper.h
>> +++ b/mythtv/programs/mythbackend/backendhousekeeper.h
>> @@ -47,6 +47,7 @@ class ArtworkTask : public DailyHouseKeeperTask
>>      ArtworkTask(void);
>>      virtual ~ArtworkTask(void);
>>      bool DoRun(void);
>> +    virtual bool DoCheckRun(QDateTime now);
>>      virtual void Terminate(void);
>>    private:
>>      MythSystemLegacy *m_msMML;
>>
>> Since this is my first foray into the MythTV code, there are any
>> number of things I could be doing wrong, so if anyone spots something,
>> please let me know.
>>
>
>I also don't know the MythTV code, but it might be a good idea to check if
>gCoreContext is null before invoking a function call on it. In other words:
>
>if (gCoreContext && !gCoreContext->GetNumSetting("AutoMetadataLookup", 1)) {
>    return false;
>}
>
>Possibly the class design prevents it from being null, though.

That is a good thought, but gCoreContext seems to be a pointer to the
base global data for the whole of mythbackend, set up just after
startup and never released.  It is used like that all over the place,
including in the code I am modifying.  So I think it is perfectly safe
for me to use it without checking also.

>Note that I
>also added the braces. I don't know the MythTV coding convention, but many
>typical coding conventions require braces after conditional statements
>because if you want to add another conditionally executed statement later
>it's easy to forget to enclose the whole block in braces in which case only
>the first line after the "if" will be conditionally executed while the
>other statements are always executed, leading to much head scratching.
>
>Karl

Yes, I prefer that style too - I consider not having the braces to be
dangerous, and I have my editor set up to add them automatically.  But
since I am modifying existing code, I am trying to follow the style in
use there, which is to not use braces for single line if.  I find it
quite hard to do it without braces though.


More information about the mythtv-users mailing list