Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

jsonrpc: fix empty properties in Player.GetItem when playing a non-li…

…brary item through Player.Open (fixes #13344)
  • Loading branch information...
commit c6c47ad991e5b788cdfbb7144b276ba631ffd409 1 parent 334d12d
@Montellese Montellese authored
View
12 xbmc/FileItem.cpp
@@ -1468,7 +1468,8 @@ void CFileItem::UpdateInfo(const CFileItem &item, bool replaceLabels /*=true*/)
void CFileItem::SetFromVideoInfoTag(const CVideoInfoTag &video)
{
- SetLabel(video.m_strTitle);
+ if (!video.m_strTitle.empty())
+ SetLabel(video.m_strTitle);
if (video.m_strFileNameAndPath.IsEmpty())
{
m_strPath = video.m_strPath;
@@ -1489,7 +1490,8 @@ void CFileItem::SetFromVideoInfoTag(const CVideoInfoTag &video)
void CFileItem::SetFromAlbum(const CAlbum &album)
{
- SetLabel(album.strAlbum);
+ if (!album.strAlbum.empty())
+ SetLabel(album.strAlbum);
m_bIsFolder = true;
m_strLabel2 = StringUtils::Join(album.artist, g_advancedSettings.m_musicItemSeparator);
GetMusicInfoTag()->SetAlbum(album);
@@ -1499,8 +1501,10 @@ void CFileItem::SetFromAlbum(const CAlbum &album)
void CFileItem::SetFromSong(const CSong &song)
{
- SetLabel(song.strTitle);
- m_strPath = song.strFileName;
+ if (!song.strTitle.empty())
+ SetLabel(song.strTitle);
+ if (!song.strFileName.empty())
+ m_strPath = song.strFileName;
GetMusicInfoTag()->SetSong(song);
m_lStartOffset = song.iStartOffset;
m_lStartPartNumber = 1;
View
5 xbmc/interfaces/json-rpc/AudioLibrary.cpp
@@ -591,6 +591,11 @@ bool CAudioLibrary::FillFileItem(const CStdString &strFilename, CFileItemPtr &it
return false;
}
+ if (item->GetLabel().empty())
+ item->SetLabel(CUtil::GetTitleFromPath(strFilename, false));
+ if (item->GetLabel())
+ item->SetLabel(URIUtils::GetFileName(strFilename));
+
return true;
}
View
17 xbmc/interfaces/json-rpc/PlayerOperations.cpp
@@ -140,17 +140,21 @@ JSONRPC_STATUS CPlayerOperations::GetItem(const CStdString &method, ITransportLa
if (player == Video)
{
bool additionalInfo = false;
+ bool streamdetails = false;
for (CVariant::const_iterator_array itr = parameterObject["properties"].begin_array(); itr != parameterObject["properties"].end_array(); itr++)
{
CStdString fieldValue = itr->asString();
if (fieldValue == "cast" || fieldValue == "set" || fieldValue == "setid" || fieldValue == "showlink" || fieldValue == "resume")
additionalInfo = true;
+ else if (fieldValue == "streamdetails" && !fileItem->GetVideoInfoTag()->m_streamDetails.HasItems())
+ streamdetails = true;
}
- if (additionalInfo)
+ CVideoDatabase videodatabase;
+ if ((additionalInfo || streamdetails) &&
+ videodatabase.Open())
{
- CVideoDatabase videodatabase;
- if (videodatabase.Open())
+ if (additionalInfo)
{
switch (fileItem->GetVideoContentType())
{
@@ -171,9 +175,12 @@ JSONRPC_STATUS CPlayerOperations::GetItem(const CStdString &method, ITransportLa
default:
break;
}
-
- videodatabase.Close();
}
+
+ if (streamdetails)
+ videodatabase.GetStreamDetails(*(fileItem->GetVideoInfoTag()));
+
+ videodatabase.Close();
}
}
else if (player == Audio)
View
4 xbmc/interfaces/json-rpc/VideoLibrary.cpp
@@ -731,6 +731,10 @@ bool CVideoLibrary::FillFileItem(const CStdString &strFilename, CFileItemPtr &it
return false;
item->SetFromVideoInfoTag(details);
+ if (item->GetLabel().empty())
+ item->SetLabel(CUtil::GetTitleFromPath(strFilename, false));
+ if (item->GetLabel())
+ item->SetLabel(URIUtils::GetFileName(strFilename));
return true;
}

0 comments on commit c6c47ad

Please sign in to comment.
Something went wrong with that request. Please try again.