From 33aea12c7b91dc03329812387612860b3eed0f19 Mon Sep 17 00:00:00 2001 From: DaveTBlake Date: Mon, 27 May 2019 16:18:12 +0100 Subject: [PATCH 1/2] Fix getting first "thumb" type art URL from scraper available art results --- xbmc/music/infoscanner/MusicInfoScanner.cpp | 27 ++++++++------------- xbmc/utils/ScraperUrl.cpp | 2 +- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp index c8c9ef4531770..acbc8172c7395 100644 --- a/xbmc/music/infoscanner/MusicInfoScanner.cpp +++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp @@ -1659,7 +1659,7 @@ void CMusicInfoScanner::GetAlbumArtwork(long id, const CAlbum &album) (StringUtils::StartsWith(artURL, "image://") && CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_MUSICLIBRARY_PREFERONLINEALBUMART))) { - std::string thumb = CScraperUrl::GetThumbURL(album.thumbURL.GetFirstThumb()); + std::string thumb = CScraperUrl::GetThumbURL(album.thumbURL.GetFirstThumb("thumb")); if (!thumb.empty()) { CTextureCache::GetInstance().BackgroundCacheImage(thumb); @@ -1998,16 +1998,13 @@ bool CMusicInfoScanner::SetArtistArtwork(CArtist& artist, const std::vector& } } } - // No local art, use first from scraped list. - // Art type is encoded into the scraper XML held in thumbURL as optional - // "aspect=" field. Type "thumb" or "" returns URLs for all types of art - // including those without aspect. Those URL without aspect are also - // returned for all other type values. + // No local art, use first of that type from scraped list. + // Art type is encoded into the scraper XML held in thumbURL as + // optional "aspect=" field. Those URL without aspect are also returned for + // all other type values. // Historically albums do not have fanart, so there is no special handling // of scraper results for it (unlike artist). if (strArt.empty()) { - if (type == "thumb") - strArt = CScraperUrl::GetThumbURL(album.thumbURL.GetFirstThumb()); - else - strArt = CScraperUrl::GetThumbURL(album.thumbURL.GetFirstThumb(type)); + strArt = CScraperUrl::GetThumbURL(album.thumbURL.GetFirstThumb(type)); } // Add art to album and library if (!strArt.empty()) diff --git a/xbmc/utils/ScraperUrl.cpp b/xbmc/utils/ScraperUrl.cpp index b4595faf92aed..46dbd9b45d8c7 100644 --- a/xbmc/utils/ScraperUrl.cpp +++ b/xbmc/utils/ScraperUrl.cpp @@ -139,7 +139,7 @@ const CScraperUrl::SUrlEntry CScraperUrl::GetFirstThumb(const std::string &type) { for (std::vector::const_iterator iter=m_url.begin();iter != m_url.end();++iter) { - if (iter->m_type == URL_TYPE_GENERAL && (type.empty() || type == "thumb" || iter->m_aspect == type)) + if (iter->m_type == URL_TYPE_GENERAL && (type.empty() || iter->m_aspect == type)) return *iter; } From ed7bc502f43748f5861e760ec8810f50b893ccf9 Mon Sep 17 00:00:00 2001 From: DaveTBlake Date: Mon, 27 May 2019 16:24:04 +0100 Subject: [PATCH 2/2] When choose art don't show thumb were not applicable and fix thumbnail listing --- xbmc/music/dialogs/GUIDialogMusicInfo.cpp | 16 ---------------- xbmc/utils/ScraperUrl.cpp | 2 +- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/xbmc/music/dialogs/GUIDialogMusicInfo.cpp b/xbmc/music/dialogs/GUIDialogMusicInfo.cpp index 72f52fe658322..dde8506d0faf9 100644 --- a/xbmc/music/dialogs/GUIDialogMusicInfo.cpp +++ b/xbmc/music/dialogs/GUIDialogMusicInfo.cpp @@ -755,22 +755,6 @@ void CGUIDialogMusicInfo::OnGetArt() item->SetLabel(g_localizeStrings.Get(13512)); items.Add(item); } - else if (m_item->HasArt("thumb")) - { - // For missing art of that type add the thumb (when it exists and not a fallback) - CGUIListItem::ArtMap::const_iterator i = primeArt.find("thumb"); - if (i != primeArt.end()) - { - CFileItemPtr item(new CFileItem("thumb://Thumb", false)); - item->SetArt("thumb", m_item->GetArt("thumb")); - if (m_bArtistInfo) - item->SetIconImage("DefaultArtistCover.png"); - else - item->SetIconImage("DefaultAlbumCover.png"); - item->SetLabel(g_localizeStrings.Get(21371)); - items.Add(item); - } - } // Grab the thumbnails of this art type scraped from the web std::vector remotethumbs; diff --git a/xbmc/utils/ScraperUrl.cpp b/xbmc/utils/ScraperUrl.cpp index 46dbd9b45d8c7..125424e3597f0 100644 --- a/xbmc/utils/ScraperUrl.cpp +++ b/xbmc/utils/ScraperUrl.cpp @@ -374,7 +374,7 @@ void CScraperUrl::GetThumbURLs(std::vector &thumbs, const std::stri { for (std::vector::const_iterator iter = m_url.begin(); iter != m_url.end(); ++iter) { - if (iter->m_aspect == type || type.empty() || type == "thumb" || iter->m_aspect.empty()) + if (iter->m_aspect == type || type.empty() || iter->m_aspect.empty()) { if ((iter->m_type == CScraperUrl::URL_TYPE_GENERAL && season == -1) || (iter->m_type == CScraperUrl::URL_TYPE_SEASON && iter->m_season == season))