Skip to content
This repository
Browse code

jsonrpc: use CGUIInfoManager::GetCurrentMovie/SongTag() as fallback i…

…n Player.GetItem
  • Loading branch information...
commit 73fd7b21ce4bc5d53c7e37e497a64132648b3110 1 parent 487e5ad
Sascha Montellese authored February 22, 2012
14  xbmc/FileItem.cpp
@@ -97,6 +97,20 @@ CFileItem::CFileItem(const CStdString &path, const CAlbum& album)
97 97
   CMusicDatabase::SetPropertiesFromAlbum(*this,album);
98 98
 }
99 99
 
  100
+CFileItem::CFileItem(const CMusicInfoTag& music)
  101
+{
  102
+  m_musicInfoTag = NULL;
  103
+  m_videoInfoTag = NULL;
  104
+  m_pictureInfoTag = NULL;
  105
+  Reset();
  106
+  SetLabel(music.GetTitle());
  107
+  m_strPath = music.GetURL();
  108
+  m_bIsFolder = URIUtils::HasSlashAtEnd(m_strPath);
  109
+  *GetMusicInfoTag() = music;
  110
+  FillInDefaultIcon();
  111
+  SetCachedMusicThumb();
  112
+}
  113
+
100 114
 CFileItem::CFileItem(const CVideoInfoTag& movie)
101 115
 {
102 116
   m_musicInfoTag = NULL;
1  xbmc/FileItem.h
@@ -73,6 +73,7 @@ class CFileItem :
73 73
   CFileItem(const CStdString &path, const CAlbum& album);
74 74
   CFileItem(const CArtist& artist);
75 75
   CFileItem(const CGenre& genre);
  76
+  CFileItem(const MUSIC_INFO::CMusicInfoTag& music);
76 77
   CFileItem(const CVideoInfoTag& movie);
77 78
   CFileItem(const CMediaSource& share);
78 79
   virtual ~CFileItem(void);
19  xbmc/interfaces/json-rpc/PlayerOperations.cpp
@@ -34,6 +34,7 @@
34 34
 #include "VideoLibrary.h"
35 35
 #include "video/VideoDatabase.h"
36 36
 #include "AudioLibrary.h"
  37
+#include "GUIInfoManager.h"
37 38
 
38 39
 using namespace JSONRPC;
39 40
 using namespace PLAYLIST;
@@ -101,11 +102,23 @@ JSONRPC_STATUS CPlayerOperations::GetItem(const CStdString &method, ITransportLa
101 102
     {
102 103
       if (g_application.CurrentFileItem().GetLabel().empty())
103 104
       {
104  
-        CFileItem tmpItem;
  105
+        CFileItem tmpItem = g_application.CurrentFileItem();
105 106
         if (player == Video)
106  
-          CVideoLibrary::FillFileItem(g_application.CurrentFile(), tmpItem);
  107
+        {
  108
+          if (!CVideoLibrary::FillFileItem(g_application.CurrentFile(), tmpItem))
  109
+          {
  110
+            tmpItem = CFileItem(*g_infoManager.GetCurrentMovieTag());
  111
+            tmpItem.SetPath(g_application.CurrentFileItem().GetPath());
  112
+          }
  113
+        }
107 114
         else
108  
-          CAudioLibrary::FillFileItem(g_application.CurrentFile(), tmpItem);
  115
+        {
  116
+          if (!CAudioLibrary::FillFileItem(g_application.CurrentFile(), tmpItem))
  117
+          {
  118
+            tmpItem = CFileItem(*g_infoManager.GetCurrentSongTag());
  119
+            tmpItem.SetPath(g_application.CurrentFileItem().GetPath());
  120
+          }
  121
+        }
109 122
 
110 123
         fileItem = CFileItemPtr(new CFileItem(tmpItem));
111 124
       }

0 notes on commit 73fd7b2

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