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

Karl Newman newmank1 at asme.org
Wed Sep 25 15:09:43 UTC 2013


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. 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20130925/48f38849/attachment.html>


More information about the mythtv-users mailing list