Skip to content

Commit

Permalink
Merge pull request xbmc#24430 from ksooo/video-info-tags-asset-info
Browse files Browse the repository at this point in the history
[video][Estuary] Video Versions: Improvements and Fixes
  • Loading branch information
ksooo committed Jan 6, 2024
2 parents a24a80f + 5ebfe93 commit 00216dc
Show file tree
Hide file tree
Showing 21 changed files with 320 additions and 147 deletions.
8 changes: 6 additions & 2 deletions addons/resource.language.en_gb/resources/strings.po
Expand Up @@ -23737,9 +23737,9 @@ msgstr ""

# 40000 to 40800 are reserved for Video Versions feature

#. Generic video versions label (plural)
#: xbmc/filesystem/VideoDatabaseDirectory.cpp
#: xbmc/filesystem/VideoDatabaseDirectory/DirectoryNodeMoviesOverview.cpp
#: xbmc/video/windows/GUIWindowVideoBase.cpp
#: addons/skin.estuary/xml/DialogVideoInfo.xml
msgctxt "#40000"
msgid "Versions"
Expand All @@ -23757,7 +23757,11 @@ msgctxt "#40002"
msgid "Add as version to..."
msgstr ""

#empty string with id 40003
#. Generic video version label (singular)
#: addons/skin.estuary/xml/DialogVideoInfo.xml
msgctxt "#40003"
msgid "Version"
msgstr ""

#. New video version dialog button
#: xbmc/video/dialogs/GUIDialogVideoManager.cpp
Expand Down
6 changes: 6 additions & 0 deletions addons/skin.estuary/xml/DialogVideoInfo.xml
Expand Up @@ -153,6 +153,12 @@
<onup>50</onup>
<onright>140</onright>
<onleft>140</onleft>
<include content="InfoDialogMetadata">
<param name="control_id" value="146" />
<param name="label" value="[COLOR button_focus]$LOCALIZE[40003]: [/COLOR]$INFO[ListItem.VideoVersionName]" />
<param name="altlabel" value="$LOCALIZE[40003]: $INFO[ListItem.VideoVersionname]" />
<param name="visible" value="!String.IsEmpty(ListItem.VideoVersionName)" />
</include>
<include content="InfoDialogMetadata">
<param name="control_id" value="147" />
<param name="label" value="$INFO[ListItem.Director,[COLOR button_focus]$LOCALIZE[20339]: [/COLOR]]" />
Expand Down
2 changes: 1 addition & 1 deletion addons/skin.estuary/xml/MyVideoNav.xml
Expand Up @@ -41,7 +41,7 @@
<aligny>center</aligny>
<height>110</height>
<font>font36_title</font>
<label>$INFO[ListItem.Label]</label>
<label>$INFO[ListItem.Title]</label>
</control>
<control type="textbox">
<left>30</left>
Expand Down
19 changes: 15 additions & 4 deletions xbmc/FileItem.cpp
Expand Up @@ -1680,9 +1680,19 @@ bool CFileItem::IsSamePath(const CFileItem *item) const
}
if (HasVideoInfoTag() && item->HasVideoInfoTag())
{
if (GetVideoInfoTag()->m_iDbId != -1 && item->GetVideoInfoTag()->m_iDbId != -1)
return ((GetVideoInfoTag()->m_iDbId == item->GetVideoInfoTag()->m_iDbId) &&
(GetVideoInfoTag()->m_type == item->GetVideoInfoTag()->m_type));
const CVideoInfoTag* myTag{GetVideoInfoTag()};
const CVideoInfoTag* otherTag{item->GetVideoInfoTag()};
if (myTag->m_iDbId != -1 && otherTag->m_iDbId != -1)
{
if ((myTag->m_iDbId == otherTag->m_iDbId) && (myTag->m_type == otherTag->m_type))
{
// for movies with multiple versions, wie need also to check the file id
if (HasVideoVersions() && item->HasVideoVersions() && myTag->m_iFileId != -1 &&
otherTag->m_iFileId != -1)
return myTag->m_iFileId == otherTag->m_iFileId;
return true;
}
}
}
if (IsMusicDb() && HasMusicInfoTag())
{
Expand Down Expand Up @@ -3787,7 +3797,8 @@ bool CFileItem::LoadDetails()
bool ret{false};
auto tag{std::make_unique<CVideoInfoTag>()};
if (params.GetMovieId() >= 0)
ret = db.GetMovieInfo(GetPath(), *tag, static_cast<int>(params.GetMovieId()));
ret = db.GetMovieInfo(GetPath(), *tag, static_cast<int>(params.GetMovieId()),
static_cast<int>(params.GetVideoVersionId()));
else if (params.GetMVideoId() >= 0)
ret = db.GetMusicVideoInfo(GetPath(), *tag, static_cast<int>(params.GetMVideoId()));
else if (params.GetEpisodeId() >= 0)
Expand Down
8 changes: 8 additions & 0 deletions xbmc/GUIInfoManager.cpp
Expand Up @@ -6941,6 +6941,13 @@ const infomap container_str[] = {{ "property", CONTAINER_PROPERTY },
/// <p><hr>
/// @skinning_v21 **[New Infolabel]** \link ListItem_IsVideoExtra `ListItem.IsVideoExtra`\endlink
/// }
/// \table_row3{ <b>`ListItem.VideoVersionName`</b>,
/// \anchor ListItem_VideoVersionName
/// _string_,
/// @return String containing the name of the version of a video - empty if no version available
/// <p><hr>
/// @skinning_v21 **[New Infolabel]** \link ListItem_VideoVersionName `ListItem.VideoVersionName`\endlink
/// }
/// \table_end
///
/// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -7160,6 +7167,7 @@ const infomap listitem_labels[]= {{ "thumb", LISTITEM_THUMB },
{ "songvideourl", LISTITEM_SONG_VIDEO_URL },
{ "hasvideoversions", LISTITEM_HASVIDEOVERSIONS },
{ "isvideoextra", LISTITEM_ISVIDEOEXTRA },
{ "videoversionname", LISTITEM_VIDEOVERSION_NAME },
};
// clang-format on

Expand Down
1 change: 1 addition & 0 deletions xbmc/guilib/guiinfo/GUIInfoLabels.h
Expand Up @@ -975,6 +975,7 @@ static constexpr unsigned int SYSTEM_LOCALE = 1012;
#define LISTITEM_VIDEO_HEIGHT (LISTITEM_START + 212)
#define LISTITEM_HASVIDEOVERSIONS (LISTITEM_START + 213)
#define LISTITEM_ISVIDEOEXTRA (LISTITEM_START + 214)
#define LISTITEM_VIDEOVERSION_NAME (LISTITEM_START + 215)

#define LISTITEM_END (LISTITEM_START + 2500)

Expand Down
18 changes: 18 additions & 0 deletions xbmc/guilib/guiinfo/VideoGUIInfo.cpp
Expand Up @@ -521,6 +521,24 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont
case LISTITEM_VIDEO_HDR_TYPE:
value = tag->m_streamDetails.GetVideoHdrType();
return true;
case LISTITEM_VIDEOVERSION_NAME:
value = tag->GetAssetInfo().GetTitle();
return true;
case LISTITEM_LABEL:
{
//! @todo get rid of "videos with versions as folder" hack!

// special casing for "show videos with multiple versions as folders", where the label
// should be the video version, not the movie title.
CGUIWindow* videoNav{
CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_VIDEO_NAV)};
if (videoNav && videoNav->GetProperty("VideoVersionsFolderView").asBoolean())
{
value = tag->GetAssetInfo().GetTitle();
return true;
}
break;
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion xbmc/interfaces/json-rpc/PlayerOperations.cpp
Expand Up @@ -223,7 +223,8 @@ JSONRPC_STATUS CPlayerOperations::GetItem(const std::string &method, ITransportL
{
case VideoDbContentType::MOVIES:
videodatabase.GetMovieInfo("", *(fileItem->GetVideoInfoTag()),
fileItem->GetVideoInfoTag()->m_iDbId);
fileItem->GetVideoInfoTag()->m_iDbId,
fileItem->GetVideoInfoTag()->GetAssetInfo().GetId());
break;

case VideoDbContentType::MUSICVIDEOS:
Expand Down
12 changes: 8 additions & 4 deletions xbmc/interfaces/json-rpc/VideoLibrary.cpp
Expand Up @@ -92,7 +92,9 @@ JSONRPC_STATUS CVideoLibrary::GetMovieDetails(const std::string &method, ITransp
return InternalError;

CVideoInfoTag infos;
if (!videodatabase.GetMovieInfo("", infos, id, RequiresAdditionalDetails(MediaTypeMovie, parameterObject)) || infos.m_iDbId <= 0)
if (!videodatabase.GetMovieInfo("", infos, id, -1, //! @todo API support for video version id
RequiresAdditionalDetails(MediaTypeMovie, parameterObject)) ||
infos.m_iDbId <= 0)
return InvalidParams;

HandleFileItem("movieid", true, "moviedetails", std::make_shared<CFileItem>(infos),
Expand Down Expand Up @@ -606,7 +608,8 @@ JSONRPC_STATUS CVideoLibrary::SetMovieDetails(const std::string &method, ITransp
return InternalError;

CVideoInfoTag infos;
if (!videodatabase.GetMovieInfo("", infos, id) || infos.m_iDbId <= 0)
if (!videodatabase.GetMovieInfo("", infos, id, -1) || //! @todo API support for video version id)
infos.m_iDbId <= 0)
return InvalidParams;

// get artwork
Expand Down Expand Up @@ -861,7 +864,8 @@ JSONRPC_STATUS CVideoLibrary::RefreshMovie(const std::string &method, ITransport
return InternalError;

CVideoInfoTag infos;
if (!videodatabase.GetMovieInfo("", infos, id) || infos.m_iDbId <= 0)
if (!videodatabase.GetMovieInfo("", infos, id, -1) || //! @todo API support for video version id
infos.m_iDbId <= 0)
return InvalidParams;

bool ignoreNfo = parameterObject["ignorenfo"].asBoolean();
Expand Down Expand Up @@ -1067,7 +1071,7 @@ bool CVideoLibrary::FillFileItemList(const CVariant &parameterObject, CFileItemL
if (movieID > 0)
{
CVideoInfoTag details;
videodatabase.GetMovieInfo("", details, movieID);
videodatabase.GetMovieInfo("", details, movieID, -1); //! @todo API support for video version id
if (!details.IsEmpty())
{
list.Add(std::make_shared<CFileItem>(details));
Expand Down
3 changes: 2 additions & 1 deletion xbmc/network/upnp/UPnPServer.cpp
Expand Up @@ -362,7 +362,8 @@ PLT_MediaObject* CUPnPServer::Build(const std::shared_ptr<CFileItem>& item,
if (!db.Open() ) return NULL;

if (params.GetMovieId() >= 0 )
db.GetMovieInfo((const char*)path, *item->GetVideoInfoTag(), params.GetMovieId());
db.GetMovieInfo(static_cast<const char*>(path), *item->GetVideoInfoTag(),
params.GetMovieId(), params.GetVideoVersionId());
else if (params.GetMVideoId() >= 0 )
db.GetMusicVideoInfo((const char*)path, *item->GetVideoInfoTag(), params.GetMVideoId());
else if (params.GetEpisodeId() >= 0 )
Expand Down

0 comments on commit 00216dc

Please sign in to comment.