Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

jsonrpc: refactor (Audio|Video|Picture)Player and (Audio|Video)Playlist

Merged AudioPlayer, VideoPlayer and PicturePlayer into Player (thanks topfs2)
Merged AudioPlaylist and VideoPlaylist to replace Playlist and provide initial support for picture playlists (aka slideshows)
Players/Playlists are no longer accessed by their media type (video, audio, picture) but by a unique ID. Active players/playlists (their ID and media type) can still be retrieved using Player.GetActivePlayers/Playlist.GetPlaylists
Replaced Playlist.State with Playlist.GetProperties
Replaced Player.State, Player.GetTime and Player.GetPercentage with Player.GetProperties
Removed Playlist.SkipPrevious and Playlist.SkipNext (use Player.GoPrevious and Player.GoNext instead)
The following methods have been moved from the Playlist to the Player namespace: Play (renamed to Open), Shuffle, UnShuffle, Repeat
Refactored notifications for the Player namespace
Unified naming of position/item/index parameters in Player and Playlist namespaces
Merged XBMC.Play and XBMC.StartSlideshow into Player.Open
Make Playlist.Add, Playlist.Clear and Player.Open work for picture playlists (closes #11219)
Removed (Big|Small)Skip(Forward|Backward) from Player namespace
Replace Rewind and Forward with SetSpeed in Player namespace
Replace "value" parameter in "Player.SeekTime" with time struct parameters (thanks darwin; closes #11474)
Merge SeekTime, SeekPercentage and (Small|Big)Skip(Forward|Backward) into Seek in Player namespace
  • Loading branch information...
commit c4f161e177f5e079f2ba67c264c2ebb85a9a2b03 1 parent da78eaa
Sascha Montellese authored August 31, 2011

Showing 27 changed files with 1,961 additions and 2,576 deletions. Show diff stats Hide diff stats

  1. 6  project/VS2010Express/XBMC.vcxproj
  2. 18  project/VS2010Express/XBMC.vcxproj.filters
  3. 24  xbmc/Application.cpp
  4. 1  xbmc/PlayListPlayer.h
  5. 25  xbmc/interfaces/AnnouncementManager.cpp
  6. 195  xbmc/interfaces/json-rpc/AVPlayerOperations.cpp
  7. 53  xbmc/interfaces/json-rpc/AVPlayerOperations.h
  8. 237  xbmc/interfaces/json-rpc/AVPlaylistOperations.cpp
  9. 52  xbmc/interfaces/json-rpc/AVPlaylistOperations.h
  10. 6  xbmc/interfaces/json-rpc/FileItemHandler.cpp
  11. 125  xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
  12. 18  xbmc/interfaces/json-rpc/JSONUtils.h
  13. 3  xbmc/interfaces/json-rpc/Makefile
  14. 105  xbmc/interfaces/json-rpc/PicturePlayerOperations.cpp
  15. 50  xbmc/interfaces/json-rpc/PicturePlayerOperations.h
  16. 886  xbmc/interfaces/json-rpc/PlayerOperations.cpp
  17. 45  xbmc/interfaces/json-rpc/PlayerOperations.h
  18. 350  xbmc/interfaces/json-rpc/PlaylistOperations.cpp
  19. 20  xbmc/interfaces/json-rpc/PlaylistOperations.h
  20. 1,200  xbmc/interfaces/json-rpc/ServiceDescription.h
  21. 34  xbmc/interfaces/json-rpc/XBMCOperations.cpp
  22. 6  xbmc/interfaces/json-rpc/XBMCOperations.h
  23. 708  xbmc/interfaces/json-rpc/methods.json
  24. 61  xbmc/interfaces/json-rpc/notifications.json
  25. 301  xbmc/interfaces/json-rpc/types.json
  26. 6  xbmc/pictures/GUIWindowSlideShow.cpp
  27. 2  xbmc/pictures/GUIWindowSlideShow.h
6  project/VS2010Express/XBMC.vcxproj
@@ -460,14 +460,11 @@
460 460
     <ClCompile Include="..\..\xbmc\interfaces\info\InfoBool.cpp" />
461 461
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\ApplicationOperations.cpp" />
462 462
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.cpp" />
463  
-    <ClCompile Include="..\..\xbmc\interfaces\json-rpc\AVPlayerOperations.cpp" />
464  
-    <ClCompile Include="..\..\xbmc\interfaces\json-rpc\AVPlaylistOperations.cpp" />
465 463
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.cpp" />
466 464
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\FileOperations.cpp" />
467 465
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\InputOperations.cpp" />
468 466
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\JSONRPC.cpp" />
469 467
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\JSONServiceDescription.cpp" />
470  
-    <ClCompile Include="..\..\xbmc\interfaces\json-rpc\PicturePlayerOperations.cpp" />
471 468
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.cpp" />
472 469
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\PlaylistOperations.cpp" />
473 470
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\SystemOperations.cpp" />
@@ -1385,8 +1382,6 @@
1385 1382
     <ClInclude Include="..\..\xbmc\interfaces\info\InfoBool.h" />
1386 1383
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\ApplicationOperations.h" />
1387 1384
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.h" />
1388  
-    <ClInclude Include="..\..\xbmc\interfaces\json-rpc\AVPlayerOperations.h" />
1389  
-    <ClInclude Include="..\..\xbmc\interfaces\json-rpc\AVPlaylistOperations.h" />
1390 1385
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.h" />
1391 1386
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\FileOperations.h" />
1392 1387
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\IClient.h" />
@@ -1395,7 +1390,6 @@
1395 1390
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONRPC.h" />
1396 1391
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONServiceDescription.h" />
1397 1392
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONUtils.h" />
1398  
-    <ClInclude Include="..\..\xbmc\interfaces\json-rpc\PicturePlayerOperations.h" />
1399 1393
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.h" />
1400 1394
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\PlaylistOperations.h" />
1401 1395
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\ServiceDescription.h" />
18  project/VS2010Express/XBMC.vcxproj.filters
@@ -1472,12 +1472,6 @@
1472 1472
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.cpp">
1473 1473
       <Filter>interfaces\json-rpc</Filter>
1474 1474
     </ClCompile>
1475  
-    <ClCompile Include="..\..\xbmc\interfaces\json-rpc\AVPlayerOperations.cpp">
1476  
-      <Filter>interfaces\json-rpc</Filter>
1477  
-    </ClCompile>
1478  
-    <ClCompile Include="..\..\xbmc\interfaces\json-rpc\AVPlaylistOperations.cpp">
1479  
-      <Filter>interfaces\json-rpc</Filter>
1480  
-    </ClCompile>
1481 1475
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.cpp">
1482 1476
       <Filter>interfaces\json-rpc</Filter>
1483 1477
     </ClCompile>
@@ -1487,9 +1481,6 @@
1487 1481
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\JSONRPC.cpp">
1488 1482
       <Filter>interfaces\json-rpc</Filter>
1489 1483
     </ClCompile>
1490  
-    <ClCompile Include="..\..\xbmc\interfaces\json-rpc\PicturePlayerOperations.cpp">
1491  
-      <Filter>interfaces\json-rpc</Filter>
1492  
-    </ClCompile>
1493 1484
     <ClCompile Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.cpp">
1494 1485
       <Filter>interfaces\json-rpc</Filter>
1495 1486
     </ClCompile>
@@ -3937,12 +3928,6 @@
3937 3928
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.h">
3938 3929
       <Filter>interfaces\json-rpc</Filter>
3939 3930
     </ClInclude>
3940  
-    <ClInclude Include="..\..\xbmc\interfaces\json-rpc\AVPlayerOperations.h">
3941  
-      <Filter>interfaces\json-rpc</Filter>
3942  
-    </ClInclude>
3943  
-    <ClInclude Include="..\..\xbmc\interfaces\json-rpc\AVPlaylistOperations.h">
3944  
-      <Filter>interfaces\json-rpc</Filter>
3945  
-    </ClInclude>
3946 3931
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.h">
3947 3932
       <Filter>interfaces\json-rpc</Filter>
3948 3933
     </ClInclude>
@@ -3961,9 +3946,6 @@
3961 3946
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\JSONUtils.h">
3962 3947
       <Filter>interfaces\json-rpc</Filter>
3963 3948
     </ClInclude>
3964  
-    <ClInclude Include="..\..\xbmc\interfaces\json-rpc\PicturePlayerOperations.h">
3965  
-      <Filter>interfaces\json-rpc</Filter>
3966  
-    </ClInclude>
3967 3949
     <ClInclude Include="..\..\xbmc\interfaces\json-rpc\PlayerOperations.h">
3968 3950
       <Filter>interfaces\json-rpc</Filter>
3969 3951
     </ClInclude>
24  xbmc/Application.cpp
@@ -3898,7 +3898,10 @@ void CApplication::OnPlayBackPaused()
3898 3898
     getApplicationMessenger().HttpApi("broadcastlevel; OnPlayBackPaused;1");
3899 3899
 #endif
3900 3900
 
3901  
-  CAnnouncementManager::Announce(Player, "xbmc", "OnPause", m_itemCurrentFile);
  3901
+  CVariant param;
  3902
+  param["player"]["speed"] = 0;
  3903
+  param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist();
  3904
+  CAnnouncementManager::Announce(Player, "xbmc", "OnPause", m_itemCurrentFile, param);
3902 3905
 }
3903 3906
 
3904 3907
 void CApplication::OnPlayBackResumed()
@@ -3914,7 +3917,8 @@ void CApplication::OnPlayBackResumed()
3914 3917
 #endif
3915 3918
 
3916 3919
   CVariant param;
3917  
-  param["speed"] = 1;
  3920
+  param["player"]["speed"] = 1;
  3921
+  param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist();
3918 3922
   CAnnouncementManager::Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param);
3919 3923
 }
3920 3924
 
@@ -3935,8 +3939,9 @@ void CApplication::OnPlayBackSpeedChanged(int iSpeed)
3935 3939
 #endif
3936 3940
 
3937 3941
   CVariant param;
3938  
-  param["speed"] = iSpeed;
3939  
-  CAnnouncementManager::Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param);
  3942
+  param["player"]["speed"] = iSpeed;
  3943
+  param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist();
  3944
+  CAnnouncementManager::Announce(Player, "xbmc", "OnSpeedChanged", m_itemCurrentFile, param);
3940 3945
 }
3941 3946
 
3942 3947
 void CApplication::OnPlayBackSeek(int iTime, int seekOffset)
@@ -3956,9 +3961,11 @@ void CApplication::OnPlayBackSeek(int iTime, int seekOffset)
3956 3961
 #endif
3957 3962
 
3958 3963
   CVariant param;
3959  
-  param["time"] = iTime;
3960  
-  param["seekoffset"] = seekOffset;
3961  
-  CAnnouncementManager::Announce(Player, "xbmc", "OnSeek", param);
  3964
+  CJSONUtils::MillisecondsToTimeObject(iTime, param["player"]["time"]);
  3965
+  CJSONUtils::MillisecondsToTimeObject(seekOffset, param["player"]["seekoffset"]);;
  3966
+  param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist();
  3967
+  param["player"]["speed"] = GetPlaySpeed();
  3968
+  CAnnouncementManager::Announce(Player, "xbmc", "OnSeek", m_itemCurrentFile, param);
3962 3969
   g_infoManager.SetDisplayAfterSeek(2500, seekOffset/1000);
3963 3970
 }
3964 3971
 
@@ -4430,7 +4437,8 @@ bool CApplication::OnMessage(CGUIMessage& message)
4430 4437
       g_partyModeManager.OnSongChange(true);
4431 4438
 
4432 4439
       CVariant param;
4433  
-      param["speed"] = 1;
  4440
+      param["player"]["speed"] = 1;
  4441
+      param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist();
4434 4442
       CAnnouncementManager::Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param);
4435 4443
 
4436 4444
       DimLCDOnPlayback(true);
1  xbmc/PlayListPlayer.h
@@ -26,6 +26,7 @@
26 26
 #define PLAYLIST_NONE    -1
27 27
 #define PLAYLIST_MUSIC   0
28 28
 #define PLAYLIST_VIDEO   1
  29
+#define PLAYLIST_PICTURE 2
29 30
 
30 31
 class CFileItem; typedef boost::shared_ptr<CFileItem> CFileItemPtr;
31 32
 class CFileItemList;
25  xbmc/interfaces/AnnouncementManager.cpp
@@ -116,25 +116,16 @@ void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender,
116 116
   else if (item->HasMusicInfoTag())
117 117
   {
118 118
     id = item->GetMusicInfoTag()->GetDatabaseId();
119  
-
120  
-    if (item->IsAlbum())
121  
-      type = "album";
122  
-    else
123  
-    {
124  
-      type = "song";
125  
-
126  
-      if (id <= 0)
127  
-      {
128  
-        if (item->GetMusicInfoTag()->GetTrackNumber() > 0)
129  
-          object["track"] = item->GetMusicInfoTag()->GetTrackNumber();
130  
-        if (!item->GetMusicInfoTag()->GetAlbum().empty())
131  
-          object["album"] = item->GetMusicInfoTag()->GetAlbum();
132  
-      }
133  
-    }
  119
+    type = "song";
134 120
 
135 121
     if (id <= 0)
136 122
     {
137 123
       object["title"] = item->GetMusicInfoTag()->GetTitle();
  124
+
  125
+      if (item->GetMusicInfoTag()->GetTrackNumber() > 0)
  126
+        object["track"] = item->GetMusicInfoTag()->GetTrackNumber();
  127
+      if (!item->GetMusicInfoTag()->GetAlbum().empty())
  128
+        object["album"] = item->GetMusicInfoTag()->GetAlbum();
138 129
       if (!item->GetMusicInfoTag()->GetArtist().empty())
139 130
         object["artist"] = item->GetMusicInfoTag()->GetArtist();
140 131
     }
@@ -142,9 +133,9 @@ void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender,
142 133
   else
143 134
     type = "unknown";
144 135
 
145  
-  object["type"] = type;
  136
+  object["item"]["type"] = type;
146 137
   if (id > 0)
147  
-    object["id"] = id;
  138
+    object["item"]["id"] = id;
148 139
 
149 140
   Announce(flag, sender, message, object);
150 141
 }
195  xbmc/interfaces/json-rpc/AVPlayerOperations.cpp
... ...
@@ -1,195 +0,0 @@
1  
-/*
2  
- *      Copyright (C) 2005-2010 Team XBMC
3  
- *      http://www.xbmc.org
4  
- *
5  
- *  This Program is free software; you can redistribute it and/or modify
6  
- *  it under the terms of the GNU General Public License as published by
7  
- *  the Free Software Foundation; either version 2, or (at your option)
8  
- *  any later version.
9  
- *
10  
- *  This Program is distributed in the hope that it will be useful,
11  
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  
- *  GNU General Public License for more details.
14  
- *
15  
- *  You should have received a copy of the GNU General Public License
16  
- *  along with XBMC; see the file COPYING.  If not, write to
17  
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18  
- *  http://www.gnu.org/copyleft/gpl.html
19  
- *
20  
- */
21  
-
22  
-#include "AVPlayerOperations.h"
23  
-#include "Application.h"
24  
-#include "interfaces/Builtins.h"
25  
-#include "Util.h"
26  
-#include "PlayListPlayer.h"
27  
-#include "PartyModeManager.h"
28  
-
29  
-using namespace JSONRPC;
30  
-
31  
-JSON_STATUS CAVPlayerOperations::State(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
32  
-{
33  
-  if (!IsCorrectPlayer(method))
34  
-    return FailedToExecute;
35  
-
36  
-  result["playing"] = g_application.IsPlaying();
37  
-  result["paused"] = g_application.IsPaused();
38  
-  result["partymode"] = g_partyModeManager.IsEnabled();
39  
-
40  
-  return OK;
41  
-}
42  
-
43  
-JSON_STATUS CAVPlayerOperations::PlayPause(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
44  
-{
45  
-  if (!IsCorrectPlayer(method))
46  
-    return FailedToExecute;
47  
-
48  
-  CBuiltins::Execute("playercontrol(play)");
49  
-  result["playing"] = g_application.IsPlaying();
50  
-  result["paused"] = g_application.IsPaused();
51  
-  return OK;
52  
-}
53  
-
54  
-JSON_STATUS CAVPlayerOperations::Stop(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
55  
-{
56  
-  if (!IsCorrectPlayer(method))
57  
-    return FailedToExecute;
58  
-
59  
-  g_application.getApplicationMessenger().SendAction(CAction(ACTION_STOP));
60  
-  return ACK;
61  
-}
62  
-
63  
-JSON_STATUS CAVPlayerOperations::SkipPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
64  
-{
65  
-  if (!IsCorrectPlayer(method))
66  
-    return FailedToExecute;
67  
-
68  
-  g_application.getApplicationMessenger().SendAction(CAction(ACTION_PREV_ITEM));
69  
-  return ACK;
70  
-}
71  
-
72  
-JSON_STATUS CAVPlayerOperations::SkipNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
73  
-{
74  
-  if (!IsCorrectPlayer(method))
75  
-    return FailedToExecute;
76  
-
77  
-  g_application.getApplicationMessenger().SendAction(CAction(ACTION_NEXT_ITEM));
78  
-  return ACK;
79  
-}
80  
-
81  
-JSON_STATUS CAVPlayerOperations::BigSkipBackward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
82  
-{
83  
-  if (!IsCorrectPlayer(method))
84  
-    return FailedToExecute;
85  
-
86  
-  CBuiltins::Execute("playercontrol(bigskipbackward)");
87  
-  return ACK;
88  
-}
89  
-
90  
-JSON_STATUS CAVPlayerOperations::BigSkipForward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
91  
-{
92  
-  if (!IsCorrectPlayer(method))
93  
-    return FailedToExecute;
94  
-
95  
-  CBuiltins::Execute("playercontrol(bigskipforward)");
96  
-  return ACK;
97  
-}
98  
-
99  
-JSON_STATUS CAVPlayerOperations::SmallSkipBackward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
100  
-{
101  
-  if (!IsCorrectPlayer(method))
102  
-    return FailedToExecute;
103  
-
104  
-  CBuiltins::Execute("playercontrol(smallskipbackward)");
105  
-  return ACK;
106  
-}
107  
-
108  
-JSON_STATUS CAVPlayerOperations::SmallSkipForward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
109  
-{
110  
-  if (!IsCorrectPlayer(method))
111  
-    return FailedToExecute;
112  
-
113  
-  CBuiltins::Execute("playercontrol(smallskipforward)");
114  
-  return ACK;
115  
-}
116  
-
117  
-JSON_STATUS CAVPlayerOperations::Rewind(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
118  
-{
119  
-  if (!IsCorrectPlayer(method))
120  
-    return FailedToExecute;
121  
-
122  
-  g_application.getApplicationMessenger().SendAction(CAction(ACTION_PLAYER_REWIND));
123  
-  return ACK;
124  
-}
125  
-
126  
-JSON_STATUS CAVPlayerOperations::Forward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
127  
-{
128  
-  if (!IsCorrectPlayer(method))
129  
-    return FailedToExecute;
130  
-
131  
-  g_application.getApplicationMessenger().SendAction(CAction(ACTION_PLAYER_FORWARD));
132  
-  return ACK;
133  
-}
134  
-
135  
-JSON_STATUS CAVPlayerOperations::GetTime(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result)
136  
-{
137  
-  if (!IsCorrectPlayer(method))
138  
-    return FailedToExecute;
139  
-
140  
-  CreateTime((int)(g_application.GetTime() * 1000.0), result["time"]);
141  
-  CreateTime((int)(g_application.GetTotalTime() * 1000.0), result["total"]);
142  
-  result["playing"] = g_application.IsPlaying();
143  
-  result["paused"] = g_application.IsPaused();
144  
-  return OK;
145  
-}
146  
-
147  
-JSON_STATUS CAVPlayerOperations::GetPercentage(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result)
148  
-{
149  
-  if (!IsCorrectPlayer(method))
150  
-    return FailedToExecute;
151  
-
152  
-  CVariant val = g_application.GetPercentage();
153  
-  result.swap(val);
154  
-  return OK;
155  
-}
156  
-
157  
-JSON_STATUS CAVPlayerOperations::SeekTime(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result)
158  
-{
159  
-  if (!IsCorrectPlayer(method))
160  
-    return FailedToExecute;
161  
-
162  
-  g_application.SeekTime((int)parameterObject["value"].asInteger());
163  
-  return ACK;
164  
-}
165  
-
166  
-JSON_STATUS CAVPlayerOperations::SeekPercentage(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result)
167  
-{
168  
-  if (!IsCorrectPlayer(method))
169  
-    return FailedToExecute;
170  
-
171  
-  g_application.SeekPercentage(parameterObject["value"].asFloat());
172  
-  return ACK;
173  
-}
174  
-
175  
-bool CAVPlayerOperations::IsCorrectPlayer(const CStdString &method)
176  
-{
177  
-  return (method.Left(5).Equals("audio") && g_application.IsPlayingAudio()) || (method.Left(5).Equals("video") && g_application.IsPlayingVideo());
178  
-}
179  
-
180  
-void CAVPlayerOperations::CreateTime(int time, CVariant &result)
181  
-{
182  
-  int ms = time % 1000;
183  
-  result["milliseconds"] = ms;
184  
-  time = (time - ms) / 1000;
185  
-
186  
-  int s = time % 60;
187  
-  result["seconds"] = s;
188  
-  time = (time - s) / 60;
189  
-
190  
-  int m = time % 60;
191  
-  result["minutes"] = m;
192  
-  time = (time -m) / 60;
193  
-
194  
-  result["hours"] = time;
195  
-}
53  xbmc/interfaces/json-rpc/AVPlayerOperations.h
... ...
@@ -1,53 +0,0 @@
1  
-#pragma once
2  
-/*
3  
- *      Copyright (C) 2005-2010 Team XBMC
4  
- *      http://www.xbmc.org
5  
- *
6  
- *  This Program is free software; you can redistribute it and/or modify
7  
- *  it under the terms of the GNU General Public License as published by
8  
- *  the Free Software Foundation; either version 2, or (at your option)
9  
- *  any later version.
10  
- *
11  
- *  This Program is distributed in the hope that it will be useful,
12  
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  
- *  GNU General Public License for more details.
15  
- *
16  
- *  You should have received a copy of the GNU General Public License
17  
- *  along with XBMC; see the file COPYING.  If not, write to
18  
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19  
- *  http://www.gnu.org/copyleft/gpl.html
20  
- *
21  
- */
22  
-
23  
-#include "utils/StdString.h"
24  
-#include "JSONRPC.h"
25  
-
26  
-namespace JSONRPC
27  
-{
28  
-  class CAVPlayerOperations
29  
-  {
30  
-  public:
31  
-    static JSON_STATUS State(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
32  
-    static JSON_STATUS PlayPause(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
33  
-    static JSON_STATUS Stop(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
34  
-    static JSON_STATUS SkipPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
35  
-    static JSON_STATUS SkipNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
36  
-
37  
-    static JSON_STATUS BigSkipBackward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
38  
-    static JSON_STATUS BigSkipForward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
39  
-    static JSON_STATUS SmallSkipBackward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
40  
-    static JSON_STATUS SmallSkipForward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
41  
-
42  
-    static JSON_STATUS Rewind(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
43  
-    static JSON_STATUS Forward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
44  
-
45  
-    static JSON_STATUS GetTime(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
46  
-    static JSON_STATUS GetPercentage(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
47  
-    static JSON_STATUS SeekTime(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
48  
-    static JSON_STATUS SeekPercentage(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
49  
-  private:
50  
-    static inline bool IsCorrectPlayer(const CStdString &method);
51  
-    static void CreateTime(int time, CVariant &result);
52  
-  };
53  
-}
237  xbmc/interfaces/json-rpc/AVPlaylistOperations.cpp
... ...
@@ -1,237 +0,0 @@
1  
-/*
2  
- *      Copyright (C) 2005-2010 Team XBMC
3  
- *      http://www.xbmc.org
4  
- *
5  
- *  This Program is free software; you can redistribute it and/or modify
6  
- *  it under the terms of the GNU General Public License as published by
7  
- *  the Free Software Foundation; either version 2, or (at your option)
8  
- *  any later version.
9  
- *
10  
- *  This Program is distributed in the hope that it will be useful,
11  
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  
- *  GNU General Public License for more details.
14  
- *
15  
- *  You should have received a copy of the GNU General Public License
16  
- *  along with XBMC; see the file COPYING.  If not, write to
17  
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18  
- *  http://www.gnu.org/copyleft/gpl.html
19  
- *
20  
- */
21  
-
22  
-#include "AVPlaylistOperations.h"
23  
-#include "PlayListPlayer.h"
24  
-#include "playlists/PlayListFactory.h"
25  
-#include "Util.h"
26  
-#include "guilib/GUIWindowManager.h"
27  
-#include "GUIUserMessages.h"
28  
-#include "Application.h"
29  
-
30  
-using namespace JSONRPC;
31  
-using namespace PLAYLIST;
32  
-using namespace std;
33  
-
34  
-JSON_STATUS CAVPlaylistOperations::State(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
35  
-{
36  
-  int playlist = GetPlaylist(method);
37  
-  if (g_playlistPlayer.GetCurrentPlaylist() != playlist)
38  
-    return FailedToExecute;
39  
-
40  
-  GetState(playlist, result);
41  
-
42  
-  return OK;
43  
-}
44  
-
45  
-JSON_STATUS CAVPlaylistOperations::Play(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
46  
-{
47  
-  bool status = true;
48  
-  int playlist = GetPlaylist(method);
49  
-  if (g_playlistPlayer.GetCurrentPlaylist() != playlist)
50  
-    g_playlistPlayer.SetCurrentPlaylist(playlist);
51  
-
52  
-  int item    = (int)parameterObject["item"].asInteger();
53  
-  int songId  = (int)parameterObject["songid"].asInteger();
54  
-
55  
-  if (item >= 0)
56  
-    g_application.getApplicationMessenger().PlayListPlayerPlay(item);
57  
-  else if (playlist == PLAYLIST_MUSIC && songId > 0)
58  
-    status = g_application.getApplicationMessenger().PlayListPlayerPlaySongId(songId);
59  
-  else
60  
-    g_application.getApplicationMessenger().PlayListPlayerPlay();
61  
-
62  
-  result["success"] = status;
63  
-  NotifyAll();
64  
-  return OK;
65  
-}
66  
-
67  
-JSON_STATUS CAVPlaylistOperations::SkipPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
68  
-{
69  
-  if (g_playlistPlayer.GetCurrentPlaylist() != GetPlaylist(method))
70  
-    return FailedToExecute;
71  
-
72  
-  g_application.getApplicationMessenger().PlayListPlayerPrevious();
73  
-
74  
-  NotifyAll();
75  
-  return ACK;
76  
-}
77  
-
78  
-JSON_STATUS CAVPlaylistOperations::SkipNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
79  
-{
80  
-  if (g_playlistPlayer.GetCurrentPlaylist() != GetPlaylist(method))
81  
-    return FailedToExecute;
82  
-
83  
-  g_application.getApplicationMessenger().PlayListPlayerNext();
84  
-
85  
-  NotifyAll();
86  
-  return ACK;
87  
-}
88  
-
89  
-JSON_STATUS CAVPlaylistOperations::GetItems(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
90  
-{
91  
-  CFileItemList list;
92  
-  int playlist = GetPlaylist(method);
93  
-
94  
-  g_application.getApplicationMessenger().PlayListPlayerGetItems(playlist, list);
95  
-
96  
-  HandleFileItemList("id", true, "items", list, parameterObject, result);
97  
-
98  
-  if (g_playlistPlayer.GetCurrentPlaylist() == GetPlaylist(method))
99  
-    GetState(playlist, result["state"]);
100  
-
101  
-  return OK;
102  
-}
103  
-
104  
-JSON_STATUS CAVPlaylistOperations::Add(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
105  
-{
106  
-  int playlist = GetPlaylist(method);
107  
-  CFileItemList list;
108  
-  CVariant params = parameterObject;
109  
-  if (playlist == PLAYLIST_VIDEO)
110  
-    params["item"]["media"] = "video";
111  
-  else if (playlist == PLAYLIST_MUSIC)
112  
-    params["item"]["media"] = "music";
113  
-
114  
-  if (!FillFileItemList(params["item"], list))
115  
-    return InvalidParams;
116  
-
117  
-  g_application.getApplicationMessenger().PlayListPlayerAdd(playlist, list);
118  
-
119  
-  NotifyAll();
120  
-  return ACK;
121  
-}
122  
-
123  
-JSON_STATUS CAVPlaylistOperations::Insert(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
124  
-{
125  
-  int playlist = GetPlaylist(method);
126  
-  CFileItemList list;
127  
-  CVariant params = parameterObject;
128  
-  if (playlist == PLAYLIST_VIDEO)
129  
-    params["item"]["media"] = "video";
130  
-  else if (playlist == PLAYLIST_MUSIC)
131  
-    params["item"]["media"] = "music";
132  
-
133  
-  if (!FillFileItemList(params["item"], list))
134  
-    return InvalidParams;
135  
-
136  
-  g_application.getApplicationMessenger().PlayListPlayerInsert(GetPlaylist(method), list, (int)parameterObject["index"].asInteger());
137  
-
138  
-  NotifyAll();
139  
-  return ACK;
140  
-}
141  
-
142  
-JSON_STATUS CAVPlaylistOperations::Remove(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
143  
-{
144  
-  int playlist = GetPlaylist(method);
145  
-  int item = (int)parameterObject["item"].asInteger();
146  
-  if (g_playlistPlayer.GetCurrentPlaylist() == playlist && item == g_playlistPlayer.GetCurrentSong())
147  
-    return InvalidParams;
148  
-
149  
-  g_application.getApplicationMessenger().PlayListPlayerRemove(playlist, item);
150  
-
151  
-  NotifyAll();
152  
-  return ACK;
153  
-}
154  
-
155  
-JSON_STATUS CAVPlaylistOperations::Clear(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
156  
-{
157  
-  g_application.getApplicationMessenger().PlayListPlayerClear(GetPlaylist(method));
158  
-
159  
-  NotifyAll();
160  
-  return ACK;
161  
-}
162  
-
163  
-JSON_STATUS CAVPlaylistOperations::Shuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
164  
-{
165  
-  g_application.getApplicationMessenger().PlayListPlayerShuffle(GetPlaylist(method), true);
166  
-
167  
-  NotifyAll();
168  
-  return ACK;
169  
-}
170  
-
171  
-JSON_STATUS CAVPlaylistOperations::UnShuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
172  
-{
173  
-  g_application.getApplicationMessenger().PlayListPlayerShuffle(GetPlaylist(method), false);
174  
-
175  
-  NotifyAll();
176  
-  return ACK;
177  
-}
178  
-
179  
-JSON_STATUS CAVPlaylistOperations::Repeat(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
180  
-{
181  
-  REPEAT_STATE state = REPEAT_NONE;
182  
-  std::string strState = parameterObject["state"].asString();
183  
-  if (strState.compare("one") == 0)
184  
-    state = REPEAT_ONE;
185  
-  else if (strState.compare("all") == 0)
186  
-    state = REPEAT_ALL;
187  
-
188  
-  g_application.getApplicationMessenger().PlayListPlayerRepeat(GetPlaylist(method), state);
189  
-
190  
-  NotifyAll();
191  
-  return ACK;
192  
-}
193  
-
194  
-JSON_STATUS CAVPlaylistOperations::Swap(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
195  
-{
196  
-  g_application.getApplicationMessenger().PlayListPlayerSwap(GetPlaylist(method), (int)parameterObject["item1"].asInteger(), (int)parameterObject["item2"].asInteger());
197  
-
198  
-  NotifyAll();
199  
-  return ACK;
200  
-}
201  
-
202  
-int CAVPlaylistOperations::GetPlaylist(const CStdString &method)
203  
-{
204  
-  CStdString methodStart = method.Left(5);
205  
-  if (methodStart.Equals("video"))
206  
-    return PLAYLIST_VIDEO;
207  
-  else if (methodStart.Equals("audio"))
208  
-    return PLAYLIST_MUSIC;
209  
-  else
210  
-    return PLAYLIST_NONE;
211  
-}
212  
-
213  
-void CAVPlaylistOperations::NotifyAll()
214  
-{
215  
-  CGUIMessage msg(GUI_MSG_PLAYLIST_CHANGED, 0, 0);
216  
-  g_windowManager.SendThreadMessage(msg);
217  
-}
218  
-
219  
-void CAVPlaylistOperations::GetState(int playlist, CVariant &result)
220  
-{
221  
-  result["current"] = g_playlistPlayer.GetCurrentSong();
222  
-  result["playing"] = g_application.IsPlaying();
223  
-  result["paused"] = g_application.IsPaused();
224  
-  switch (g_playlistPlayer.GetRepeat(playlist))
225  
-  {
226  
-  case REPEAT_ONE:
227  
-    result["repeat"] = "one";
228  
-    break;
229  
-  case REPEAT_ALL:
230  
-    result["repeat"] = "all";
231  
-    break;
232  
-  default:
233  
-    result["repeat"] = "off";
234  
-    break;
235  
-  }
236  
-  result["shuffled"] = g_playlistPlayer.IsShuffled(playlist);
237  
-}
52  xbmc/interfaces/json-rpc/AVPlaylistOperations.h
... ...
@@ -1,52 +0,0 @@
1  
-#pragma once
2  
-/*
3  
- *      Copyright (C) 2005-2010 Team XBMC
4  
- *      http://www.xbmc.org
5  
- *
6  
- *  This Program is free software; you can redistribute it and/or modify
7  
- *  it under the terms of the GNU General Public License as published by
8  
- *  the Free Software Foundation; either version 2, or (at your option)
9  
- *  any later version.
10  
- *
11  
- *  This Program is distributed in the hope that it will be useful,
12  
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  
- *  GNU General Public License for more details.
15  
- *
16  
- *  You should have received a copy of the GNU General Public License
17  
- *  along with XBMC; see the file COPYING.  If not, write to
18  
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19  
- *  http://www.gnu.org/copyleft/gpl.html
20  
- *
21  
- */
22  
-
23  
-#include "utils/StdString.h"
24  
-#include "JSONRPC.h"
25  
-#include "FileItemHandler.h"
26  
-#include "playlists/PlayList.h"
27  
-
28  
-namespace JSONRPC
29  
-{
30  
-  class CAVPlaylistOperations : public CFileItemHandler
31  
-  {
32  
-  public:
33  
-    static JSON_STATUS State(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
34  
-    static JSON_STATUS Play(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
35  
-    static JSON_STATUS SkipPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
36  
-    static JSON_STATUS SkipNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
37  
-
38  
-    static JSON_STATUS GetItems(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
39  
-    static JSON_STATUS Add(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
40  
-    static JSON_STATUS Remove(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result); 
41  
-    static JSON_STATUS Insert(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
42  
-    static JSON_STATUS Clear(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
43  
-    static JSON_STATUS Shuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
44  
-    static JSON_STATUS UnShuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
45  
-    static JSON_STATUS Repeat(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
46  
-    static JSON_STATUS Swap(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
47  
-  private:
48  
-    static inline int  GetPlaylist(const CStdString &method);
49  
-    static inline void NotifyAll();
50  
-    static void GetState(int playlist, CVariant &result);
51  
-  };
52  
-}
6  xbmc/interfaces/json-rpc/FileItemHandler.cpp
@@ -30,6 +30,7 @@
30 30
 #include "utils/Variant.h"
31 31
 #include "video/VideoInfoTag.h"
32 32
 #include "music/tags/MusicInfoTag.h"
  33
+#include "pictures/PictureInfoTag.h"
33 34
 #include "video/VideoDatabase.h"
34 35
 #include "filesystem/Directory.h"
35 36
 #include "filesystem/File.h"
@@ -173,6 +174,8 @@ void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char
173 174
             break;
174 175
         }
175 176
       }
  177
+      else if (item->HasPictureInfoTag())
  178
+        object["type"] = "picture";
176 179
 
177 180
       if (!object.isMember("type"))
178 181
         object["type"] = "unknown";
@@ -186,6 +189,8 @@ void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char
186 189
     FillDetails(item->GetVideoInfoTag(), item, validFields, object);
187 190
   if (item->HasMusicInfoTag())
188 191
     FillDetails(item->GetMusicInfoTag(), item, validFields, object);
  192
+  if (item->HasPictureInfoTag())
  193
+    FillDetails(item->GetPictureInfoTag(), item, validFields, object);
189 194
 
190 195
   object["label"] = item->GetLabel().c_str();
191 196
 
@@ -200,7 +205,6 @@ void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char
200 205
 
201 206
 bool CFileItemHandler::FillFileItemList(const CVariant &parameterObject, CFileItemList &list)
202 207
 {
203  
-  CPlaylistOperations::FillFileItemList(parameterObject, list);
204 208
   CAudioLibrary::FillFileItemList(parameterObject, list);
205 209
   CVideoLibrary::FillFileItemList(parameterObject, list);
206 210
   CFileOperations::FillFileItemList(parameterObject, list);
125  xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
@@ -27,9 +27,6 @@
27 27
 #include "utils/JSONVariantParser.h"
28 28
 #include "JSONRPC.h"
29 29
 #include "PlayerOperations.h"
30  
-#include "AVPlayerOperations.h"
31  
-#include "PicturePlayerOperations.h"
32  
-#include "AVPlaylistOperations.h"
33 30
 #include "PlaylistOperations.h"
34 31
 #include "FileOperations.h"
35 32
 #include "AudioLibrary.h"
@@ -90,104 +87,40 @@ JsonRpcMethodMap CJSONServiceDescription::m_methodMaps[] = {
90 87
 
91 88
 // Player
92 89
   { "Player.GetActivePlayers",                      CPlayerOperations::GetActivePlayers },
93  
-
94  
-// Music player
95  
-  { "AudioPlayer.State",                            CAVPlayerOperations::State },
96  
-  { "AudioPlayer.PlayPause",                        CAVPlayerOperations::PlayPause },
97  
-  { "AudioPlayer.Stop",                             CAVPlayerOperations::Stop },
98  
-  { "AudioPlayer.SkipPrevious",                     CAVPlayerOperations::SkipPrevious },
99  
-  { "AudioPlayer.SkipNext",                         CAVPlayerOperations::SkipNext },
100  
-
101  
-  { "AudioPlayer.BigSkipBackward",                  CAVPlayerOperations::BigSkipBackward },
102  
-  { "AudioPlayer.BigSkipForward",                   CAVPlayerOperations::BigSkipForward },
103  
-  { "AudioPlayer.SmallSkipBackward",                CAVPlayerOperations::SmallSkipBackward },
104  
-  { "AudioPlayer.SmallSkipForward",                 CAVPlayerOperations::SmallSkipForward },
105  
-
106  
-  { "AudioPlayer.Rewind",                           CAVPlayerOperations::Rewind },
107  
-  { "AudioPlayer.Forward",                          CAVPlayerOperations::Forward },
108  
-
109  
-  { "AudioPlayer.GetTime",                          CAVPlayerOperations::GetTime },
110  
-  { "AudioPlayer.GetPercentage",                    CAVPlayerOperations::GetPercentage },
111  
-  { "AudioPlayer.SeekTime",                         CAVPlayerOperations::SeekTime },
112  
-  { "AudioPlayer.SeekPercentage",                   CAVPlayerOperations::SeekPercentage },
113  
-
114  
-// Video player
115  
-  { "VideoPlayer.State",                            CAVPlayerOperations::State },
116  
-  { "VideoPlayer.PlayPause",                        CAVPlayerOperations::PlayPause },
117  
-  { "VideoPlayer.Stop",                             CAVPlayerOperations::Stop },
118  
-  { "VideoPlayer.SkipPrevious",                     CAVPlayerOperations::SkipPrevious },
119  
-  { "VideoPlayer.SkipNext",                         CAVPlayerOperations::SkipNext },
120  
-
121  
-  { "VideoPlayer.BigSkipBackward",                  CAVPlayerOperations::BigSkipBackward },
122  
-  { "VideoPlayer.BigSkipForward",                   CAVPlayerOperations::BigSkipForward },
123  
-  { "VideoPlayer.SmallSkipBackward",                CAVPlayerOperations::SmallSkipBackward },
124  
-  { "VideoPlayer.SmallSkipForward",                 CAVPlayerOperations::SmallSkipForward },
125  
-
126  
-  { "VideoPlayer.Rewind",                           CAVPlayerOperations::Rewind },
127  
-  { "VideoPlayer.Forward",                          CAVPlayerOperations::Forward },
128  
-
129  
-  { "VideoPlayer.GetTime",                          CAVPlayerOperations::GetTime },
130  
-  { "VideoPlayer.GetPercentage",                    CAVPlayerOperations::GetPercentage },
131  
-  { "VideoPlayer.SeekTime",                         CAVPlayerOperations::SeekTime },
132  
-  { "VideoPlayer.SeekPercentage",                   CAVPlayerOperations::SeekPercentage },
133  
-
134  
-// Picture player
135  
-  { "PicturePlayer.PlayPause",                      CPicturePlayerOperations::PlayPause },
136  
-  { "PicturePlayer.Stop",                           CPicturePlayerOperations::Stop },
137  
-  { "PicturePlayer.SkipPrevious",                   CPicturePlayerOperations::SkipPrevious },
138  
-  { "PicturePlayer.SkipNext",                       CPicturePlayerOperations::SkipNext },
139  
-
140  
-  { "PicturePlayer.MoveLeft",                       CPicturePlayerOperations::MoveLeft },
141  
-  { "PicturePlayer.MoveRight",                      CPicturePlayerOperations::MoveRight },
142  
-  { "PicturePlayer.MoveDown",                       CPicturePlayerOperations::MoveDown },
143  
-  { "PicturePlayer.MoveUp",                         CPicturePlayerOperations::MoveUp },
144  
-
145  
-  { "PicturePlayer.ZoomOut",                        CPicturePlayerOperations::ZoomOut },
146  
-  { "PicturePlayer.ZoomIn",                         CPicturePlayerOperations::ZoomIn },
147  
-  { "PicturePlayer.Zoom",                           CPicturePlayerOperations::Zoom },
148  
-  { "PicturePlayer.Rotate",                         CPicturePlayerOperations::Rotate },
149  
-
150  
-// Video Playlist
151  
-  { "VideoPlaylist.State",                          CAVPlaylistOperations::State },
152  
-  { "VideoPlaylist.Play",                           CAVPlaylistOperations::Play },
153  
-  { "VideoPlaylist.SkipPrevious",                   CAVPlaylistOperations::SkipPrevious },
154  
-  { "VideoPlaylist.SkipNext",                       CAVPlaylistOperations::SkipNext },
155  
-  { "VideoPlaylist.GetItems",                       CAVPlaylistOperations::GetItems },
156  
-  { "VideoPlaylist.Add",                            CAVPlaylistOperations::Add },
157  
-  { "VideoPlaylist.Insert",                         CAVPlaylistOperations::Insert },
158  
-  { "VideoPlaylist.Clear",                          CAVPlaylistOperations::Clear },
159  
-  { "VideoPlaylist.Shuffle",                        CAVPlaylistOperations::Shuffle },
160  
-  { "VideoPlaylist.UnShuffle",                      CAVPlaylistOperations::UnShuffle },
161  
-  { "VideoPlaylist.Repeat",                         CAVPlaylistOperations::Repeat },
162  
-  { "VideoPlaylist.Remove",                         CAVPlaylistOperations::Remove },
163  
-  { "VideoPlaylist.Swap",                           CAVPlaylistOperations::Swap },
164  
-
165  
-// AudioPlaylist
166  
-  { "AudioPlaylist.State",                          CAVPlaylistOperations::State },
167  
-  { "AudioPlaylist.Play",                           CAVPlaylistOperations::Play },
168  
-  { "AudioPlaylist.SkipPrevious",                   CAVPlaylistOperations::SkipPrevious },
169  
-  { "AudioPlaylist.SkipNext",                       CAVPlaylistOperations::SkipNext },
170  
-  { "AudioPlaylist.GetItems",                       CAVPlaylistOperations::GetItems },
171  
-  { "AudioPlaylist.Add",                            CAVPlaylistOperations::Add },
172  
-  { "AudioPlaylist.Insert",                         CAVPlaylistOperations::Insert },
173  
-  { "AudioPlaylist.Clear",                          CAVPlaylistOperations::Clear },
174  
-  { "AudioPlaylist.Shuffle",                        CAVPlaylistOperations::Shuffle },
175  
-  { "AudioPlaylist.UnShuffle",                      CAVPlaylistOperations::UnShuffle },
176  
-  { "AudioPlaylist.Repeat",                         CAVPlaylistOperations::Repeat },
177  
-  { "AudioPlaylist.Remove",                         CAVPlaylistOperations::Remove },
178  
-  { "AudioPlaylist.Swap",                           CAVPlaylistOperations::Swap },
  90
+  { "Player.GetProperties",                         CPlayerOperations::GetProperties },
  91
+
  92
+  { "Player.PlayPause",                             CPlayerOperations::PlayPause },
  93
+  { "Player.Stop",                                  CPlayerOperations::Stop },
  94
+  { "Player.SetSpeed",                              CPlayerOperations::SetSpeed },
  95
+  { "Player.Seek",                                  CPlayerOperations::Seek },
  96
+
  97
+  { "Player.MoveLeft",                              CPlayerOperations::MoveLeft },
  98
+  { "Player.MoveRight",                             CPlayerOperations::MoveRight },
  99
+  { "Player.MoveDown",                              CPlayerOperations::MoveDown },
  100
+  { "Player.MoveUp",                                CPlayerOperations::MoveUp },
  101
+
  102
+  { "Player.ZoomOut",                               CPlayerOperations::ZoomOut },
  103
+  { "Player.ZoomIn",                                CPlayerOperations::ZoomIn },
  104
+  { "Player.Zoom",                                  CPlayerOperations::Zoom },
  105
+  { "Player.Rotate",                                CPlayerOperations::Rotate },
  106
+  
  107
+  { "Player.Open",                                  CPlayerOperations::Open },
  108
+  { "Player.GoPrevious",                            CPlayerOperations::GoPrevious },
  109
+  { "Player.GoNext",                                CPlayerOperations::GoNext },
  110
+  { "Player.GoTo",                                  CPlayerOperations::GoTo },
  111
+  { "Player.Shuffle",                               CPlayerOperations::Shuffle },
  112
+  { "Player.UnShuffle",                             CPlayerOperations::UnShuffle },
  113
+  { "Player.Repeat",                                CPlayerOperations::Repeat },
179 114
 
180 115
 // Playlist
181  
-  { "Playlist.Create",                              CPlaylistOperations::Create },
182  
-  { "Playlist.Destroy",                             CPlaylistOperations::Destroy },
183  
-
  116
+  { "Playlist.GetPlaylists",                        CPlaylistOperations::GetPlaylists },
  117
+  { "Playlist.GetProperties",                       CPlaylistOperations::GetProperties },
184 118
   { "Playlist.GetItems",                            CPlaylistOperations::GetItems },
185 119
   { "Playlist.Add",                                 CPlaylistOperations::Add },
  120
+  { "Playlist.Insert",                              CPlaylistOperations::Insert },
  121
+  { "Playlist.Clear",                               CPlaylistOperations::Clear },
186 122
   { "Playlist.Remove",                              CPlaylistOperations::Remove },
187 123
   { "Playlist.Swap",                                CPlaylistOperations::Swap },
188  
-  { "Playlist.Clear",                               CPlaylistOperations::Clear },
189  
-  { "Playlist.Shuffle",                             CPlaylistOperations::Shuffle },
190  
-  { "Playlist.UnShuffle",                           CPlaylistOperations::UnShuffle },
191 124
 
192 125
 // Files
193 126
   { "Files.GetSources",                             CFileOperations::GetRootDirectory },
@@ -251,8 +184,6 @@ JsonRpcMethodMap CJSONServiceDescription::m_methodMaps[] = {
251 184
   { "Application.Quit",                             CApplicationOperations::Quit },
252 185
 
253 186
 // XBMC operations
254  
-  { "XBMC.Play",                                    CXBMCOperations::Play },
255  
-  { "XBMC.StartSlideshow",                          CXBMCOperations::StartSlideshow },
256 187
   { "XBMC.GetInfoLabels",                           CXBMCOperations::GetInfoLabels },
257 188
   { "XBMC.GetInfoBooleans",                         CXBMCOperations::GetInfoBooleans }
258 189
 };
18  xbmc/interfaces/json-rpc/JSONUtils.h
@@ -102,6 +102,24 @@ namespace JSONRPC
102 102
    json rpc method calls.*/
103 103
   class CJSONUtils
104 104
   {
  105
+  public:
  106
+    static void MillisecondsToTimeObject(int time, CVariant &result)
  107
+    {
  108
+      int ms = time % 1000;
  109
+      result["milliseconds"] = ms;
  110
+      time = (time - ms) / 1000;
  111
+
  112
+      int s = time % 60;
  113
+      result["seconds"] = s;
  114
+      time = (time - s) / 60;
  115
+
  116
+      int m = time % 60;
  117
+      result["minutes"] = m;
  118
+      time = (time -m) / 60;
  119
+
  120
+      result["hours"] = time;
  121
+    }
  122
+
105 123
   protected:
106 124
     /*!
107 125
      \brief Checks if the given object contains a parameter
3  xbmc/interfaces/json-rpc/Makefile
... ...
@@ -1,12 +1,9 @@
1 1
 SRCS=ApplicationOperations.cpp \
2 2
      AudioLibrary.cpp \
3  
-     AVPlayerOperations.cpp \
4  
-     AVPlaylistOperations.cpp \
5 3
      FileItemHandler.cpp \
6 4
      FileOperations.cpp \
7 5
      JSONRPC.cpp \
8 6
      JSONServiceDescription.cpp \
9  
-     PicturePlayerOperations.cpp \
10 7
      PlayerOperations.cpp \
11 8
      PlaylistOperations.cpp \
12 9
      SystemOperations.cpp \
105  xbmc/interfaces/json-rpc/PicturePlayerOperations.cpp
... ...
@@ -1,105 +0,0 @@
1  
-/*
2  
- *      Copyright (C) 2005-2010 Team XBMC
3  
- *      http://www.xbmc.org
4  
- *
5  
- *  This Program is free software; you can redistribute it and/or modify
6  
- *  it under the terms of the GNU General Public License as published by
7  
- *  the Free Software Foundation; either version 2, or (at your option)
8  
- *  any later version.
9  
- *
10  
- *  This Program is distributed in the hope that it will be useful,
11  
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  
- *  GNU General Public License for more details.
14  
- *
15  
- *  You should have received a copy of the GNU General Public License
16  
- *  along with XBMC; see the file COPYING.  If not, write to
17  
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18  
- *  http://www.gnu.org/copyleft/gpl.html
19  
- *
20  
- */
21  
-
22  
-#include "PicturePlayerOperations.h"
23  
-#include "Application.h"
24  
-#include "guilib/Key.h"
25  
-
26  
-using namespace JSONRPC;
27  
-
28  
-JSON_STATUS CPicturePlayerOperations::PlayPause(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
29  
-{
30  
-  return SendAction(ACTION_PAUSE);
31  
-}
32  
-
33  
-JSON_STATUS CPicturePlayerOperations::Stop(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
34  
-{
35  
-  return SendAction(ACTION_STOP);
36  
-}
37  
-
38  
-JSON_STATUS CPicturePlayerOperations::SkipPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
39  
-{
40  
-  return SendAction(ACTION_PREV_PICTURE);
41  
-}
42  
-
43  
-JSON_STATUS CPicturePlayerOperations::SkipNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
44  
-{
45  
-  return SendAction(ACTION_NEXT_PICTURE);
46  
-}
47  
-
48  
-JSON_STATUS CPicturePlayerOperations::MoveLeft(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
49  
-{
50  
-  return SendAction(ACTION_MOVE_LEFT);
51  
-}
52  
-
53  
-JSON_STATUS CPicturePlayerOperations::MoveRight(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
54  
-{
55  
-  return SendAction(ACTION_MOVE_RIGHT);
56  
-}
57  
-
58  
-JSON_STATUS CPicturePlayerOperations::MoveDown(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
59  
-{
60  
-  return SendAction(ACTION_MOVE_DOWN);
61  
-}
62  
-
63  
-JSON_STATUS CPicturePlayerOperations::MoveUp(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
64  
-{
65  
-  return SendAction(ACTION_MOVE_UP);
66  
-}
67  
-
68  
-JSON_STATUS CPicturePlayerOperations::ZoomOut(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
69  
-{
70  
-  return SendAction(ACTION_ZOOM_OUT);
71  
-}
72  
-
73  
-JSON_STATUS CPicturePlayerOperations::ZoomIn(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
74  
-{
75  
-  return SendAction(ACTION_ZOOM_IN);
76  
-}
77  
-
78  
-JSON_STATUS CPicturePlayerOperations::Zoom(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
79  
-{
80  
-  return SendAction(ACTION_ZOOM_LEVEL_NORMAL + ((int)parameterObject["value"].asInteger() - 1));
81  
-}
82  
-
83  
-JSON_STATUS CPicturePlayerOperations::Rotate(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
84  
-{
85  
-  return SendAction(ACTION_ROTATE_PICTURE);
86  
-}
87  
-
88  
-/*JSON_STATUS Move(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
89  
-{
90  
-      CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
91  
-      if (pSlideShow) {
92  
-          CAction action;
93  
-          action.id = ACTION_ANALOG_MOVE;
94  
-          action.GetAmount()=(float) atof(paras[0]);
95  
-          action.GetAmount(1)=(float) atof(paras[1]);
96  
-          pSlideShow->OnAction(action);