Skip to content

Commit

Permalink
[video] Fix setting artwork for videos with multiple versions via vid…
Browse files Browse the repository at this point in the history
…eo info dialog's 'choose art' button or 'choose art' context menu item.
  • Loading branch information
ksooo committed Jan 5, 2024
1 parent 9e57727 commit 16c7475
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
17 changes: 15 additions & 2 deletions xbmc/video/VideoItemArtworkHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,21 @@ void CVideoItemArtworkHandler::PersistArt(const std::string& art)
return;
}

videodb.SetArtForItem(m_item->GetVideoInfoTag()->m_iDbId, m_item->GetVideoInfoTag()->m_type,
m_artType, art);
bool allPersisted{false};
if (m_item->HasVideoVersions())
{
// write video version artwork data to database
const auto* tag = m_item->GetVideoInfoTag();
videodb.SetArtForItem(tag->m_iFileId, MediaTypeVideoVersion, m_artType, art);

// additionally, write default version artwork data to database, for compatibility reasons
allPersisted = !tag->IsDefaultVideoVersion();
}
if (!allPersisted)
{
videodb.SetArtForItem(m_item->GetVideoInfoTag()->m_iDbId, m_item->GetVideoInfoTag()->m_type,
m_artType, art);
}
}

void CVideoItemArtworkHandler::AddItemPathStringToFileBrowserSources(
Expand Down
3 changes: 3 additions & 0 deletions xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ void CGUIDialogVideoManagerVersions::SetDefaultVideoVersion(const CFileItem& ver
// set the specified video version as default
m_database.SetDefaultVideoVersion(itemType, dbId, version.GetVideoInfoTag()->m_iDbId);

// update default artwork
m_database.SetArtForItem(dbId, m_videoAsset->GetVideoInfoTag()->m_type, version.GetArt());

// update the video item
m_videoAsset->SetPath(version.GetPath());
m_videoAsset->SetDynPath(version.GetPath());
Expand Down

0 comments on commit 16c7475

Please sign in to comment.