Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

allowed PlayMedia from APIs and Plugin Resolves

Added Plugin resolution to PlayMedia to allow plugins to resolve to
Smart Playlists, Internet playlist streams, Last FM etc.
Modified application messenger to check attempts to play single items,
and routed them through PlayMedia instead. This allows JSON API and others
to play the item types only available through PlayMedia
  • Loading branch information...
commit 9fd3ad8d823597344420ceae8940ad5b168a6f85 1 parent 1227f1d
authored March 13, 2011
8  xbmc/Application.cpp
@@ -3349,6 +3349,14 @@ void CApplication::Stop()
3349 3349
 
3350 3350
 bool CApplication::PlayMedia(const CFileItem& item, int iPlaylist)
3351 3351
 {
  3352
+  //AW: If item is a plugin, expand out now and run ourselves again
  3353
+  if (item.IsPlugin())
  3354
+  { // we modify the item so that it becomes a real URL
  3355
+    CFileItem item_new(item);
  3356
+    if (XFILE::CPluginDirectory::GetPluginResult(item.m_strPath, item_new))
  3357
+      return PlayMedia(item_new, iPlaylist);
  3358
+    return false;
  3359
+  }
3352 3360
   if (item.IsLastFM())
3353 3361
   {
3354 3362
     g_partyModeManager.Disable();
18  xbmc/ApplicationMessenger.cpp
@@ -307,6 +307,7 @@ case TMSG_POWERDOWN:
307 307
 
308 308
           if (list->Size() > 0)
309 309
           {
  310
+
310 311
             int playlist = PLAYLIST_MUSIC;
311 312
             for (int i = 0; i < list->Size(); i++)
312 313
             {
@@ -317,10 +318,19 @@ case TMSG_POWERDOWN:
317 318
               }
318 319
             }
319 320
 
320  
-            g_playlistPlayer.ClearPlaylist(playlist);
321  
-            g_playlistPlayer.Add(playlist, (*list));
322  
-            g_playlistPlayer.SetCurrentPlaylist(playlist);
323  
-            g_playlistPlayer.Play(pMsg->dwParam1);
  321
+            //AW: for single item lists try PlayMedia. This covers some more cases where a playlist is not appropriate
  322
+            //It will fall through to PlayFile
  323
+            if (list->Size() == 1 && !(*list)[0]->IsPlayList())
  324
+            {
  325
+              g_application.PlayMedia((*list)[0], playlist);
  326
+            }
  327
+            else
  328
+            {
  329
+                g_playlistPlayer.ClearPlaylist(playlist);
  330
+              g_playlistPlayer.Add(playlist, (*list));
  331
+              g_playlistPlayer.SetCurrentPlaylist(playlist);
  332
+              g_playlistPlayer.Play(pMsg->dwParam1);
  333
+            }
324 334
           }
325 335
 
326 336
           delete list;

0 notes on commit 9fd3ad8

Sascha Montellese

Please remove the "AW: " from the comments. git will know that it was you who did the changes anyway.

Sascha Montellese

No need for this empty line

Sascha Montellese

Remove the "AW: " as well

Sascha Montellese

No need for these curly brackets on a one-liner

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