added: startposition to xbmc.PlayPlaylist python method
authorspiff <spiff@xbmc.org>
Wed, 1 May 2013 19:08:48 +0000 (21:08 +0200)
committerspiff <spiff@xbmc.org>
Wed, 1 May 2013 19:09:56 +0000 (21:09 +0200)
xbmc/interfaces/legacy/Player.cpp
xbmc/interfaces/legacy/Player.h

index 73ecb51..ed7887f 100644 (file)
@@ -112,7 +112,7 @@ namespace XBMCAddon
       CApplicationMessenger::Get().PlayListPlayerPlay(g_playlistPlayer.GetCurrentSong());
     }
 
-    void Player::playPlaylist(const PlayList* playlist, bool windowed)
+    void Player::playPlaylist(const PlayList* playlist, bool windowed, int startpos)
     {
       TRACE;
       DelayedCallGuard dc(languageHook);
@@ -127,7 +127,9 @@ namespace XBMCAddon
         // play a python playlist (a playlist from playlistplayer.cpp)
         iPlayList = playlist->getPlayListId();
         g_playlistPlayer.SetCurrentPlaylist(iPlayList);
-        CApplicationMessenger::Get().PlayListPlayerPlay();
+        if (startpos > -1)
+          g_playlistPlayer.SetCurrentSong(startpos);
+        CApplicationMessenger::Get().PlayListPlayerPlay(startpos);
       }
       else
         playCurrent(windowed);
index bfda086..bf5fe66 100644 (file)
@@ -92,10 +92,11 @@ namespace XBMCAddon
       void playStream(const String& item = emptyString, const XBMCAddon::xbmcgui::ListItem* listitem = NULL, bool windowed = false);
 
       /**
-       * playPlaylist([playlist, windowed]) -- Play this item.
+       * playPlaylist([playlist, windowed, startpos]) -- Play this item.
        * 
        * playlist       : [opt] playlist.
        * windowed       : [opt] bool - true=play video windowed, false=play users preference.(default)
+       * startpos       : [opt] int - Playlist starting position (0 based). If not given, current position is used
        * 
        * *Note, If playlist is not given then the Player will try to play the current item
        *        in the current playlist.
@@ -105,7 +106,8 @@ namespace XBMCAddon
        * 
        * example:
        */
-      void playPlaylist(const PlayList* playlist = NULL, bool windowed = false);
+      void playPlaylist(const PlayList* playlist = NULL,
+                        bool windowed = false, int startpos=-1);
 
       /**
        * play() -- try to play the current item in the current playlist.