Skip to content

Commit

Permalink
TV metadata lookup: prefer season/episode on search
Browse files Browse the repository at this point in the history
over subtitle search if inetref is provided.

The search for TV shows with 'inetref' & 'subtitle' is ambiguous if the
same subtitle exists multiple times, like "Episode 1" available for
multiple seasons.

If data for 'season' and 'episode' numbers are available, use it at
first instance, because these data are unique.

Refs #473
  • Loading branch information
rcrdnalor committed Feb 9, 2022
1 parent abe433a commit 2311368
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions mythtv/libs/libmythmetadata/metadatadownload.cpp
Expand Up @@ -635,8 +635,8 @@ MetadataLookupList MetadataDownload::handleMovie(MetadataLookup *lookup)
* attempt to find television data via the following (in order)
* 1- Local MXML: already done before
* 2- Local NFO: already done
* 3- By inetref with subtitle
* 4- By inetref with season and episode
* 3- By inetref with season and episode
* 4- By inetref with subtitle
* 5- By inetref
* 6- By title and subtitle
* 7- By title
Expand All @@ -655,17 +655,17 @@ MetadataLookupList MetadataDownload::handleTelevision(MetadataLookup *lookup)
{
// with inetref
lookup->SetStep(kLookupData);
if (!lookup->GetSubtitle().isEmpty())
if (lookup->GetSeason() || lookup->GetEpisode())
{
list = grabber.SearchSubtitle(lookup->GetInetref(),
lookup->GetBaseTitle() /* unused */,
lookup->GetSubtitle(), lookup, false);
list = grabber.LookupData(lookup->GetInetref(), lookup->GetSeason(),
lookup->GetEpisode(), lookup);
}

if (list.isEmpty() && (lookup->GetSeason() || lookup->GetEpisode()))
if (list.isEmpty() && (!lookup->GetSubtitle().isEmpty()))
{
list = grabber.LookupData(lookup->GetInetref(), lookup->GetSeason(),
lookup->GetEpisode(), lookup);
list = grabber.SearchSubtitle(lookup->GetInetref(),
lookup->GetBaseTitle() /* unused */,
lookup->GetSubtitle(), lookup, false);
}

if (list.isEmpty() && !lookup->GetCollectionref().isEmpty())
Expand Down

0 comments on commit 2311368

Please sign in to comment.