Skip to content

Commit

Permalink
Merge pull request xbmc#24356 from ksooo/video-versions-extras-stuff
Browse files Browse the repository at this point in the history
[video] Video Versions/Extras: More smaller cleanup and fixes
  • Loading branch information
ksooo authored Dec 29, 2023
2 parents 4532c74 + ec8a7c8 commit f89e88a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
6 changes: 3 additions & 3 deletions addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -23754,7 +23754,7 @@ msgstr ""
#. Manage video version dialog title
#: xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp
msgctxt "#40002"
msgid "Convert into an additional version"
msgid "Add as version to..."
msgstr ""

#empty string with id 40003
Expand Down Expand Up @@ -23867,10 +23867,10 @@ msgctxt "#40020"
msgid "Are you sure to remove version \"{0:s}\"?"
msgstr ""

#. Convert video to version context menu item
#. Add as version to a movie context menu item
#: xbmc/video/dialogs/GUIDialogVideoInfo.cpp
msgctxt "#40021"
msgid "Convert to version"
msgid "Add as version to..."
msgstr ""

#. Manage video version dialog title
Expand Down
33 changes: 18 additions & 15 deletions xbmc/video/VideoDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,8 @@ int CVideoDatabase::GetMovieId(const std::string& strFilenameAndPath)
if (idFile == -1)
strSQL=PrepareSQL("select idMovie from movie join files on files.idFile=movie.idFile where files.idPath=%i",idPath);
else
strSQL = PrepareSQL("select idMedia from videoversion where idFile = %i", idFile);
strSQL = PrepareSQL("SELECT idMedia FROM videoversion WHERE idFile = %i AND itemType = %i",
idFile, VideoAssetType::VERSION);

CLog::Log(LOGDEBUG, LOGDATABASE, "{} ({}), query = {}", __FUNCTION__,
CURL::GetRedacted(strFilenameAndPath), strSQL);
Expand Down Expand Up @@ -12340,21 +12341,23 @@ bool CVideoDatabase::GetVideoVersionsNav(const std::string& strBaseDir,
std::string strSQL;

if (idMedia != -1)
strSQL = PrepareSQL("SELECT videoversiontype.name AS name,"
" videoversiontype.id AS id "
"FROM videoversiontype"
" JOIN videoversion ON"
" videoversion.idType = videoversiontype.id "
"WHERE idMedia = %i AND mediaType = '%s'",
idMedia, mediaType.c_str());
strSQL =
PrepareSQL("SELECT videoversiontype.name AS name,"
" videoversiontype.id AS id "
"FROM videoversiontype"
" JOIN videoversion ON"
" videoversion.idType = videoversiontype.id "
"WHERE idMedia = %i AND mediaType = '%s' AND videoversiontype.itemType = %i",
idMedia, mediaType.c_str(), VideoAssetType::VERSION);
else
strSQL = PrepareSQL("SELECT DISTINCT videoversiontype.name AS name,"
" videoversiontype.id AS id "
"FROM videoversiontype"
" JOIN videoversion ON"
" videoversion.idType = videoversiontype.id "
"WHERE name != '' AND owner IN (%i, %i)",
VideoAssetTypeOwner::SYSTEM, VideoAssetTypeOwner::USER);
strSQL = PrepareSQL(
"SELECT DISTINCT videoversiontype.name AS name,"
" videoversiontype.id AS id "
"FROM videoversiontype"
" JOIN videoversion ON"
" videoversion.idType = videoversiontype.id "
"WHERE name != '' AND owner IN (%i, %i) AND videoversiontype.itemType = %i",
VideoAssetTypeOwner::SYSTEM, VideoAssetTypeOwner::USER, VideoAssetType::VERSION);

m_pDS->query(strSQL);

Expand Down
6 changes: 3 additions & 3 deletions xbmc/video/dialogs/GUIDialogVideoInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,11 +1075,11 @@ int CGUIDialogVideoInfo::ManageVideoItem(const std::shared_ptr<CFileItem>& item)
// set or change movie set the movie belongs to
buttons.Add(CONTEXT_BUTTON_SET_MOVIESET, 20465);

if (!item->GetVideoInfoTag()->HasVideoVersions())
buttons.Add(CONTEXT_BUTTON_CONVERT_VIDEOVERSION, 40021); // Convert to version

// manage video versions
buttons.Add(CONTEXT_BUTTON_MANAGE_VIDEOVERSION, 40001); // Manage versions

if (!item->GetVideoInfoTag()->HasVideoVersions())
buttons.Add(CONTEXT_BUTTON_CONVERT_VIDEOVERSION, 40021); // Add as version to...
}

if (type == MediaTypeEpisode &&
Expand Down

0 comments on commit f89e88a

Please sign in to comment.