Skip to content

Commit

Permalink
Allowed PlayMedia from APIs and Plugin Resolves
Browse files Browse the repository at this point in the history
Add Plugin resolution to PlayMedia to allow plugins to resolve to
Smart Playlists, Internet playlist streams, Last FM etc.
Modified application messenger to check attempt to play single items,
and routed them through PlayMedia instead. This allows JSON API and others
to play the item types on available through the PlayMedia function
  • Loading branch information
AWilco authored and Montellese committed Sep 12, 2011
1 parent 5da4c78 commit ad5b5ce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
8 changes: 8 additions & 0 deletions xbmc/Application.cpp 100644 → 100755
Expand Up @@ -3334,6 +3334,14 @@ void CApplication::Stop(int exitCode)

bool CApplication::PlayMedia(const CFileItem& item, int iPlaylist)
{
//If item is a plugin, expand out now and run ourselves again
if (item.IsPlugin())
{
CFileItem item_new(item);
if (XFILE::CPluginDirectory::GetPluginResult(item.GetPath(), item_new))
return PlayMedia(item_new, iPlaylist);
return false;
}
if (item.IsLastFM())
{
g_partyModeManager.Disable();
Expand Down
15 changes: 11 additions & 4 deletions xbmc/ApplicationMessenger.cpp 100644 → 100755
Expand Up @@ -314,10 +314,17 @@ case TMSG_POWERDOWN:
}
}

g_playlistPlayer.ClearPlaylist(playlist);
g_playlistPlayer.Add(playlist, (*list));
g_playlistPlayer.SetCurrentPlaylist(playlist);
g_playlistPlayer.Play(pMsg->dwParam1);
//For single item lists try PlayMedia. This covers some more cases where a playlist is not appropriate
//It will fall through to PlayFile
if (list->Size() == 1 && !(*list)[0]->IsPlayList())
g_application.PlayMedia(*((*list)[0]), playlist);
else
{
g_playlistPlayer.ClearPlaylist(playlist);
g_playlistPlayer.Add(playlist, (*list));
g_playlistPlayer.SetCurrentPlaylist(playlist);
g_playlistPlayer.Play(pMsg->dwParam1);
}
}

delete list;
Expand Down

0 comments on commit ad5b5ce

Please sign in to comment.