Skip to content
Browse files

Housekeeper: Perform a nightly update of artwork for recordings and r…

…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...
1 parent 587da94 commit e747d5f6853a0662578a5f5cc6deb9d416a72944 Robert McNamara committed Jul 12, 2011
View
24 mythtv/programs/mythbackend/housekeeper.cpp
@@ -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());
@@ -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)
View
1 mythtv/programs/mythbackend/housekeeper.h
@@ -63,6 +63,7 @@ class HouseKeeper
void CleanupProgramListings(void);
void RunStartupTasks(void);
void UpdateThemeChooserInfoCache(void);
+ void UpdateRecordedArtwork(void);
private:
bool isMaster;
View
29 mythtv/programs/mythfrontend/grabbersettings.cpp
@@ -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)
{
}
@@ -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"));
@@ -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()));
@@ -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)
@@ -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();
}
View
3 mythtv/programs/mythfrontend/grabbersettings.h
@@ -8,6 +8,7 @@
// libmythui
#include "mythuibutton.h"
#include "mythuibuttonlist.h"
+#include "mythuicheckbox.h"
#include "mythscreentype.h"
#include "mythdialogbox.h"
@@ -36,6 +37,8 @@ class GrabberSettings : public MythScreenType
MythUIButtonList *m_tvGrabberButtonList;
MythUIButtonList *m_gameGrabberButtonList;
+ MythUICheckBox *m_dailyUpdatesCheck;
+
MythUIButton *m_okButton;
MythUIButton *m_cancelButton;

0 comments on commit e747d5f

Please sign in to comment.
Something went wrong with that request. Please try again.