Skip to content

Commit

Permalink
Housekeeper: Perform a nightly update of artwork for recordings and r…
Browse files Browse the repository at this point in the history
…ules.

This is somewhat analogous to the JAMU -MW cronjob many users have used for a couple of years, but more powerful.  Once every 24 hours, the backend will check to see if any new artwork is needed and download it... for example, if a new season of a show starts.  The next day, you'll have all your old artwork, assigned to the old seasons, and the artwork for the new season as well, assigned to episodes thereafter.

This will be most effective if you've set inetrefs on your recordings or at *least* run "mythmetadatalookup --refresh-all-rules; mythmetdatalookup --refresh-all" once, since it only operates on rules/recordings with inetrefs.
  • Loading branch information
Robert McNamara committed Jul 12, 2011
1 parent 587da94 commit e747d5f
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 2 deletions.
24 changes: 24 additions & 0 deletions mythtv/programs/mythbackend/housekeeper.cpp
Expand Up @@ -318,6 +318,13 @@ void HouseKeeper::RunHouseKeeping(void)
UpdateThemeChooserInfoCache();
updateLastrun("ThemeChooserInfoCacheUpdate");
}

if ((gCoreContext->GetNumSetting("DailyArtworkUpdates", 1)) &&
(wantToRun("RecordedArtworkUpdate", 1, 0, 24, true)))
{
UpdateRecordedArtwork();
updateLastrun("RecordedArtworkUpdate");
}
}

dbTag = QString("JobQueueRecover-%1").arg(gCoreContext->GetHostName());
Expand Down Expand Up @@ -823,6 +830,23 @@ void HouseKeeper::UpdateThemeChooserInfoCache(void)
}
}

void HouseKeeper::UpdateRecordedArtwork(void)
{
QString command = GetInstallPrefix() + "/bin/mythmetadatalookup";
QStringList args;
args << "--refresh-all-artwork";

LOG(VB_GENERAL, LOG_INFO, QString("Performing Artwork Refresh: %1 %2")
.arg(command).arg(args.join(" ")));

MythSystem artupd(command, args, kMSRunShell | kMSAutoCleanup);

artupd.Run();
artupd.Wait();

LOG(VB_GENERAL, LOG_INFO, QString("Artwork Refresh Complete"));
}

void HouseKeeper::RunStartupTasks(void)
{
if (isMaster)
Expand Down
1 change: 1 addition & 0 deletions mythtv/programs/mythbackend/housekeeper.h
Expand Up @@ -63,6 +63,7 @@ class HouseKeeper
void CleanupProgramListings(void);
void RunStartupTasks(void);
void UpdateThemeChooserInfoCache(void);
void UpdateRecordedArtwork(void);

private:
bool isMaster;
Expand Down
29 changes: 27 additions & 2 deletions mythtv/programs/mythfrontend/grabbersettings.cpp
Expand Up @@ -22,8 +22,8 @@ using namespace std;
GrabberSettings::GrabberSettings(MythScreenStack *parent, const char *name)
: MythScreenType(parent, name),
m_movieGrabberButtonList(NULL), m_tvGrabberButtonList(NULL),
m_gameGrabberButtonList(NULL), m_okButton(NULL),
m_cancelButton(NULL)
m_gameGrabberButtonList(NULL), m_dailyUpdatesCheck(NULL),
m_okButton(NULL), m_cancelButton(NULL)
{
}

Expand All @@ -41,6 +41,8 @@ bool GrabberSettings::Create()
m_tvGrabberButtonList = dynamic_cast<MythUIButtonList *> (GetChild("tvgrabber"));
m_gameGrabberButtonList = dynamic_cast<MythUIButtonList *> (GetChild("gamegrabber"));

m_dailyUpdatesCheck = dynamic_cast<MythUICheckBox *> (GetChild("dailyupdates"));

m_okButton = dynamic_cast<MythUIButton *> (GetChild("ok"));
m_cancelButton = dynamic_cast<MythUIButton *> (GetChild("cancel"));

Expand All @@ -60,6 +62,13 @@ bool GrabberSettings::Create()
m_okButton->SetHelpText(tr("Save your changes and close this window."));
m_cancelButton->SetHelpText(tr("Discard your changes and close this window."));

if (m_dailyUpdatesCheck)
m_dailyUpdatesCheck->SetHelpText(tr("If set, the backend will attempt to "
"perform artwork updates for recordings daily. When "
"new seasons begin to record, this will attempt to "
"provide you with fresh, relevant artwork while "
"preserving the artwork assigned to old recordings."));

connect(m_okButton, SIGNAL(Clicked()), this, SLOT(slotSave()));
connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close()));

Expand Down Expand Up @@ -248,6 +257,14 @@ void GrabberSettings::Init(void)
m_movieGrabberButtonList->SetValueByData(qVariantFromValue(currentMovieGrabber));
m_tvGrabberButtonList->SetValueByData(qVariantFromValue(currentTVGrabber));
m_gameGrabberButtonList->SetValueByData(qVariantFromValue(currentGameGrabber));

if (m_dailyUpdatesCheck)
{
int updates =
gCoreContext->GetNumSetting("DailyArtworkUpdates", 1);
if (updates == 1)
m_dailyUpdatesCheck->SetCheckState(MythUIStateType::Full);
}
}

void GrabberSettings::slotSave(void)
Expand All @@ -256,6 +273,14 @@ void GrabberSettings::slotSave(void)
gCoreContext->SaveSettingOnHost("MovieGrabber", m_movieGrabberButtonList->GetDataValue().toString(), "");
gCoreContext->SaveSetting("mythgame.MetadataGrabber", m_gameGrabberButtonList->GetDataValue().toString());

if (m_dailyUpdatesCheck)
{
int dailyupdatestate = 0;
if (m_dailyUpdatesCheck->GetCheckState() == MythUIStateType::Full)
dailyupdatestate = 1;
gCoreContext->SaveSetting("DailyArtworkUpdates", dailyupdatestate);
}

Close();
}

Expand Down
3 changes: 3 additions & 0 deletions mythtv/programs/mythfrontend/grabbersettings.h
Expand Up @@ -8,6 +8,7 @@
// libmythui
#include "mythuibutton.h"
#include "mythuibuttonlist.h"
#include "mythuicheckbox.h"
#include "mythscreentype.h"
#include "mythdialogbox.h"

Expand Down Expand Up @@ -36,6 +37,8 @@ class GrabberSettings : public MythScreenType
MythUIButtonList *m_tvGrabberButtonList;
MythUIButtonList *m_gameGrabberButtonList;

MythUICheckBox *m_dailyUpdatesCheck;

MythUIButton *m_okButton;
MythUIButton *m_cancelButton;

Expand Down

0 comments on commit e747d5f

Please sign in to comment.