Skip to content

Commit

Permalink
Fix metadata fanart selection.
Browse files Browse the repository at this point in the history
When artwork is processed from metadata grabber results, the artwork is
put into a QMultiMap, indexed based off the type. When pulling values
back out of a QMultiMap, they are in reverse order from how they were
inserted. Since the grabber is assumed to place the highest rated
artwork at the top of the response list, it must be pulled back out of
the bottom of the QMultiMap.

Commit c3d64c8 made this change for all artwork types by fanart. Fanart
had special handling, to allow it to select different artwork for each
season of a television show. However, the logic used to select the
artwork resulted in being indexed from the beginning of the list, rather
than indexed from the back of the list, thus pulling the lowest rated
artwork rather than the highest.

Fixes #11678
  • Loading branch information
wagnerrp committed Jul 14, 2013
1 parent 030013e commit da8ac30
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mythtv/libs/libmythmetadata/metadatafactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,12 @@ void MetadataFactory::OnSingleResult(MetadataLookup *lookup)
if (fanartlist.size())
{
ArtworkInfo info;
int index = 0;
int index = fanartlist.size();
int season = (int)lookup->GetSeason();
if (season > 0 && season <= fanartlist.count())
index = season - 1;
if (season > 0)
index = max(0, index-season);
else
index--;
info.url = fanartlist.takeAt(index).url;
map.insert(kArtworkFanart, info);
}
Expand Down

0 comments on commit da8ac30

Please sign in to comment.