Skip to content

Commit

Permalink
Merge pull request xbmc#23717 from ksooo/video-fix-choose-art
Browse files Browse the repository at this point in the history
[video] Fix 'Local art' missing in art selection dialog.
  • Loading branch information
ksooo authored Sep 4, 2023
2 parents a4e19af + b06f51f commit ad82a1c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
20 changes: 14 additions & 6 deletions xbmc/FileItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3382,20 +3382,22 @@ std::string CFileItem::GetLocalArtBaseFilename() const

std::string CFileItem::GetLocalArtBaseFilename(bool& useFolder) const
{
std::string strFile = m_strPath;
std::string strFile;
if (IsStack())
{
std::string strPath;
URIUtils::GetParentPath(m_strPath,strPath);
strFile = URIUtils::AddFileToFolder(strPath, URIUtils::GetFileName(CStackDirectory::GetStackedTitlePath(strFile)));
strFile = URIUtils::AddFileToFolder(
strPath, URIUtils::GetFileName(CStackDirectory::GetStackedTitlePath(m_strPath)));
}

if (URIUtils::IsInRAR(strFile) || URIUtils::IsInZIP(strFile))
std::string file = strFile.empty() ? m_strPath : strFile;
if (URIUtils::IsInRAR(file) || URIUtils::IsInZIP(file))
{
std::string strPath = URIUtils::GetDirectory(strFile);
std::string strPath = URIUtils::GetDirectory(file);
std::string strParent;
URIUtils::GetParentPath(strPath,strParent);
strFile = URIUtils::AddFileToFolder(strParent, URIUtils::GetFileName(strFile));
strFile = URIUtils::AddFileToFolder(strParent, URIUtils::GetFileName(file));
}

if (IsMultiPath())
Expand All @@ -3407,7 +3409,13 @@ std::string CFileItem::GetLocalArtBaseFilename(bool& useFolder) const
strFile = GetLocalMetadataPath();
}
else if (useFolder && !(m_bIsFolder && !IsFileFolder()))
strFile = URIUtils::GetDirectory(strFile);
{
file = strFile.empty() ? m_strPath : strFile;
strFile = URIUtils::GetDirectory(file);
}

if (strFile.empty())
strFile = GetDynPath();

return strFile;
}
Expand Down
22 changes: 20 additions & 2 deletions xbmc/video/dialogs/GUIDialogVideoInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,8 @@ bool CGUIDialogVideoInfo::ManageVideoItemArtwork(const std::shared_ptr<CFileItem
}
}

std::string localThumb;

bool local = false;
std::vector<std::string> thumbs;
if (type != MediaTypeArtist)
Expand Down Expand Up @@ -2056,8 +2058,7 @@ bool CGUIDialogVideoInfo::ManageVideoItemArtwork(const std::shared_ptr<CFileItem
else
noneitem->SetArt("icon", "DefaultActor.png");
}

if (type == MediaTypeVideoCollection)
else if (type == MediaTypeVideoCollection)
{
std::string localFile = FindLocalMovieSetArtworkFile(item, artType);
if (!localFile.empty())
Expand All @@ -2071,6 +2072,20 @@ bool CGUIDialogVideoInfo::ManageVideoItemArtwork(const std::shared_ptr<CFileItem
else
noneitem->SetArt("icon", "DefaultVideo.png");
}
else
{
localThumb = CVideoThumbLoader::GetLocalArt(*item, artType);
if (!localThumb.empty())
{
const auto localitem = std::make_shared<CFileItem>("thumb://Local", false);
localitem->SetArt("thumb", localThumb);
localitem->SetArt("icon", "DefaultPicture.png");
localitem->SetLabel(g_localizeStrings.Get(13514));
items.Add(localitem);
}
else
noneitem->SetArt("icon", "DefaultPicture.png");
}
}
else
{
Expand Down Expand Up @@ -2126,6 +2141,9 @@ bool CGUIDialogVideoInfo::ManageVideoItemArtwork(const std::shared_ptr<CFileItem
if (result == "thumb://Current")
result = currentThumb; // user chose the one they have

if (result == "thumb://Local")
result = localThumb;

if (result == "thumb://Embedded")
result = embeddedArt;

Expand Down

0 comments on commit ad82a1c

Please sign in to comment.