Skip to content
Browse files

Metadata Lookup: Many, many bugfixes and improvements.

Move all the logic that was all over the place to try to determine if a programinfo/recrule was a movie, television show, or other, and centralize it.

There are now two simple functions that can be run on these classes to guess, fairly accurately, which are Television, and which are Movies.

This method uses the presence of subtitle, season, episode, inetref, category_type, as well as the same information for the associated recording's rule to decide which grabber is most likely the correct one to run first.  We still fall back to the other grabber when we get no result, but this should markedly improve accuracy.  the lookup code can now fairly accurately decide when a recording is generic (moreso when that recording's rule has been properly set up with inetref, season, and episode data-- remember, when you set season and episode on a recording rule, even if it's not accurate for the specific recording that the rule is built on, it becomes an indicator to further recordings that they should be looked up as Television.  Set up your rules!)

I've tested and retested the video edit metadata and automatic grab functionality, as well as the schedule editor and the various permutations of mythmetadatalookup, and not found any regressions-- in fact, I've fixed a number of issues with all of them as part of this fix.

Adds a new "subtype" to metadata lookups-- while the MetadataType indicator starts us down the right path, the LookupType subtype helps us to fine tune which grabbers to take, in which orders, once we're there.  The good news is that even if this guessing logic were to totally fail, it would still probably produce the right result because of the grabber fallthrough logic.

Generic recordings which are determined to be such masquerade as Season 1, Episode 1 for purposes of assigning inetref and artwork.
  • Loading branch information...
1 parent fd1d6ea commit 6379242585826f62bf1e895484de3f7a4366b544 Robert McNamara committed
View
2 mythtv/libs/libmythbase/mythversion.h
@@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
-#define MYTH_BINARY_VERSION "0.25.20110713-2"
+#define MYTH_BINARY_VERSION "0.25.20110713-3"
/** \brief Increment this whenever the MythTV network protocol changes.
*
View
25 mythtv/libs/libmythmetadata/metadatacommon.cpp
@@ -8,6 +8,7 @@
// null constructor
MetadataLookup::MetadataLookup(void) :
m_type(VID),
+ m_subtype(kUnknownVideo),
m_data(),
m_step(SEARCH),
m_automatic(false),
@@ -71,6 +72,7 @@ MetadataLookup::MetadataLookup(void) :
// full constructor
MetadataLookup::MetadataLookup(
MetadataType type,
+ LookupType subtype,
QVariant data,
LookupStep step,
bool automatic,
@@ -130,6 +132,7 @@ MetadataLookup::MetadataLookup(
DownloadMap downloads) :
m_type(type),
+ m_subtype(subtype),
m_data(data),
m_step(step),
m_automatic(automatic),
@@ -193,6 +196,7 @@ MetadataLookup::MetadataLookup(
// ProgramInfo-style constructor
MetadataLookup::MetadataLookup(
MetadataType type,
+ LookupType subtype,
QVariant data,
LookupStep step,
bool automatic,
@@ -231,6 +235,7 @@ MetadataLookup::MetadataLookup(
const uint runtimesecs) :
m_type(type),
+ m_subtype(subtype),
m_data(data),
m_step(step),
m_automatic(automatic),
@@ -273,6 +278,7 @@ MetadataLookup::MetadataLookup(
// XBMC NFO-style constructor
MetadataLookup::MetadataLookup(
MetadataType type,
+ LookupType subtype,
QVariant data,
LookupStep step,
bool automatic,
@@ -301,6 +307,7 @@ MetadataLookup::MetadataLookup(
DownloadMap downloads) :
m_type(type),
+ m_subtype(subtype),
m_data(data),
m_step(step),
m_automatic(automatic),
@@ -599,12 +606,13 @@ MetadataLookup* ParseMetadataItem(const QDomElement& item,
.arg(season).arg(episode));
}
- return new MetadataLookup(lookup->GetType(), lookup->GetData(),
- lookup->GetStep(), lookup->GetAutomatic(), lookup->GetHandleImages(),
- lookup->GetAllowOverwrites(), lookup->GetPreferDVDOrdering(),
- lookup->GetHost(), lookup->GetFilename(), title, categories,
- userrating, language, subtitle, tagline, description,
- season, episode, chanid, channum, chansign, channame,
+ return new MetadataLookup(lookup->GetType(), lookup->GetSubtype(),
+ lookup->GetData(), lookup->GetStep(), lookup->GetAutomatic(),
+ lookup->GetHandleImages(), lookup->GetAllowOverwrites(),
+ lookup->GetPreferDVDOrdering(), lookup->GetHost(),
+ lookup->GetFilename(), title, categories, userrating,
+ language, subtitle, tagline, description, season,
+ episode, chanid, channum, chansign, channame,
chanplaybackfilters, recgroup, playgroup, seriesid, programid,
storagegroup, startts, endts, recstartts, recendts, programflags,
audioproperties, videoproperties, subtitletype, certification,
@@ -679,8 +687,9 @@ MetadataLookup* ParseMetadataMovieNFO(const QDomElement& item,
people.insert(DIRECTOR, info);
}
- return new MetadataLookup(lookup->GetType(), lookup->GetData(),
- lookup->GetStep(), lookup->GetAutomatic(), lookup->GetHandleImages(),
+ return new MetadataLookup(lookup->GetType(), lookup->GetSubtype(),
+ lookup->GetData(), lookup->GetStep(),
+ lookup->GetAutomatic(), lookup->GetHandleImages(),
lookup->GetAllowOverwrites(), lookup->GetPreferDVDOrdering(),
lookup->GetHost(), lookup->GetFilename(), title, categories,
userrating, subtitle, tagline, description, season, episode,
View
16 mythtv/libs/libmythmetadata/metadatacommon.h
@@ -55,6 +55,15 @@ enum MetadataType {
GAME = 3
};
+enum LookupType {
+ kProbableTelevision = 0,
+ kProbableGenericTelevision = 1,
+ kProbableMovie = 2,
+ kUnknownVideo = 3,
+ kProbableMusic = 4,
+ kProbableGame = 5
+};
+
enum PeopleType {
ACTOR = 0,
AUTHOR = 1,
@@ -88,6 +97,7 @@ class META_PUBLIC MetadataLookup : public QObject
MetadataLookup(
MetadataType type,
+ LookupType subtype,
QVariant data,
LookupStep step,
bool automatic,
@@ -149,6 +159,7 @@ class META_PUBLIC MetadataLookup : public QObject
//ProgramInfo Constructor
MetadataLookup(
MetadataType type,
+ LookupType subtype,
QVariant data,
LookupStep step,
bool automatic,
@@ -189,6 +200,7 @@ class META_PUBLIC MetadataLookup : public QObject
// XBMC NFO Constructor
MetadataLookup(
MetadataType type,
+ LookupType subtype,
QVariant data,
LookupStep step,
bool automatic,
@@ -222,6 +234,8 @@ class META_PUBLIC MetadataLookup : public QObject
// Must set a type, data, and step.
void SetType(MetadataType type) { m_type = type; };
+ // For some lookup, it helps to know the subtype (TV vs. Movie)
+ void SetSubtype(LookupType subtype) { m_subtype = subtype; };
// Reference value- when the event comes back, need to associate with an item.
void SetData(QVariant data) { m_data = data; };
// Steps: SEARCH, GETDATA
@@ -258,6 +272,7 @@ class META_PUBLIC MetadataLookup : public QObject
// GETS
MetadataType GetType() const { return m_type; };
+ LookupType GetSubtype() const { return m_subtype; };
QVariant GetData() const { return m_data; };
LookupStep GetStep() const { return m_step; };
bool GetAutomatic() const { return m_automatic; };
@@ -340,6 +355,7 @@ class META_PUBLIC MetadataLookup : public QObject
private:
// General
MetadataType m_type;
+ LookupType m_subtype;
QVariant m_data;
LookupStep m_step;
bool m_automatic;
View
149 mythtv/libs/libmythmetadata/metadatadownload.cpp
@@ -68,20 +68,42 @@ void MetadataDownload::run()
{
MetadataLookupList list;
// Go go gadget Metadata Lookup
- if (lookup->GetType() == VID || lookup->GetType() == RECDNG)
+ if (lookup->GetType() == VID)
{
- if (lookup->GetSeason() > 0 || lookup->GetEpisode() > 0)
+ if (lookup->GetSubtype() == kProbableTelevision)
list = handleTelevision(lookup);
- else if (!lookup->GetSubtitle().isEmpty() &&
- lookup->GetType() == VID)
- list = handleVideoUndetermined(lookup);
- else if (lookup->GetType() == RECDNG)
- list = handleRecordingUndetermined(lookup);
+ else if (lookup->GetSubtype() == kProbableMovie)
+ list = handleMovie(lookup);
else
+ list = handleVideoUndetermined(lookup);
+
+ if (!list.size() &&
+ lookup->GetSubtype() == kUnknownVideo)
+ {
+ list = handleMovie(lookup);
+ }
+ }
+ else if (lookup->GetType() == RECDNG)
+ {
+ if (lookup->GetSubtype() == kProbableTelevision)
+ {
+ if (lookup->GetSeason() > 0 || lookup->GetEpisode() > 0)
+ list = handleTelevision(lookup);
+ else if (!lookup->GetSubtitle().isEmpty())
+ list = handleVideoUndetermined(lookup);
+ }
+ else if (lookup->GetSubtype() == kProbableMovie)
list = handleMovie(lookup);
+ else
+ list = handleRecordingGeneric(lookup);
+
+ if (!list.size() &&
+ (lookup->GetSubtype() == kProbableMovie ||
+ lookup->GetSubtype() == kProbableTelevision))
+ {
+ list = handleRecordingGeneric(lookup);
+ }
}
-// else if (lookup->GetType() == MUSIC)
-// list = handleMusic(lookup);
else if (lookup->GetType() == GAME)
list = handleGame(lookup);
@@ -173,16 +195,6 @@ bool MetadataDownload::findBestMatch(MetadataLookupList list,
MetadataLookup *newlookup = (*i);
newlookup->SetStep(GETDATA);
- // If searching for TV without a subtitle, but we've found
- // a series match, arbitrarily set season/episode to "1" to
- // avoid looping forever trying to figure it out.
-
- if (newlookup->GetType() == RECDNG)
- {
- newlookup->SetSeason(1);
- newlookup->SetEpisode(1);
- }
-
prependLookup(newlookup);
return true;
}
@@ -498,105 +510,52 @@ MetadataLookupList MetadataDownload::handleVideoUndetermined(
// Try to do a title/subtitle lookup
list = runGrabber(cmd, args, lookup, false);
- // If there were no results for that, fall back to a movie lookup.
- if (!list.size())
- list = handleMovie(lookup);
-
if (list.count() == 1)
list.at(0)->SetStep(GETDATA);
return list;
}
-MetadataLookupList MetadataDownload::handleRecordingUndetermined(
+MetadataLookupList MetadataDownload::handleRecordingGeneric(
MetadataLookup* lookup)
{
- // Ground rules: if we are here, we're operating on a recording.
- // If this lookup is trying to handle images, the only place that can
- // be in a --refresh-all-artwork run of mythmetadatalookup.
-
- // Thus, TRUST the season and episode if there's an inetref + handleimages!
+ // We only enter this mode if we are pretty darn sure this is a TV show,
+ // but we're for some reason looking up a generic, or the title didn't
+ // exactly match in one of the earlier lookups. This is a total
+ // hail mary to try to get at least *series* level info and art/inetref.
MetadataLookupList list;
- if ((lookup->GetHandleImages() && !lookup->GetInetref().isEmpty() &&
- (lookup->GetSeason() > 0 || lookup->GetEpisode() > 0)) ||
- !lookup->GetHandleImages())
- {
- QString def_cmd = QDir::cleanPath(QString("%1/%2")
+ QString def_cmd = QDir::cleanPath(QString("%1/%2")
.arg(GetShareDir())
.arg("metadata/Television/ttvdb.py"));
- QString cmd = gCoreContext->GetSetting("TelevisionGrabber", def_cmd);
-
- QStringList args;
- args.append(QString("-l")); // Language Flag
- args.append(gCoreContext->GetLanguage()); // UI Language
- if (!lookup->GetSubtitle().isEmpty())
- args.append(QString("-N"));
- else
- {
- // If the input lookup doesn't have Subtitle, Season or Episode,
- // We're going to "artificially" set Seas/Ep to 1 since the input
- // isn't enough information to get conclusive metadata anyway.
- // This is needed in case of a multi-result, so that on the second
- // pass through, we definitely get the TV grabber and at least get
- // an inetref.
- if (lookup->GetSeason() == 0 && lookup->GetEpisode() == 0)
- {
- lookup->SetSeason(1);
- lookup->SetEpisode(1);
- }
- args.append(QString("-M"));
- }
-
- if (!lookup->GetInetref().isEmpty())
- {
- QString inetref = lookup->GetInetref();
- args.append(inetref);
- }
- else
- {
- QString title = lookup->GetTitle();
- args.append(title);
- }
+ QString cmd = gCoreContext->GetSetting("TelevisionGrabber", def_cmd);
- if (!lookup->GetSubtitle().isEmpty())
- {
- QString subtitle = lookup->GetSubtitle();
- args.append(subtitle);
- list = runGrabber(cmd, args, lookup, false);
+ QStringList args;
- if (!list.size() && !lookup->GetHandleImages())
- {
- // Hail Mary lookup. Drop the subtitle.
- // (Because really, this should be a TV show)
- args.clear();
- args.append(QString("-l")); // Language Flag
- args.append(gCoreContext->GetLanguage()); // UI Language
- args.append("-M");
- QString title = lookup->GetTitle();
- args.append(title);
- lookup->SetSeason(1);
- lookup->SetEpisode(1);
- list = runGrabber(cmd, args, lookup, true);
- }
- }
- else
- list = runGrabber(cmd, args, lookup, true);
- }
+ args.append(QString("-l")); // Language Flag
+ args.append(gCoreContext->GetLanguage()); // UI Language
+ args.append("-M");
+ QString title = lookup->GetTitle();
+ args.append(title);
+ int origseason = lookup->GetSeason();
+ int origepisode = lookup->GetEpisode();
- // If there were no results for that, fall back to a movie lookup.
- if (!list.size() && lookup->GetSubtitle().isEmpty())
+ if (origseason == 0 && origepisode == 0)
{
- lookup->SetSeason(0);
- lookup->SetEpisode(0);
- list = handleMovie(lookup);
+ lookup->SetSeason(1);
+ lookup->SetEpisode(1);
}
+ list = runGrabber(cmd, args, lookup, true);
+
if (list.count() == 1)
list.at(0)->SetStep(GETDATA);
+ lookup->SetSeason(origseason);
+ lookup->SetEpisode(origepisode);
+
return list;
}
View
2 mythtv/libs/libmythmetadata/metadatadownload.h
@@ -56,7 +56,7 @@ class META_PUBLIC MetadataDownload : public QThread
MetadataLookupList handleMovie(MetadataLookup* lookup);
MetadataLookupList handleTelevision(MetadataLookup* lookup);
MetadataLookupList handleVideoUndetermined(MetadataLookup* lookup);
- MetadataLookupList handleRecordingUndetermined(MetadataLookup* lookup);
+ MetadataLookupList handleRecordingGeneric(MetadataLookup* lookup);
MetadataLookupList handleGame(MetadataLookup* lookup);
View
67 mythtv/libs/libmythmetadata/metadatafactory.cpp
@@ -58,6 +58,7 @@ void MetadataFactory::Lookup(RecordingRule *recrule, bool automatic,
MetadataLookup *lookup = new MetadataLookup();
lookup->SetStep(SEARCH);
lookup->SetType(RECDNG);
+ lookup->SetSubtype(GuessLookupType(recrule));
lookup->SetData(qVariantFromValue(recrule));
lookup->SetAutomatic(automatic);
lookup->SetHandleImages(getimages);
@@ -83,6 +84,7 @@ void MetadataFactory::Lookup(ProgramInfo *pginfo, bool automatic,
MetadataLookup *lookup = new MetadataLookup();
lookup->SetStep(SEARCH);
lookup->SetType(RECDNG);
+ lookup->SetSubtype(GuessLookupType(pginfo));
lookup->SetData(qVariantFromValue(pginfo));
lookup->SetAutomatic(automatic);
lookup->SetHandleImages(getimages);
@@ -108,6 +110,12 @@ void MetadataFactory::Lookup(VideoMetadata *metadata, bool automatic,
MetadataLookup *lookup = new MetadataLookup();
lookup->SetStep(SEARCH);
lookup->SetType(VID);
+ if (metadata->GetSeason() > 0 || metadata->GetEpisode() > 0)
+ lookup->SetSubtype(kProbableTelevision);
+ else if (metadata->GetSubtitle().isEmpty())
+ lookup->SetSubtype(kProbableMovie);
+ else
+ lookup->SetSubtype(kUnknownVideo);
lookup->SetData(qVariantFromValue(metadata));
lookup->SetAutomatic(automatic);
lookup->SetHandleImages(getimages);
@@ -273,3 +281,62 @@ void MetadataFactory::customEvent(QEvent *levent)
}
}
+// These functions exist to determine if we have enough
+// information to conclusively call something a Show vs. Movie
+
+LookupType GuessLookupType(ProgramInfo *pginfo)
+{
+ LookupType ret = kUnknownVideo;
+
+ QString catType = pginfo->QueryCategoryType();
+
+ if (catType == "series" || catType == "tvshow" ||
+ catType == "show")
+ ret = kProbableTelevision;
+ else if (catType == "movie" || catType == "film")
+ ret = kProbableMovie;
+ else if (pginfo->GetSeason() > 0 || pginfo->GetEpisode() > 0 ||
+ !pginfo->GetSubtitle().isEmpty())
+ ret = kProbableTelevision;
+ else
+ {
+ // Before committing to something being a movie, we
+ // want to check its rule. If the rule has a season
+ // or episode number, but the recording doesn't,
+ // and the rec doesn't have a subtitle, this is a
+ // generic recording. If neither the rule nor the
+ // recording have an inetref, season, episode, or
+ // subtitle, it's *probably* a movie. If it's some
+ // weird combination of both, we've got to try everything.
+ RecordingRule *rule = new RecordingRule();
+ rule->LoadByProgram(pginfo);
+ int ruleepisode = 0;
+ if (rule && rule->Load())
+ ruleepisode = rule->m_episode;
+ delete rule;
+
+ if (ruleepisode == 0 && pginfo->GetEpisode() == 0 &&
+ pginfo->GetSubtitle().isEmpty())
+ ret = kProbableMovie;
+ else if (ruleepisode > 0 && pginfo->GetSubtitle().isEmpty())
+ ret = kProbableGenericTelevision;
+ else
+ ret = kUnknownVideo;
+ }
+
+ return ret;
+}
+
+LookupType GuessLookupType(RecordingRule *recrule)
+{
+ LookupType ret = kUnknownVideo;
+
+ if (recrule->m_season > 0 || recrule->m_episode > 0 ||
+ !recrule->m_subtitle.isEmpty())
+ ret = kProbableTelevision;
+ else
+ ret = kProbableMovie;
+
+ return ret;
+}
+
View
3 mythtv/libs/libmythmetadata/metadatafactory.h
@@ -81,4 +81,7 @@ class META_PUBLIC MetadataFactory : public QObject
MetadataImageDownload *m_imagedownload;
};
+META_PUBLIC LookupType GuessLookupType(ProgramInfo *pginfo);
+META_PUBLIC LookupType GuessLookupType(RecordingRule *recrule);
+
#endif
View
14 mythtv/programs/mythfrontend/editvideometadata.cpp
@@ -710,6 +710,13 @@ void EditMetadataDialog::OnSearchListSelection(ArtworkInfo info, VideoArtworkTyp
MetadataLookup *lookup = new MetadataLookup();
lookup->SetType(VID);
+ if (m_workingMetadata->GetSeason() > 0 ||
+ m_workingMetadata->GetEpisode() > 0)
+ lookup->SetSubtype(kProbableTelevision);
+ else if (m_workingMetadata->GetSubtitle().isEmpty())
+ lookup->SetSubtype(kProbableMovie);
+ else
+ lookup->SetSubtype(kUnknownVideo);
lookup->SetHost(m_workingMetadata->GetHost());
lookup->SetAutomatic(true);
lookup->SetData(qVariantFromValue<VideoArtworkType>(type));
@@ -766,6 +773,13 @@ void EditMetadataDialog::FindNetArt(VideoArtworkType type)
lookup->SetStep(SEARCH);
lookup->SetType(VID);
lookup->SetAutomatic(true);
+ if (m_workingMetadata->GetSeason() > 0 ||
+ m_workingMetadata->GetEpisode() > 0)
+ lookup->SetSubtype(kProbableTelevision);
+ else if (m_workingMetadata->GetSubtitle().isEmpty())
+ lookup->SetSubtype(kProbableMovie);
+ else
+ lookup->SetSubtype(kUnknownVideo);
lookup->SetData(qVariantFromValue<VideoArtworkType>(type));
lookup->SetTitle(m_workingMetadata->GetTitle());
View
20 mythtv/programs/mythfrontend/scheduleeditor.cpp
@@ -1340,8 +1340,6 @@ MetadataOptions::MetadataOptions(MythScreenStack *parent,
MetadataOptions::~MetadataOptions(void)
{
- Save();
-
if (m_imageLookup)
{
m_imageLookup->cancel();
@@ -1481,6 +1479,11 @@ void MetadataOptions::PerformQuery()
m_lookup->SetStep(SEARCH);
m_lookup->SetType(RECDNG);
+ if (m_seasonSpin->GetIntValue() > 0 ||
+ m_episodeSpin->GetIntValue() > 0)
+ m_lookup->SetSubtype(kProbableTelevision);
+ else
+ m_lookup->SetSubtype(kProbableMovie);
m_lookup->SetAutomatic(false);
m_lookup->SetHandleImages(false);
m_lookup->SetHost(gCoreContext->GetMasterHostName());
@@ -1567,6 +1570,12 @@ void MetadataOptions::SelectOnlineBanner()
FindNetArt(BANNER);
}
+void MetadataOptions::Close()
+{
+ Save();
+ MythScreenType::Close();
+}
+
void MetadataOptions::Save()
{
// Season
@@ -1655,6 +1664,11 @@ void MetadataOptions::FindNetArt(VideoArtworkType type)
m_lookup->SetType(VID);
m_lookup->SetAutomatic(true);
m_lookup->SetHandleImages(false);
+ if (m_seasonSpin->GetIntValue() > 0 ||
+ m_episodeSpin->GetIntValue() > 0)
+ m_lookup->SetSubtype(kProbableTelevision);
+ else
+ m_lookup->SetSubtype(kProbableMovie);
m_lookup->SetData(qVariantFromValue<VideoArtworkType>(type));
m_lookup->SetHost(gCoreContext->GetMasterHostName());
m_lookup->SetTitle(m_recordingRule->m_title);
@@ -1913,8 +1927,6 @@ void MetadataOptions::customEvent(QEvent *levent)
{
DialogCompletionEvent *dce = (DialogCompletionEvent*)(levent);
- LOG(VB_GENERAL, LOG_ERR, "DCE!");
-
const QString resultid = dce->GetId();
ArtworkInfo info;
info.url = dce->GetResultText();
View
2 mythtv/programs/mythfrontend/scheduleeditor.h
@@ -246,6 +246,8 @@ class MetadataOptions : public MythScreenType
void ValuesChanged();
+ void Close(void);
+
private:
void Load(void);
void Save(void);
View
36 mythtv/programs/mythmetadatalookup/lookup.cpp
@@ -110,6 +110,9 @@ void LookerUpper::HandleAllArtwork(bool aggressive)
{
m_updateartwork = true;
+ if (aggressive)
+ m_updaterules = true;
+
// First, handle all recording rules w/ inetrefs
vector<ProgramInfo *> recordingList;
@@ -119,6 +122,7 @@ void LookerUpper::HandleAllArtwork(bool aggressive)
{
ProgramInfo *pginfo = new ProgramInfo(*(recordingList[n]));
bool dolookup = true;
+
if (!aggressive && pginfo->GetInetRef().isEmpty())
dolookup = false;
if (dolookup)
@@ -150,23 +154,21 @@ void LookerUpper::HandleAllArtwork(bool aggressive)
{
ProgramInfo *pginfo = new ProgramInfo(*(progList[n]));
bool dolookup = true;
+ int maxartnum = 3;
- RecordingRule *rule = new RecordingRule();
- rule->LoadByProgram(pginfo);
- int ruleepisode = 0;
- if (rule && rule->Load())
- ruleepisode = rule->m_episode;
- delete rule;
+ LookupType type = GuessLookupType(pginfo);
- if ((!aggressive && pginfo->GetInetRef().isEmpty()) ||
+ if (type == kProbableMovie || type == kUnknownVideo)
+ maxartnum = 3;
+
+ if ((!aggressive && type == kProbableGenericTelevision) ||
pginfo->GetRecordingGroup() == "Deleted" ||
- pginfo->GetRecordingGroup() == "LiveTV" ||
- (!aggressive && ruleepisode > 0 && pginfo->GetEpisode() == 0))
+ pginfo->GetRecordingGroup() == "LiveTV")
dolookup = false;
if (dolookup)
{
ArtworkMap map = GetArtwork(pginfo->GetInetRef(), pginfo->GetSeason(), true);
- if (map.isEmpty())
+ if (map.isEmpty() || (aggressive && map.count() < maxartnum))
{
QString msg = QString("Looking up artwork for recording: %1 %2")
.arg(pginfo->GetTitle())
@@ -280,11 +282,17 @@ void LookerUpper::customEvent(QEvent *levent)
if (m_updaterules)
{
RecordingRule *rule = new RecordingRule();
- rule->LoadByProgram(pginfo);
- rule->m_inetref = lookup->GetInetref();
- rule->Save();
+ if (rule)
+ {
+ rule->LoadByProgram(pginfo);
+ if (rule->m_inetref.isEmpty())
+ rule->m_inetref = lookup->GetInetref();
+ rule->m_season = lookup->GetSeason();
+ rule->m_episode = lookup->GetEpisode();
+ rule->Save();
- delete rule;
+ delete rule;
+ }
}
if (m_updateartwork)

0 comments on commit 6379242

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