aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorksooo <3226626+ksooo@users.noreply.github.com>2023-09-04 12:03:02 +0200
committerksooo <3226626+ksooo@users.noreply.github.com>2023-09-06 08:40:32 +0200
commit66e97ba8e1a6f10b5c112cb7772378810295999e (patch)
treecf86c7b6d9a3c0dffe1b797d8b7572e8bcbd67c0
parent40455afc5ab1de8a2b6c01513494a85fbac3077e (diff)
downloadxbmc-66e97ba8e1a6f10b5c112cb7772378810295999e.tar.xz
[video] Art selection dialog: Fix support for embedded art. More video formats are supported, not just mkv, but embedded art is only available if 'use video tags' setting is activated.
-rw-r--r--xbmc/video/dialogs/GUIDialogVideoInfo.cpp80
1 files changed, 46 insertions, 34 deletions
diff --git a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp
index e13afa90e6..233fe7606a 100644
--- a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp
+++ b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp
@@ -892,6 +892,38 @@ void CGUIDialogVideoInfo::OnGetArt()
};
}
+namespace
+{
+std::string GetEmbeddedArt(const std::string& fileNameAndPath, const std::string& artType)
+{
+ std::string embeddedArt;
+ if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
+ CSettings::SETTING_MYVIDEOS_USETAGS))
+ {
+ if (URIUtils::HasExtension(fileNameAndPath, ".mkv") ||
+ URIUtils::HasExtension(fileNameAndPath, ".mp4") ||
+ URIUtils::HasExtension(fileNameAndPath, ".avi") ||
+ URIUtils::HasExtension(fileNameAndPath, ".m4v"))
+ {
+ CFileItem item(fileNameAndPath, false);
+ CVideoTagLoaderFFmpeg loader(item, nullptr, false);
+ CVideoInfoTag tag;
+ loader.Load(tag, false, nullptr);
+ for (const auto& it : tag.m_coverArt)
+ {
+ if (it.m_type == artType)
+ {
+ embeddedArt = CTextureUtils::GetWrappedImageURL(fileNameAndPath, "video_" + artType);
+ break;
+ }
+ }
+ }
+ }
+ return embeddedArt;
+}
+
+} // unnamed namespace
+
// Allow user to select a Fanart
void CGUIDialogVideoInfo::OnGetFanart()
{
@@ -909,24 +941,14 @@ void CGUIDialogVideoInfo::OnGetFanart()
items.Add(itemCurrent);
}
- std::string embeddedArt;
- if (URIUtils::HasExtension(m_movieItem->GetVideoInfoTag()->m_strFileNameAndPath, ".mkv"))
+ const std::string embeddedArt =
+ GetEmbeddedArt(m_movieItem->GetVideoInfoTag()->m_strFileNameAndPath, "fanart");
+ if (!embeddedArt.empty())
{
- CFileItem item(m_movieItem->GetVideoInfoTag()->m_strFileNameAndPath, false);
- CVideoTagLoaderFFmpeg loader(item, nullptr, false);
- CVideoInfoTag tag;
- loader.Load(tag, false, nullptr);
- for (const auto& it : tag.m_coverArt)
- {
- if (it.m_type == "fanart")
- {
- CFileItemPtr itemF(new CFileItem("fanart://Embedded", false));
- embeddedArt = CTextureUtils::GetWrappedImageURL(item.GetPath(), "video_fanart");
- itemF->SetArt("thumb", embeddedArt);
- itemF->SetLabel(g_localizeStrings.Get(13520));
- items.Add(itemF);
- }
- }
+ const auto itemEmbedded = std::make_shared<CFileItem>("fanart://Embedded", false);
+ itemEmbedded->SetArt("thumb", embeddedArt);
+ itemEmbedded->SetLabel(g_localizeStrings.Get(13520));
+ items.Add(itemEmbedded);
}
// Grab the thumbnails from the web
@@ -1976,24 +1998,14 @@ bool CGUIDialogVideoInfo::ManageVideoItemArtwork(const std::shared_ptr<CFileItem
noneitem->SetArt("icon", item->m_bIsFolder ? "DefaultFolder.png" : "DefaultPicture.png");
noneitem->SetLabel(g_localizeStrings.Get(13515));
- std::string embeddedArt;
- if (URIUtils::HasExtension(item->GetVideoInfoTag()->m_strFileNameAndPath, ".mkv"))
+ const std::string embeddedArt =
+ GetEmbeddedArt(item->GetVideoInfoTag()->m_strFileNameAndPath, artType);
+ if (!embeddedArt.empty())
{
- CFileItem itemCopy(item->GetVideoInfoTag()->m_strFileNameAndPath, false);
- CVideoTagLoaderFFmpeg loader(itemCopy, nullptr, false);
- CVideoInfoTag tag;
- loader.Load(tag, false, nullptr);
- for (const auto& it : tag.m_coverArt)
- {
- if (it.m_type == artType)
- {
- CFileItemPtr itemF(new CFileItem("thumb://Embedded", false));
- embeddedArt = CTextureUtils::GetWrappedImageURL(itemCopy.GetPath(), "video_" + artType);
- itemF->SetArt("thumb", embeddedArt);
- itemF->SetLabel(g_localizeStrings.Get(13519));
- items.Add(itemF);
- }
- }
+ const auto itemEmbedded = std::make_shared<CFileItem>("thumb://Embedded", false);
+ itemEmbedded->SetArt("thumb", embeddedArt);
+ itemEmbedded->SetLabel(g_localizeStrings.Get(13519));
+ items.Add(itemEmbedded);
}
std::string localThumb;