diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index 630784fe58..e74f8b1b85 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -460,14 +460,11 @@ - - - @@ -1385,8 +1382,6 @@ - - @@ -1395,7 +1390,6 @@ - diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index da8f813ab9..bd86b514ea 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -1472,12 +1472,6 @@ interfaces\json-rpc - - interfaces\json-rpc - - - interfaces\json-rpc - interfaces\json-rpc @@ -1487,9 +1481,6 @@ interfaces\json-rpc - - interfaces\json-rpc - interfaces\json-rpc @@ -3937,12 +3928,6 @@ interfaces\json-rpc - - interfaces\json-rpc - - - interfaces\json-rpc - interfaces\json-rpc @@ -3961,9 +3946,6 @@ interfaces\json-rpc - - interfaces\json-rpc - interfaces\json-rpc diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 0594e9441e..2faae1fd50 100755 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -3898,7 +3898,10 @@ void CApplication::OnPlayBackPaused() getApplicationMessenger().HttpApi("broadcastlevel; OnPlayBackPaused;1"); #endif - CAnnouncementManager::Announce(Player, "xbmc", "OnPause", m_itemCurrentFile); + CVariant param; + param["player"]["speed"] = 0; + param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist(); + CAnnouncementManager::Announce(Player, "xbmc", "OnPause", m_itemCurrentFile, param); } void CApplication::OnPlayBackResumed() @@ -3914,7 +3917,8 @@ void CApplication::OnPlayBackResumed() #endif CVariant param; - param["speed"] = 1; + param["player"]["speed"] = 1; + param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist(); CAnnouncementManager::Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param); } @@ -3935,8 +3939,9 @@ void CApplication::OnPlayBackSpeedChanged(int iSpeed) #endif CVariant param; - param["speed"] = iSpeed; - CAnnouncementManager::Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param); + param["player"]["speed"] = iSpeed; + param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist(); + CAnnouncementManager::Announce(Player, "xbmc", "OnSpeedChanged", m_itemCurrentFile, param); } void CApplication::OnPlayBackSeek(int iTime, int seekOffset) @@ -3956,9 +3961,11 @@ void CApplication::OnPlayBackSeek(int iTime, int seekOffset) #endif CVariant param; - param["time"] = iTime; - param["seekoffset"] = seekOffset; - CAnnouncementManager::Announce(Player, "xbmc", "OnSeek", param); + CJSONUtils::MillisecondsToTimeObject(iTime, param["player"]["time"]); + CJSONUtils::MillisecondsToTimeObject(seekOffset, param["player"]["seekoffset"]);; + param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist(); + param["player"]["speed"] = GetPlaySpeed(); + CAnnouncementManager::Announce(Player, "xbmc", "OnSeek", m_itemCurrentFile, param); g_infoManager.SetDisplayAfterSeek(2500, seekOffset/1000); } @@ -4430,7 +4437,8 @@ bool CApplication::OnMessage(CGUIMessage& message) g_partyModeManager.OnSongChange(true); CVariant param; - param["speed"] = 1; + param["player"]["speed"] = 1; + param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist(); CAnnouncementManager::Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param); DimLCDOnPlayback(true); diff --git a/xbmc/PlayListPlayer.h b/xbmc/PlayListPlayer.h index 932607876d..8ad161f719 100644 --- a/xbmc/PlayListPlayer.h +++ b/xbmc/PlayListPlayer.h @@ -26,6 +26,7 @@ #define PLAYLIST_NONE -1 #define PLAYLIST_MUSIC 0 #define PLAYLIST_VIDEO 1 +#define PLAYLIST_PICTURE 2 class CFileItem; typedef boost::shared_ptr CFileItemPtr; class CFileItemList; diff --git a/xbmc/interfaces/AnnouncementManager.cpp b/xbmc/interfaces/AnnouncementManager.cpp index 0f8485ef3d..3403ccda80 100644 --- a/xbmc/interfaces/AnnouncementManager.cpp +++ b/xbmc/interfaces/AnnouncementManager.cpp @@ -116,25 +116,16 @@ void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender, else if (item->HasMusicInfoTag()) { id = item->GetMusicInfoTag()->GetDatabaseId(); - - if (item->IsAlbum()) - type = "album"; - else - { - type = "song"; - - if (id <= 0) - { - if (item->GetMusicInfoTag()->GetTrackNumber() > 0) - object["track"] = item->GetMusicInfoTag()->GetTrackNumber(); - if (!item->GetMusicInfoTag()->GetAlbum().empty()) - object["album"] = item->GetMusicInfoTag()->GetAlbum(); - } - } + type = "song"; if (id <= 0) { object["title"] = item->GetMusicInfoTag()->GetTitle(); + + if (item->GetMusicInfoTag()->GetTrackNumber() > 0) + object["track"] = item->GetMusicInfoTag()->GetTrackNumber(); + if (!item->GetMusicInfoTag()->GetAlbum().empty()) + object["album"] = item->GetMusicInfoTag()->GetAlbum(); if (!item->GetMusicInfoTag()->GetArtist().empty()) object["artist"] = item->GetMusicInfoTag()->GetArtist(); } @@ -142,9 +133,9 @@ void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender, else type = "unknown"; - object["type"] = type; + object["item"]["type"] = type; if (id > 0) - object["id"] = id; + object["item"]["id"] = id; Announce(flag, sender, message, object); } diff --git a/xbmc/interfaces/json-rpc/AVPlayerOperations.cpp b/xbmc/interfaces/json-rpc/AVPlayerOperations.cpp deleted file mode 100644 index ad1868a289..0000000000 --- a/xbmc/interfaces/json-rpc/AVPlayerOperations.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "AVPlayerOperations.h" -#include "Application.h" -#include "interfaces/Builtins.h" -#include "Util.h" -#include "PlayListPlayer.h" -#include "PartyModeManager.h" - -using namespace JSONRPC; - -JSON_STATUS CAVPlayerOperations::State(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - result["playing"] = g_application.IsPlaying(); - result["paused"] = g_application.IsPaused(); - result["partymode"] = g_partyModeManager.IsEnabled(); - - return OK; -} - -JSON_STATUS CAVPlayerOperations::PlayPause(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - CBuiltins::Execute("playercontrol(play)"); - result["playing"] = g_application.IsPlaying(); - result["paused"] = g_application.IsPaused(); - return OK; -} - -JSON_STATUS CAVPlayerOperations::Stop(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - g_application.getApplicationMessenger().SendAction(CAction(ACTION_STOP)); - return ACK; -} - -JSON_STATUS CAVPlayerOperations::SkipPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - g_application.getApplicationMessenger().SendAction(CAction(ACTION_PREV_ITEM)); - return ACK; -} - -JSON_STATUS CAVPlayerOperations::SkipNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - g_application.getApplicationMessenger().SendAction(CAction(ACTION_NEXT_ITEM)); - return ACK; -} - -JSON_STATUS CAVPlayerOperations::BigSkipBackward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - CBuiltins::Execute("playercontrol(bigskipbackward)"); - return ACK; -} - -JSON_STATUS CAVPlayerOperations::BigSkipForward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - CBuiltins::Execute("playercontrol(bigskipforward)"); - return ACK; -} - -JSON_STATUS CAVPlayerOperations::SmallSkipBackward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - CBuiltins::Execute("playercontrol(smallskipbackward)"); - return ACK; -} - -JSON_STATUS CAVPlayerOperations::SmallSkipForward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - CBuiltins::Execute("playercontrol(smallskipforward)"); - return ACK; -} - -JSON_STATUS CAVPlayerOperations::Rewind(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - g_application.getApplicationMessenger().SendAction(CAction(ACTION_PLAYER_REWIND)); - return ACK; -} - -JSON_STATUS CAVPlayerOperations::Forward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - g_application.getApplicationMessenger().SendAction(CAction(ACTION_PLAYER_FORWARD)); - return ACK; -} - -JSON_STATUS CAVPlayerOperations::GetTime(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - CreateTime((int)(g_application.GetTime() * 1000.0), result["time"]); - CreateTime((int)(g_application.GetTotalTime() * 1000.0), result["total"]); - result["playing"] = g_application.IsPlaying(); - result["paused"] = g_application.IsPaused(); - return OK; -} - -JSON_STATUS CAVPlayerOperations::GetPercentage(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - CVariant val = g_application.GetPercentage(); - result.swap(val); - return OK; -} - -JSON_STATUS CAVPlayerOperations::SeekTime(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - g_application.SeekTime((int)parameterObject["value"].asInteger()); - return ACK; -} - -JSON_STATUS CAVPlayerOperations::SeekPercentage(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result) -{ - if (!IsCorrectPlayer(method)) - return FailedToExecute; - - g_application.SeekPercentage(parameterObject["value"].asFloat()); - return ACK; -} - -bool CAVPlayerOperations::IsCorrectPlayer(const CStdString &method) -{ - return (method.Left(5).Equals("audio") && g_application.IsPlayingAudio()) || (method.Left(5).Equals("video") && g_application.IsPlayingVideo()); -} - -void CAVPlayerOperations::CreateTime(int time, CVariant &result) -{ - int ms = time % 1000; - result["milliseconds"] = ms; - time = (time - ms) / 1000; - - int s = time % 60; - result["seconds"] = s; - time = (time - s) / 60; - - int m = time % 60; - result["minutes"] = m; - time = (time -m) / 60; - - result["hours"] = time; -} diff --git a/xbmc/interfaces/json-rpc/AVPlayerOperations.h b/xbmc/interfaces/json-rpc/AVPlayerOperations.h deleted file mode 100644 index 44ae5ade72..0000000000 --- a/xbmc/interfaces/json-rpc/AVPlayerOperations.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2010 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "utils/StdString.h" -#include "JSONRPC.h" - -namespace JSONRPC -{ - class CAVPlayerOperations - { - public: - static JSON_STATUS State(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS PlayPause(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Stop(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS SkipPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS SkipNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - - static JSON_STATUS BigSkipBackward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS BigSkipForward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS SmallSkipBackward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS SmallSkipForward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - - static JSON_STATUS Rewind(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Forward(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - - static JSON_STATUS GetTime(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS GetPercentage(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS SeekTime(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS SeekPercentage(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - private: - static inline bool IsCorrectPlayer(const CStdString &method); - static void CreateTime(int time, CVariant &result); - }; -} diff --git a/xbmc/interfaces/json-rpc/AVPlaylistOperations.cpp b/xbmc/interfaces/json-rpc/AVPlaylistOperations.cpp deleted file mode 100644 index 11db3aaf65..0000000000 --- a/xbmc/interfaces/json-rpc/AVPlaylistOperations.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "AVPlaylistOperations.h" -#include "PlayListPlayer.h" -#include "playlists/PlayListFactory.h" -#include "Util.h" -#include "guilib/GUIWindowManager.h" -#include "GUIUserMessages.h" -#include "Application.h" - -using namespace JSONRPC; -using namespace PLAYLIST; -using namespace std; - -JSON_STATUS CAVPlaylistOperations::State(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - int playlist = GetPlaylist(method); - if (g_playlistPlayer.GetCurrentPlaylist() != playlist) - return FailedToExecute; - - GetState(playlist, result); - - return OK; -} - -JSON_STATUS CAVPlaylistOperations::Play(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - bool status = true; - int playlist = GetPlaylist(method); - if (g_playlistPlayer.GetCurrentPlaylist() != playlist) - g_playlistPlayer.SetCurrentPlaylist(playlist); - - int item = (int)parameterObject["item"].asInteger(); - int songId = (int)parameterObject["songid"].asInteger(); - - if (item >= 0) - g_application.getApplicationMessenger().PlayListPlayerPlay(item); - else if (playlist == PLAYLIST_MUSIC && songId > 0) - status = g_application.getApplicationMessenger().PlayListPlayerPlaySongId(songId); - else - g_application.getApplicationMessenger().PlayListPlayerPlay(); - - result["success"] = status; - NotifyAll(); - return OK; -} - -JSON_STATUS CAVPlaylistOperations::SkipPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (g_playlistPlayer.GetCurrentPlaylist() != GetPlaylist(method)) - return FailedToExecute; - - g_application.getApplicationMessenger().PlayListPlayerPrevious(); - - NotifyAll(); - return ACK; -} - -JSON_STATUS CAVPlaylistOperations::SkipNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - if (g_playlistPlayer.GetCurrentPlaylist() != GetPlaylist(method)) - return FailedToExecute; - - g_application.getApplicationMessenger().PlayListPlayerNext(); - - NotifyAll(); - return ACK; -} - -JSON_STATUS CAVPlaylistOperations::GetItems(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - CFileItemList list; - int playlist = GetPlaylist(method); - - g_application.getApplicationMessenger().PlayListPlayerGetItems(playlist, list); - - HandleFileItemList("id", true, "items", list, parameterObject, result); - - if (g_playlistPlayer.GetCurrentPlaylist() == GetPlaylist(method)) - GetState(playlist, result["state"]); - - return OK; -} - -JSON_STATUS CAVPlaylistOperations::Add(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - int playlist = GetPlaylist(method); - CFileItemList list; - CVariant params = parameterObject; - if (playlist == PLAYLIST_VIDEO) - params["item"]["media"] = "video"; - else if (playlist == PLAYLIST_MUSIC) - params["item"]["media"] = "music"; - - if (!FillFileItemList(params["item"], list)) - return InvalidParams; - - g_application.getApplicationMessenger().PlayListPlayerAdd(playlist, list); - - NotifyAll(); - return ACK; -} - -JSON_STATUS CAVPlaylistOperations::Insert(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - int playlist = GetPlaylist(method); - CFileItemList list; - CVariant params = parameterObject; - if (playlist == PLAYLIST_VIDEO) - params["item"]["media"] = "video"; - else if (playlist == PLAYLIST_MUSIC) - params["item"]["media"] = "music"; - - if (!FillFileItemList(params["item"], list)) - return InvalidParams; - - g_application.getApplicationMessenger().PlayListPlayerInsert(GetPlaylist(method), list, (int)parameterObject["index"].asInteger()); - - NotifyAll(); - return ACK; -} - -JSON_STATUS CAVPlaylistOperations::Remove(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - int playlist = GetPlaylist(method); - int item = (int)parameterObject["item"].asInteger(); - if (g_playlistPlayer.GetCurrentPlaylist() == playlist && item == g_playlistPlayer.GetCurrentSong()) - return InvalidParams; - - g_application.getApplicationMessenger().PlayListPlayerRemove(playlist, item); - - NotifyAll(); - return ACK; -} - -JSON_STATUS CAVPlaylistOperations::Clear(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - g_application.getApplicationMessenger().PlayListPlayerClear(GetPlaylist(method)); - - NotifyAll(); - return ACK; -} - -JSON_STATUS CAVPlaylistOperations::Shuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - g_application.getApplicationMessenger().PlayListPlayerShuffle(GetPlaylist(method), true); - - NotifyAll(); - return ACK; -} - -JSON_STATUS CAVPlaylistOperations::UnShuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - g_application.getApplicationMessenger().PlayListPlayerShuffle(GetPlaylist(method), false); - - NotifyAll(); - return ACK; -} - -JSON_STATUS CAVPlaylistOperations::Repeat(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - REPEAT_STATE state = REPEAT_NONE; - std::string strState = parameterObject["state"].asString(); - if (strState.compare("one") == 0) - state = REPEAT_ONE; - else if (strState.compare("all") == 0) - state = REPEAT_ALL; - - g_application.getApplicationMessenger().PlayListPlayerRepeat(GetPlaylist(method), state); - - NotifyAll(); - return ACK; -} - -JSON_STATUS CAVPlaylistOperations::Swap(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - g_application.getApplicationMessenger().PlayListPlayerSwap(GetPlaylist(method), (int)parameterObject["item1"].asInteger(), (int)parameterObject["item2"].asInteger()); - - NotifyAll(); - return ACK; -} - -int CAVPlaylistOperations::GetPlaylist(const CStdString &method) -{ - CStdString methodStart = method.Left(5); - if (methodStart.Equals("video")) - return PLAYLIST_VIDEO; - else if (methodStart.Equals("audio")) - return PLAYLIST_MUSIC; - else - return PLAYLIST_NONE; -} - -void CAVPlaylistOperations::NotifyAll() -{ - CGUIMessage msg(GUI_MSG_PLAYLIST_CHANGED, 0, 0); - g_windowManager.SendThreadMessage(msg); -} - -void CAVPlaylistOperations::GetState(int playlist, CVariant &result) -{ - result["current"] = g_playlistPlayer.GetCurrentSong(); - result["playing"] = g_application.IsPlaying(); - result["paused"] = g_application.IsPaused(); - switch (g_playlistPlayer.GetRepeat(playlist)) - { - case REPEAT_ONE: - result["repeat"] = "one"; - break; - case REPEAT_ALL: - result["repeat"] = "all"; - break; - default: - result["repeat"] = "off"; - break; - } - result["shuffled"] = g_playlistPlayer.IsShuffled(playlist); -} diff --git a/xbmc/interfaces/json-rpc/AVPlaylistOperations.h b/xbmc/interfaces/json-rpc/AVPlaylistOperations.h deleted file mode 100644 index 34fd6beb77..0000000000 --- a/xbmc/interfaces/json-rpc/AVPlaylistOperations.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2010 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "utils/StdString.h" -#include "JSONRPC.h" -#include "FileItemHandler.h" -#include "playlists/PlayList.h" - -namespace JSONRPC -{ - class CAVPlaylistOperations : public CFileItemHandler - { - public: - static JSON_STATUS State(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Play(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS SkipPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS SkipNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - - static JSON_STATUS GetItems(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Add(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Remove(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Insert(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Clear(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Shuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS UnShuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Repeat(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Swap(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - private: - static inline int GetPlaylist(const CStdString &method); - static inline void NotifyAll(); - static void GetState(int playlist, CVariant &result); - }; -} diff --git a/xbmc/interfaces/json-rpc/FileItemHandler.cpp b/xbmc/interfaces/json-rpc/FileItemHandler.cpp index 9fd44db7f8..298a803ad9 100644 --- a/xbmc/interfaces/json-rpc/FileItemHandler.cpp +++ b/xbmc/interfaces/json-rpc/FileItemHandler.cpp @@ -30,6 +30,7 @@ #include "utils/Variant.h" #include "video/VideoInfoTag.h" #include "music/tags/MusicInfoTag.h" +#include "pictures/PictureInfoTag.h" #include "video/VideoDatabase.h" #include "filesystem/Directory.h" #include "filesystem/File.h" @@ -173,6 +174,8 @@ void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char break; } } + else if (item->HasPictureInfoTag()) + object["type"] = "picture"; if (!object.isMember("type")) object["type"] = "unknown"; @@ -186,6 +189,8 @@ void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char FillDetails(item->GetVideoInfoTag(), item, validFields, object); if (item->HasMusicInfoTag()) FillDetails(item->GetMusicInfoTag(), item, validFields, object); + if (item->HasPictureInfoTag()) + FillDetails(item->GetPictureInfoTag(), item, validFields, object); object["label"] = item->GetLabel().c_str(); @@ -200,7 +205,6 @@ void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char bool CFileItemHandler::FillFileItemList(const CVariant ¶meterObject, CFileItemList &list) { - CPlaylistOperations::FillFileItemList(parameterObject, list); CAudioLibrary::FillFileItemList(parameterObject, list); CVideoLibrary::FillFileItemList(parameterObject, list); CFileOperations::FillFileItemList(parameterObject, list); diff --git a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp index 0f52b89873..9cf1a00051 100644 --- a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp +++ b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp @@ -27,9 +27,6 @@ #include "utils/JSONVariantParser.h" #include "JSONRPC.h" #include "PlayerOperations.h" -#include "AVPlayerOperations.h" -#include "PicturePlayerOperations.h" -#include "AVPlaylistOperations.h" #include "PlaylistOperations.h" #include "FileOperations.h" #include "AudioLibrary.h" @@ -90,104 +87,40 @@ JsonRpcMethodMap CJSONServiceDescription::m_methodMaps[] = { // Player { "Player.GetActivePlayers", CPlayerOperations::GetActivePlayers }, - -// Music player - { "AudioPlayer.State", CAVPlayerOperations::State }, - { "AudioPlayer.PlayPause", CAVPlayerOperations::PlayPause }, - { "AudioPlayer.Stop", CAVPlayerOperations::Stop }, - { "AudioPlayer.SkipPrevious", CAVPlayerOperations::SkipPrevious }, - { "AudioPlayer.SkipNext", CAVPlayerOperations::SkipNext }, - - { "AudioPlayer.BigSkipBackward", CAVPlayerOperations::BigSkipBackward }, - { "AudioPlayer.BigSkipForward", CAVPlayerOperations::BigSkipForward }, - { "AudioPlayer.SmallSkipBackward", CAVPlayerOperations::SmallSkipBackward }, - { "AudioPlayer.SmallSkipForward", CAVPlayerOperations::SmallSkipForward }, - - { "AudioPlayer.Rewind", CAVPlayerOperations::Rewind }, - { "AudioPlayer.Forward", CAVPlayerOperations::Forward }, - - { "AudioPlayer.GetTime", CAVPlayerOperations::GetTime }, - { "AudioPlayer.GetPercentage", CAVPlayerOperations::GetPercentage }, - { "AudioPlayer.SeekTime", CAVPlayerOperations::SeekTime }, - { "AudioPlayer.SeekPercentage", CAVPlayerOperations::SeekPercentage }, - -// Video player - { "VideoPlayer.State", CAVPlayerOperations::State }, - { "VideoPlayer.PlayPause", CAVPlayerOperations::PlayPause }, - { "VideoPlayer.Stop", CAVPlayerOperations::Stop }, - { "VideoPlayer.SkipPrevious", CAVPlayerOperations::SkipPrevious }, - { "VideoPlayer.SkipNext", CAVPlayerOperations::SkipNext }, - - { "VideoPlayer.BigSkipBackward", CAVPlayerOperations::BigSkipBackward }, - { "VideoPlayer.BigSkipForward", CAVPlayerOperations::BigSkipForward }, - { "VideoPlayer.SmallSkipBackward", CAVPlayerOperations::SmallSkipBackward }, - { "VideoPlayer.SmallSkipForward", CAVPlayerOperations::SmallSkipForward }, - - { "VideoPlayer.Rewind", CAVPlayerOperations::Rewind }, - { "VideoPlayer.Forward", CAVPlayerOperations::Forward }, - - { "VideoPlayer.GetTime", CAVPlayerOperations::GetTime }, - { "VideoPlayer.GetPercentage", CAVPlayerOperations::GetPercentage }, - { "VideoPlayer.SeekTime", CAVPlayerOperations::SeekTime }, - { "VideoPlayer.SeekPercentage", CAVPlayerOperations::SeekPercentage }, - -// Picture player - { "PicturePlayer.PlayPause", CPicturePlayerOperations::PlayPause }, - { "PicturePlayer.Stop", CPicturePlayerOperations::Stop }, - { "PicturePlayer.SkipPrevious", CPicturePlayerOperations::SkipPrevious }, - { "PicturePlayer.SkipNext", CPicturePlayerOperations::SkipNext }, - - { "PicturePlayer.MoveLeft", CPicturePlayerOperations::MoveLeft }, - { "PicturePlayer.MoveRight", CPicturePlayerOperations::MoveRight }, - { "PicturePlayer.MoveDown", CPicturePlayerOperations::MoveDown }, - { "PicturePlayer.MoveUp", CPicturePlayerOperations::MoveUp }, - - { "PicturePlayer.ZoomOut", CPicturePlayerOperations::ZoomOut }, - { "PicturePlayer.ZoomIn", CPicturePlayerOperations::ZoomIn }, - { "PicturePlayer.Zoom", CPicturePlayerOperations::Zoom }, - { "PicturePlayer.Rotate", CPicturePlayerOperations::Rotate }, - -// Video Playlist - { "VideoPlaylist.State", CAVPlaylistOperations::State }, - { "VideoPlaylist.Play", CAVPlaylistOperations::Play }, - { "VideoPlaylist.SkipPrevious", CAVPlaylistOperations::SkipPrevious }, - { "VideoPlaylist.SkipNext", CAVPlaylistOperations::SkipNext }, - { "VideoPlaylist.GetItems", CAVPlaylistOperations::GetItems }, - { "VideoPlaylist.Add", CAVPlaylistOperations::Add }, - { "VideoPlaylist.Insert", CAVPlaylistOperations::Insert }, - { "VideoPlaylist.Clear", CAVPlaylistOperations::Clear }, - { "VideoPlaylist.Shuffle", CAVPlaylistOperations::Shuffle }, - { "VideoPlaylist.UnShuffle", CAVPlaylistOperations::UnShuffle }, - { "VideoPlaylist.Repeat", CAVPlaylistOperations::Repeat }, - { "VideoPlaylist.Remove", CAVPlaylistOperations::Remove }, - { "VideoPlaylist.Swap", CAVPlaylistOperations::Swap }, - -// AudioPlaylist - { "AudioPlaylist.State", CAVPlaylistOperations::State }, - { "AudioPlaylist.Play", CAVPlaylistOperations::Play }, - { "AudioPlaylist.SkipPrevious", CAVPlaylistOperations::SkipPrevious }, - { "AudioPlaylist.SkipNext", CAVPlaylistOperations::SkipNext }, - { "AudioPlaylist.GetItems", CAVPlaylistOperations::GetItems }, - { "AudioPlaylist.Add", CAVPlaylistOperations::Add }, - { "AudioPlaylist.Insert", CAVPlaylistOperations::Insert }, - { "AudioPlaylist.Clear", CAVPlaylistOperations::Clear }, - { "AudioPlaylist.Shuffle", CAVPlaylistOperations::Shuffle }, - { "AudioPlaylist.UnShuffle", CAVPlaylistOperations::UnShuffle }, - { "AudioPlaylist.Repeat", CAVPlaylistOperations::Repeat }, - { "AudioPlaylist.Remove", CAVPlaylistOperations::Remove }, - { "AudioPlaylist.Swap", CAVPlaylistOperations::Swap }, + { "Player.GetProperties", CPlayerOperations::GetProperties }, + + { "Player.PlayPause", CPlayerOperations::PlayPause }, + { "Player.Stop", CPlayerOperations::Stop }, + { "Player.SetSpeed", CPlayerOperations::SetSpeed }, + { "Player.Seek", CPlayerOperations::Seek }, + + { "Player.MoveLeft", CPlayerOperations::MoveLeft }, + { "Player.MoveRight", CPlayerOperations::MoveRight }, + { "Player.MoveDown", CPlayerOperations::MoveDown }, + { "Player.MoveUp", CPlayerOperations::MoveUp }, + + { "Player.ZoomOut", CPlayerOperations::ZoomOut }, + { "Player.ZoomIn", CPlayerOperations::ZoomIn }, + { "Player.Zoom", CPlayerOperations::Zoom }, + { "Player.Rotate", CPlayerOperations::Rotate }, + + { "Player.Open", CPlayerOperations::Open }, + { "Player.GoPrevious", CPlayerOperations::GoPrevious }, + { "Player.GoNext", CPlayerOperations::GoNext }, + { "Player.GoTo", CPlayerOperations::GoTo }, + { "Player.Shuffle", CPlayerOperations::Shuffle }, + { "Player.UnShuffle", CPlayerOperations::UnShuffle }, + { "Player.Repeat", CPlayerOperations::Repeat }, // Playlist - { "Playlist.Create", CPlaylistOperations::Create }, - { "Playlist.Destroy", CPlaylistOperations::Destroy }, - + { "Playlist.GetPlaylists", CPlaylistOperations::GetPlaylists }, + { "Playlist.GetProperties", CPlaylistOperations::GetProperties }, { "Playlist.GetItems", CPlaylistOperations::GetItems }, { "Playlist.Add", CPlaylistOperations::Add }, + { "Playlist.Insert", CPlaylistOperations::Insert }, + { "Playlist.Clear", CPlaylistOperations::Clear }, { "Playlist.Remove", CPlaylistOperations::Remove }, { "Playlist.Swap", CPlaylistOperations::Swap }, - { "Playlist.Clear", CPlaylistOperations::Clear }, - { "Playlist.Shuffle", CPlaylistOperations::Shuffle }, - { "Playlist.UnShuffle", CPlaylistOperations::UnShuffle }, // Files { "Files.GetSources", CFileOperations::GetRootDirectory }, @@ -251,8 +184,6 @@ JsonRpcMethodMap CJSONServiceDescription::m_methodMaps[] = { { "Application.Quit", CApplicationOperations::Quit }, // XBMC operations - { "XBMC.Play", CXBMCOperations::Play }, - { "XBMC.StartSlideshow", CXBMCOperations::StartSlideshow }, { "XBMC.GetInfoLabels", CXBMCOperations::GetInfoLabels }, { "XBMC.GetInfoBooleans", CXBMCOperations::GetInfoBooleans } }; diff --git a/xbmc/interfaces/json-rpc/JSONUtils.h b/xbmc/interfaces/json-rpc/JSONUtils.h index 9143559c41..1d392c6030 100644 --- a/xbmc/interfaces/json-rpc/JSONUtils.h +++ b/xbmc/interfaces/json-rpc/JSONUtils.h @@ -102,6 +102,24 @@ namespace JSONRPC json rpc method calls.*/ class CJSONUtils { + public: + static void MillisecondsToTimeObject(int time, CVariant &result) + { + int ms = time % 1000; + result["milliseconds"] = ms; + time = (time - ms) / 1000; + + int s = time % 60; + result["seconds"] = s; + time = (time - s) / 60; + + int m = time % 60; + result["minutes"] = m; + time = (time -m) / 60; + + result["hours"] = time; + } + protected: /*! \brief Checks if the given object contains a parameter diff --git a/xbmc/interfaces/json-rpc/Makefile b/xbmc/interfaces/json-rpc/Makefile index b7338dd617..648ec24895 100644 --- a/xbmc/interfaces/json-rpc/Makefile +++ b/xbmc/interfaces/json-rpc/Makefile @@ -1,12 +1,9 @@ SRCS=ApplicationOperations.cpp \ AudioLibrary.cpp \ - AVPlayerOperations.cpp \ - AVPlaylistOperations.cpp \ FileItemHandler.cpp \ FileOperations.cpp \ JSONRPC.cpp \ JSONServiceDescription.cpp \ - PicturePlayerOperations.cpp \ PlayerOperations.cpp \ PlaylistOperations.cpp \ SystemOperations.cpp \ diff --git a/xbmc/interfaces/json-rpc/PicturePlayerOperations.cpp b/xbmc/interfaces/json-rpc/PicturePlayerOperations.cpp deleted file mode 100644 index 0093a4c9dc..0000000000 --- a/xbmc/interfaces/json-rpc/PicturePlayerOperations.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "PicturePlayerOperations.h" -#include "Application.h" -#include "guilib/Key.h" - -using namespace JSONRPC; - -JSON_STATUS CPicturePlayerOperations::PlayPause(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_PAUSE); -} - -JSON_STATUS CPicturePlayerOperations::Stop(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_STOP); -} - -JSON_STATUS CPicturePlayerOperations::SkipPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_PREV_PICTURE); -} - -JSON_STATUS CPicturePlayerOperations::SkipNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_NEXT_PICTURE); -} - -JSON_STATUS CPicturePlayerOperations::MoveLeft(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_MOVE_LEFT); -} - -JSON_STATUS CPicturePlayerOperations::MoveRight(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_MOVE_RIGHT); -} - -JSON_STATUS CPicturePlayerOperations::MoveDown(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_MOVE_DOWN); -} - -JSON_STATUS CPicturePlayerOperations::MoveUp(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_MOVE_UP); -} - -JSON_STATUS CPicturePlayerOperations::ZoomOut(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_ZOOM_OUT); -} - -JSON_STATUS CPicturePlayerOperations::ZoomIn(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_ZOOM_IN); -} - -JSON_STATUS CPicturePlayerOperations::Zoom(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_ZOOM_LEVEL_NORMAL + ((int)parameterObject["value"].asInteger() - 1)); -} - -JSON_STATUS CPicturePlayerOperations::Rotate(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - return SendAction(ACTION_ROTATE_PICTURE); -} - -/*JSON_STATUS Move(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW); - if (pSlideShow) { - CAction action; - action.id = ACTION_ANALOG_MOVE; - action.GetAmount()=(float) atof(paras[0]); - action.GetAmount(1)=(float) atof(paras[1]); - pSlideShow->OnAction(action); -}*/ - -JSON_STATUS CPicturePlayerOperations::SendAction(int actionID) -{ - g_application.getApplicationMessenger().SendAction(CAction(actionID), WINDOW_SLIDESHOW); - - return ACK; -} - diff --git a/xbmc/interfaces/json-rpc/PicturePlayerOperations.h b/xbmc/interfaces/json-rpc/PicturePlayerOperations.h deleted file mode 100644 index b75161ac88..0000000000 --- a/xbmc/interfaces/json-rpc/PicturePlayerOperations.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2010 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "utils/StdString.h" -#include "JSONRPC.h" - -namespace JSONRPC -{ - class CPicturePlayerOperations - { - public: - static JSON_STATUS PlayPause(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Stop(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS SkipPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS SkipNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - - static JSON_STATUS MoveLeft(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS MoveRight(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS MoveDown(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS MoveUp(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - - static JSON_STATUS ZoomOut(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS ZoomIn(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Zoom(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Rotate(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - - private: - static inline JSON_STATUS SendAction(int actionID); -// static JSON_STATUS Move(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - }; -} diff --git a/xbmc/interfaces/json-rpc/PlayerOperations.cpp b/xbmc/interfaces/json-rpc/PlayerOperations.cpp index efa12ae20c..8a33d6291d 100644 --- a/xbmc/interfaces/json-rpc/PlayerOperations.cpp +++ b/xbmc/interfaces/json-rpc/PlayerOperations.cpp @@ -24,14 +24,894 @@ #include "Util.h" #include "PlayListPlayer.h" #include "guilib/GUIWindowManager.h" +#include "GUIUserMessages.h" +#include "pictures/GUIWindowSlideShow.h" +#include "interfaces/Builtins.h" +#include "PlayListPlayer.h" +#include "PartyModeManager.h" +#include "ApplicationMessenger.h" +#include "FileItem.h" using namespace JSONRPC; +using namespace PLAYLIST; JSON_STATUS CPlayerOperations::GetActivePlayers(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - result["video"] = g_application.IsPlayingVideo(); - result["audio"] = g_application.IsPlayingAudio(); - result["picture"] = g_windowManager.IsWindowActive(WINDOW_SLIDESHOW); + int activePlayers = GetActivePlayers(); + result = CVariant(CVariant::VariantTypeArray); + + if (activePlayers & Video) + { + CVariant video = CVariant(CVariant::VariantTypeObject); + video["playerid"] = GetPlaylist(Video); + video["type"] = "video"; + result.append(video); + } + if (activePlayers & Audio) + { + CVariant audio = CVariant(CVariant::VariantTypeObject); + audio["playerid"] = GetPlaylist(Audio); + audio["type"] = "audio"; + result.append(audio); + } + if (activePlayers & Picture) + { + CVariant picture = CVariant(CVariant::VariantTypeObject); + picture["playerid"] = GetPlaylist(Picture); + picture["type"] = "picture"; + result.append(picture); + } + + return OK; +} + +JSON_STATUS CPlayerOperations::GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + PlayerType player = GetPlayer(parameterObject["playerid"]); + + CVariant properties = CVariant(CVariant::VariantTypeObject); + for (unsigned int index = 0; index < parameterObject["properties"].size(); index++) + { + CStdString propertyName = parameterObject["properties"][index].asString(); + CVariant property; + JSON_STATUS ret; + if ((ret = GetPropertyValue(player, propertyName, property)) != OK) + return ret; + + properties[propertyName] = property; + } + + result = properties; + + return OK; +} + +JSON_STATUS CPlayerOperations::PlayPause(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + CGUIWindowSlideShow *slideshow = NULL; + switch (GetPlayer(parameterObject["playerid"])) + { + case Video: + case Audio: + CBuiltins::Execute("playercontrol(play)"); + result["speed"] = g_application.IsPaused() ? 0 : g_application.GetPlaySpeed(); + return OK; + + case Picture: + SendSlideshowAction(ACTION_PAUSE); + slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW); + if (slideshow && slideshow->IsPlaying() && !slideshow->IsPaused()) + result["speed"] = slideshow->GetDirection(); + else + result["speed"] = 0; + return OK; + + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::Stop(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Video: + case Audio: + g_application.getApplicationMessenger().SendAction(CAction(ACTION_STOP)); + return ACK; + + case Picture: + SendSlideshowAction(ACTION_STOP); + return ACK; + + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::SetSpeed(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + int speed; + switch (GetPlayer(parameterObject["playerid"])) + { + case Video: + case Audio: + if (parameterObject["speed"].isInteger()) + { + speed = (int)parameterObject["speed"].asInteger(); + if (speed != 0) + { + // If the player is paused we first need to unpause + if (g_application.IsPaused()) + g_application.m_pPlayer->Pause(); + g_application.SetPlaySpeed(speed); + } + else + g_application.m_pPlayer->Pause(); + } + else if (parameterObject["speed"].isString()) + { + speed = g_application.GetPlaySpeed(); + if (stricmp(parameterObject["speed"].asString(), "increment") == 0) + CBuiltins::Execute("playercontrol(forward)"); + else + CBuiltins::Execute("playercontrol(rewind)"); + } + else + return InvalidParams; + + result["speed"] = g_application.IsPaused() ? 0 : g_application.GetPlaySpeed(); + return ACK; + + case Picture: + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::Seek(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + PlayerType player = GetPlayer(parameterObject["playerid"]); + switch (player) + { + case Video: + case Audio: + if (parameterObject["value"].isObject()) + g_application.SeekTime(((parameterObject["value"]["hours"].asInteger() * 60) + parameterObject["value"]["minutes"].asInteger()) * 60 + + parameterObject["value"]["seconds"].asInteger() + ((double)parameterObject["value"]["milliseconds"].asInteger() / 1000.0)); + else if (parameterObject["value"].isDouble()) + g_application.SeekPercentage(parameterObject["value"].asFloat()); + else if (parameterObject["value"].isString()) + { + CStdString step = parameterObject["value"].asString(); + if (step.Equals("smallforward")) + CBuiltins::Execute("playercontrol(smallskipforward)"); + else if (step.Equals("smallbackward")) + CBuiltins::Execute("playercontrol(smallskipbackward)"); + else if (step.Equals("bigforward")) + CBuiltins::Execute("playercontrol(bigskipforward)"); + else if (step.Equals("bigbackward")) + CBuiltins::Execute("playercontrol(bigskipbackward)"); + else + return InvalidParams; + } + else + return InvalidParams; + + GetPropertyValue(player, "percentage", result["percentage"]); + GetPropertyValue(player, "time", result["time"]); + GetPropertyValue(player, "totaltime", result["totaltime"]); + return OK; + + case Picture: + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::MoveLeft(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Picture: + SendSlideshowAction(ACTION_MOVE_LEFT); + return ACK; + + case Video: + case Audio: + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::MoveRight(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Picture: + SendSlideshowAction(ACTION_MOVE_RIGHT); + return ACK; + + case Video: + case Audio: + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::MoveDown(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Picture: + SendSlideshowAction(ACTION_MOVE_DOWN); + return ACK; + + case Video: + case Audio: + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::MoveUp(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Picture: + SendSlideshowAction(ACTION_MOVE_UP); + return ACK; + + case Video: + case Audio: + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::ZoomOut(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Picture: + SendSlideshowAction(ACTION_ZOOM_OUT); + return ACK; + + case Video: + case Audio: + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::ZoomIn(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Picture: + SendSlideshowAction(ACTION_ZOOM_IN); + return ACK; + + case Video: + case Audio: + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::Zoom(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Picture: + SendSlideshowAction(ACTION_ZOOM_LEVEL_NORMAL + ((int)parameterObject["value"].asInteger() - 1)); + return ACK; + + case Video: + case Audio: + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::Rotate(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Picture: + SendSlideshowAction(ACTION_ROTATE_PICTURE); + return ACK; + + case Video: + case Audio: + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::Open(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + if (parameterObject["item"].isObject() && parameterObject["item"].isMember("playlistid")) + { + int playlistid = (int)parameterObject["item"]["playlistid"].asInteger(); + CGUIWindowSlideShow *slideshow = NULL; + switch (playlistid) + { + case PLAYLIST_MUSIC: + case PLAYLIST_VIDEO: + if (g_playlistPlayer.GetCurrentPlaylist() != playlistid) + g_playlistPlayer.SetCurrentPlaylist(playlistid); + + g_application.getApplicationMessenger().PlayListPlayerPlay((int)parameterObject["item"]["position"].asInteger()); + + OnPlaylistChanged(); + break; + + case PLAYLIST_PICTURE: + slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW); + if (slideshow && slideshow->NumSlides() > 0) + { + if (g_application.IsPlayingVideo()) + g_application.StopPlaying(); + + g_graphicsContext.Lock(); + + g_application.WakeUpScreenSaverAndDPMS(); + slideshow->StartSlideShow(); + + if (g_windowManager.GetActiveWindow() != WINDOW_SLIDESHOW) + g_windowManager.ActivateWindow(WINDOW_SLIDESHOW); + + g_graphicsContext.Unlock(); + } + else + return FailedToExecute; + break; + } + + return ACK; + } + else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("path")) + { + CStdString exec = "slideShow("; + + exec += parameterObject["item"]["path"].asString(); + + if (parameterObject["item"]["random"].asBoolean()) + exec += ", random"; + else + exec += ", notrandom"; + + if (parameterObject["item"]["recursive"].asBoolean()) + exec += ", recursive"; + + exec += ")"; + ThreadMessage msg = { TMSG_EXECUTE_BUILT_IN, (DWORD)0, (DWORD)0, exec }; + g_application.getApplicationMessenger().SendMessage(msg); + + return ACK; + } + else + { + CFileItemList list; + if (FillFileItemList(parameterObject["item"], list) && list.Size() > 0) + { + g_application.getApplicationMessenger().MediaPlay(list); + return ACK; + } + else + return InvalidParams; + } + + return InvalidParams; +} + +JSON_STATUS CPlayerOperations::GoPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Video: + case Audio: + g_application.getApplicationMessenger().SendAction(CAction(ACTION_PREV_ITEM)); + return ACK; + + case Picture: + SendSlideshowAction(ACTION_PREV_PICTURE); + return ACK; + + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::GoNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Video: + case Audio: + g_application.getApplicationMessenger().SendAction(CAction(ACTION_NEXT_ITEM)); + return ACK; + + case Picture: + SendSlideshowAction(ACTION_NEXT_PICTURE); + return ACK; + + case None: + default: + return FailedToExecute; + } +} + +JSON_STATUS CPlayerOperations::GoTo(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + int position = (int)parameterObject["position"].asInteger(); + switch (GetPlayer(parameterObject["playerid"])) + { + case Video: + case Audio: + g_application.getApplicationMessenger().PlayListPlayerPlay(position); + break; + + case Picture: + case None: + default: + return FailedToExecute; + } + + OnPlaylistChanged(); + return ACK; +} + +JSON_STATUS CPlayerOperations::Shuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + CGUIWindowSlideShow *slideshow = NULL; + switch (GetPlayer(parameterObject["playerid"])) + { + case Video: + case Audio: + g_application.getApplicationMessenger().PlayListPlayerShuffle(GetPlaylist(GetPlayer(parameterObject["playerid"])), true); + OnPlaylistChanged(); + break; + + case Picture: + slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW); + if (slideshow && !slideshow->IsShuffled()) + slideshow->Shuffle(); + else if (!slideshow) + return FailedToExecute; + break; + + default: + return FailedToExecute; + } + return ACK; +} + +JSON_STATUS CPlayerOperations::UnShuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + switch (GetPlayer(parameterObject["playerid"])) + { + case Video: + case Audio: + g_application.getApplicationMessenger().PlayListPlayerShuffle(GetPlaylist(GetPlayer(parameterObject["playerid"])), false); + OnPlaylistChanged(); + break; + + case Picture: + default: + return FailedToExecute; + } + return ACK; +} + +JSON_STATUS CPlayerOperations::Repeat(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + REPEAT_STATE state = REPEAT_NONE; + std::string strState = parameterObject["state"].asString(); + + switch (GetPlayer(parameterObject["playerid"])) + { + case Video: + case Audio: + if (strState.compare("one") == 0) + state = REPEAT_ONE; + else if (strState.compare("all") == 0) + state = REPEAT_ALL; + + g_application.getApplicationMessenger().PlayListPlayerRepeat(GetPlaylist(GetPlayer(parameterObject["playerid"])), state); + OnPlaylistChanged(); + break; + + case Picture: + default: + return FailedToExecute; + } + + return ACK; +} + +int CPlayerOperations::GetActivePlayers() +{ + int activePlayers = 0; + + if (g_application.IsPlayingVideo()) + activePlayers |= Video; + if (g_application.IsPlayingAudio()) + activePlayers |= Audio; + if (g_windowManager.IsWindowActive(WINDOW_SLIDESHOW)) + activePlayers |= Picture; + + return activePlayers; +} + +PlayerType CPlayerOperations::GetPlayer(const CVariant &player) +{ + int activePlayers = GetActivePlayers(); + int playerID = PlayerImplicit; + + switch ((int)player.asInteger()) + { + case PLAYLIST_VIDEO: + playerID = Video; + break; + + case PLAYLIST_MUSIC: + playerID = Audio; + break; + + case PLAYLIST_PICTURE: + playerID = Picture; + break; + } + + int choosenPlayer = playerID & activePlayers; + + // Implicit order + if (choosenPlayer & Video) + return Video; + else if (choosenPlayer & Audio) + return Audio; + else if (choosenPlayer & Picture) + return Picture; + else + return None; +} + +int CPlayerOperations::GetPlaylist(PlayerType player) +{ + switch (player) + { + case Video: + return PLAYLIST_VIDEO; + + case Audio: + return PLAYLIST_MUSIC; + + case Picture: + return PLAYLIST_PICTURE; + + default: + return PLAYLIST_NONE; + } +} + +void CPlayerOperations::SendSlideshowAction(int actionID) +{ + g_application.getApplicationMessenger().SendAction(CAction(actionID), WINDOW_SLIDESHOW); +} + +void CPlayerOperations::OnPlaylistChanged() +{ + CGUIMessage msg(GUI_MSG_PLAYLIST_CHANGED, 0, 0); + g_windowManager.SendThreadMessage(msg); +} + +JSON_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStdString &property, CVariant &result) +{ + if (player == None) + return FailedToExecute; + + int playlist = GetPlaylist(player); + + if (property.Equals("type")) + { + switch (player) + { + case Video: + result = "video"; + break; + + case Audio: + result = "audio"; + break; + + case Picture: + result = "picture"; + break; + } + } + else if (property.Equals("partymode")) + { + switch (player) + { + case Video: + case Audio: + result = g_partyModeManager.IsEnabled(); + break; + + case Picture: + result = false; + break; + } + } + else if (property.Equals("speed")) + { + CGUIWindowSlideShow *slideshow = NULL; + switch (player) + { + case Video: + case Audio: + result = g_application.IsPaused() ? 0 : g_application.GetPlaySpeed(); + break; + + case Picture: + slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW); + if (slideshow && slideshow->IsPlaying() && !slideshow->IsPaused()) + result = slideshow->GetDirection(); + else + result = 0; + break; + } + } + else if (property.Equals("time")) + { + switch (player) + { + case Video: + case Audio: + MillisecondsToTimeObject((int)(g_application.GetTime() * 1000.0), result); + break; + + case Picture: + MillisecondsToTimeObject(0, result); + break; + } + } + else if (property.Equals("percentage")) + { + CGUIWindowSlideShow *slideshow = NULL; + switch (player) + { + case Video: + case Audio: + result = g_application.GetPercentage(); + break; + + case Picture: + slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW); + if (slideshow && slideshow->NumSlides() > 0) + result = (double)slideshow->CurrentSlide() / slideshow->NumSlides(); + else + result = 0.0; + break; + } + } + else if (property.Equals("totaltime")) + { + switch (player) + { + case Video: + case Audio: + MillisecondsToTimeObject((int)(g_application.GetTotalTime() * 1000.0), result); + break; + + case Picture: + MillisecondsToTimeObject(0, result); + break; + } + } + else if (property.Equals("playlistid")) + { + result = playlist; + } + else if (property.Equals("position")) + { + CGUIWindowSlideShow *slideshow = NULL; + switch (player) + { + case Video: + case Audio: + if (g_playlistPlayer.GetCurrentPlaylist() == playlist) + result = g_playlistPlayer.GetCurrentSong(); + else + result = -1; + break; + + case Picture: + slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW); + if (slideshow && slideshow->IsPlaying()) + result = slideshow->CurrentSlide(); + else + result = -1; + break; + + default: + result = -1; + break; + } + } + else if (property.Equals("repeat")) + { + switch (player) + { + case Video: + case Audio: + switch (g_playlistPlayer.GetRepeat(playlist)) + { + case REPEAT_ONE: + result = "one"; + break; + case REPEAT_ALL: + result = "all"; + break; + default: + result = "off"; + break; + } + break; + + case Picture: + default: + result = "off"; + } + } + else if (property.Equals("shuffled")) + { + CGUIWindowSlideShow *slideshow = NULL; + switch (player) + { + case Video: + case Audio: + result = g_playlistPlayer.IsShuffled(playlist); + break; + + case Picture: + slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW); + if (slideshow && slideshow->IsPlaying()) + result = slideshow->IsShuffled(); + else + result = -1; + break; + + default: + result = -1; + break; + } + } + else if (property.Equals("canseek")) + { + switch (player) + { + case Video: + case Audio: + if (g_application.m_pPlayer) + result = g_application.m_pPlayer->CanSeek(); + else + result = false; + break; + + case Picture: + default: + result = false; + break; + } + } + else if (property.Equals("canchangespeed")) + { + switch (player) + { + case Video: + case Audio: + result = true; + break; + + case Picture: + default: + result = false; + break; + } + } + else if (property.Equals("canmove")) + { + switch (player) + { + case Picture: + result = true; + break; + + case Video: + case Audio: + default: + result = false; + break; + } + } + else if (property.Equals("canzoom")) + { + switch (player) + { + case Picture: + result = true; + break; + + case Video: + case Audio: + default: + result = false; + break; + } + } + else if (property.Equals("canrotate")) + { + switch (player) + { + case Picture: + result = true; + break; + + case Video: + case Audio: + default: + result = false; + break; + } + } + else if (property.Equals("canshuffle")) + { + switch (player) + { + case Video: + case Audio: + case Picture: + result = true; + break; + + default: + result = false; + break; + } + } + else if (property.Equals("canrepeat")) + { + switch (player) + { + case Video: + case Audio: + result = true; + break; + + case Picture: + default: + result = false; + break; + } + } + else + return InvalidParams; return OK; } diff --git a/xbmc/interfaces/json-rpc/PlayerOperations.h b/xbmc/interfaces/json-rpc/PlayerOperations.h index a43476736b..da844bf149 100644 --- a/xbmc/interfaces/json-rpc/PlayerOperations.h +++ b/xbmc/interfaces/json-rpc/PlayerOperations.h @@ -22,12 +22,55 @@ #include "utils/StdString.h" #include "JSONRPC.h" +#include "FileItemHandler.h" namespace JSONRPC { - class CPlayerOperations + enum PlayerType + { + None = 0, + Video = 0x1, + Audio = 0x2, + Picture = 0x4 + }; + + static const int PlayerImplicit = (Video | Audio | Picture); + + class CPlayerOperations : CFileItemHandler { public: static JSON_STATUS GetActivePlayers(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + + static JSON_STATUS PlayPause(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS Stop(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS SetSpeed(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS Seek(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + + static JSON_STATUS MoveLeft(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS MoveRight(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS MoveDown(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS MoveUp(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + + static JSON_STATUS ZoomOut(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS ZoomIn(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS Zoom(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS Rotate(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + + static JSON_STATUS Open(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS GoPrevious(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS GoNext(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS GoTo(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS Shuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS UnShuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS Repeat(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + + private: + static int GetActivePlayers(); + static PlayerType GetPlayer(const CVariant &player); + static int GetPlaylist(PlayerType player); + static void SendSlideshowAction(int actionID); + static void OnPlaylistChanged(); + static JSON_STATUS GetPropertyValue(PlayerType player, const CStdString &property, CVariant &result); }; } diff --git a/xbmc/interfaces/json-rpc/PlaylistOperations.cpp b/xbmc/interfaces/json-rpc/PlaylistOperations.cpp index 13b003b8a0..219f887127 100644 --- a/xbmc/interfaces/json-rpc/PlaylistOperations.cpp +++ b/xbmc/interfaces/json-rpc/PlaylistOperations.cpp @@ -20,229 +20,271 @@ */ #include "PlaylistOperations.h" +#include "playlists/PlayList.h" #include "PlayListPlayer.h" -#include "playlists/PlayListFactory.h" #include "Util.h" +#include "guilib/GUIWindowManager.h" #include "GUIUserMessages.h" -#include "utils/StringUtils.h" -#include "threads/SingleLock.h" +#include "Application.h" +#include "pictures/GUIWindowSlideShow.h" +#include "pictures/PictureInfoTag.h" using namespace JSONRPC; using namespace PLAYLIST; using namespace std; -#define PLAYLIST_MEMBER_VIRTUAL "id" -#define PLAYLIST_MEMBER_FILE "file" - -map CPlaylistOperations::VirtualPlaylists; -CCriticalSection CPlaylistOperations::VirtualCriticalSection; - -JSON_STATUS CPlaylistOperations::Create(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSON_STATUS CPlaylistOperations::GetPlaylists(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CStdString file = ""; - CStdString id = ""; - - if (parameterObject["playlist"].isMember(PLAYLIST_MEMBER_FILE) && parameterObject["playlist"][PLAYLIST_MEMBER_FILE].isString()) - file = parameterObject["playlist"][PLAYLIST_MEMBER_FILE].asString(); - - if (parameterObject["playlist"].isMember(PLAYLIST_MEMBER_VIRTUAL) && parameterObject["playlist"][PLAYLIST_MEMBER_VIRTUAL].isString()) - id = parameterObject["playlist"][PLAYLIST_MEMBER_VIRTUAL].asString(); + result = CVariant(CVariant::VariantTypeArray); + CVariant playlist = CVariant(CVariant::VariantTypeObject); + + playlist["playlistid"] = PLAYLIST_MUSIC; + playlist["type"] = "audio"; + result.append(playlist); + + playlist["playlistid"] = PLAYLIST_VIDEO; + playlist["type"] = "video"; + result.append(playlist); + + playlist["playlistid"] = PLAYLIST_PICTURE; + playlist["type"] = "picture"; + result.append(playlist); - CPlayListPtr playlist; + return OK; +} - if (file.size() > 0) +JSON_STATUS CPlaylistOperations::GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +{ + int playlist = GetPlaylist(parameterObject["playlistid"]); + for (unsigned int index = 0; index < parameterObject["properties"].size(); index++) { - CPlayListPtr playlist = CPlayListPtr(CPlayListFactory::Create(file)); - if (playlist == NULL || !playlist->Load(file)) - return playlist == NULL ? InvalidParams : InternalError; - } - else - playlist = CPlayListPtr(new CPlayList()); + CStdString propertyName = parameterObject["properties"][index].asString(); + CVariant property; + JSON_STATUS ret; + if ((ret = GetPropertyValue(playlist, propertyName, property)) != OK) + return ret; - if (id.size() == 0) - { - do - { - id = StringUtils::CreateUUID(); - } while (VirtualPlaylists.find(id) != VirtualPlaylists.end()); + result[propertyName] = property; } - CSingleLock lock(VirtualCriticalSection); - VirtualPlaylists[id] = playlist; - result["playlistid"] = id; - return OK; } -JSON_STATUS CPlaylistOperations::Destroy(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - CSingleLock lock(VirtualCriticalSection); - if (VirtualPlaylists.erase(parameterObject["playlistid"].asString()) <= 0) - return InvalidParams; - - return ACK; -} - JSON_STATUS CPlaylistOperations::GetItems(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CSingleLock lock(VirtualCriticalSection); - CPlayListPtr playlist = GetPlaylist(parameterObject); + CFileItemList list; + int playlist = GetPlaylist(parameterObject["playlistid"]); - if (playlist) + CGUIWindowSlideShow *slideshow = NULL; + switch (playlist) { - CFileItemList items; - for (int i = 0; i < playlist->size(); i++) - items.Add((*playlist)[i]); - - CStdString name = playlist->GetName(); - if (!name.IsEmpty()) - result["name"] = playlist->GetName(); - - HandleFileItemList("id", true, "items", items, parameterObject, result); - - return OK; + case PLAYLIST_VIDEO: + case PLAYLIST_MUSIC: + g_application.getApplicationMessenger().PlayListPlayerGetItems(playlist, list); + break; + + case PLAYLIST_PICTURE: + slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW); + if (slideshow) + slideshow->GetSlideShowContents(list); + break; } - return InvalidParams; + HandleFileItemList("id", true, "items", list, parameterObject, result); + + return OK; } JSON_STATUS CPlaylistOperations::Add(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CSingleLock lock(VirtualCriticalSection); - CPlayListPtr playlist = GetPlaylist(parameterObject); - //parameterObject.removeMember(PLAYLIST_MEMBER_VIRTUAL); + int playlist = GetPlaylist(parameterObject["playlistid"]); + CFileItemList list; + CVariant params = parameterObject; - if (playlist) + CGUIWindowSlideShow *slideshow = NULL; + switch (playlist) { - CFileItemList list; - if (CFileItemHandler::FillFileItemList(parameterObject, list) && list.Size() > 0) - playlist->Add(list); - - return ACK; + case PLAYLIST_VIDEO: + case PLAYLIST_MUSIC: + if (playlist == PLAYLIST_VIDEO) + params["item"]["media"] = "video"; + else if (playlist == PLAYLIST_MUSIC) + params["item"]["media"] = "music"; + else + return FailedToExecute; + + if (!FillFileItemList(params["item"], list)) + return InvalidParams; + + g_application.getApplicationMessenger().PlayListPlayerAdd(playlist, list); + + break; + + case PLAYLIST_PICTURE: + slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW); + if (!slideshow) + return FailedToExecute; + + params["item"]["media"] = "pictures"; + if (!FillFileItemList(params["item"], list)) + return InvalidParams; + + for (int index = 0; index < list.Size(); index++) + { + CPictureInfoTag picture = CPictureInfoTag(); + if (!picture.Load(list[index]->GetPath())) + continue; + + *list[index]->GetPictureInfoTag() = picture; + slideshow->Add(list[index].get()); + } + break; } - - return InvalidParams; + + NotifyAll(); + return ACK; } -JSON_STATUS CPlaylistOperations::Remove(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSON_STATUS CPlaylistOperations::Insert(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CSingleLock lock(VirtualCriticalSection); - CPlayListPtr playlist = GetPlaylist(parameterObject); + int playlist = GetPlaylist(parameterObject["playlistid"]); + if (playlist == PLAYLIST_PICTURE) + return FailedToExecute; + + CFileItemList list; + CVariant params = parameterObject; + if (playlist == PLAYLIST_VIDEO) + params["item"]["media"] = "video"; + else if (playlist == PLAYLIST_MUSIC) + params["item"]["media"] = "music"; + else + return FailedToExecute; - if (playlist) - { - if (parameterObject["item"].isInteger()) - playlist->Remove((int)parameterObject["item"].asInteger()); - else if (parameterObject["item"].isString()) - playlist->Remove(parameterObject["item"].asString()); + if (!FillFileItemList(params["item"], list)) + return InvalidParams; - return ACK; - } + g_application.getApplicationMessenger().PlayListPlayerInsert(GetPlaylist(parameterObject["playlistid"]), list, (int)parameterObject["position"].asInteger()); - return InvalidParams; + NotifyAll(); + return ACK; } -JSON_STATUS CPlaylistOperations::Swap(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSON_STATUS CPlaylistOperations::Remove(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CSingleLock lock(VirtualCriticalSection); - CPlayListPtr playlist = GetPlaylist(parameterObject); + int playlist = GetPlaylist(parameterObject["playlistid"]); + if (playlist == PLAYLIST_PICTURE) + return FailedToExecute; + + int position = (int)parameterObject["position"].asInteger(); + if (g_playlistPlayer.GetCurrentPlaylist() == playlist && g_playlistPlayer.GetCurrentSong() == position) + return InvalidParams; - if (playlist && playlist->Swap((int)parameterObject["item1"].asInteger(), (int)parameterObject["item2"].asInteger())) - return ACK; + g_application.getApplicationMessenger().PlayListPlayerRemove(playlist, position); - return InvalidParams; + NotifyAll(); + return ACK; } JSON_STATUS CPlaylistOperations::Clear(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CSingleLock lock(VirtualCriticalSection); - CPlayListPtr playlist = GetPlaylist(parameterObject); - - if (playlist) + int playlist = GetPlaylist(parameterObject["playlistid"]); + CGUIWindowSlideShow *slideshow = NULL; + switch (playlist) { - playlist->Clear(); - return ACK; + case PLAYLIST_MUSIC: + case PLAYLIST_VIDEO: + g_application.getApplicationMessenger().PlayListPlayerClear(playlist); + break; + + case PLAYLIST_PICTURE: + slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW); + if (!slideshow) + return FailedToExecute; + slideshow->Reset(); + break; } - return InvalidParams; + NotifyAll(); + return ACK; } -JSON_STATUS CPlaylistOperations::Shuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +JSON_STATUS CPlaylistOperations::Swap(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { - CSingleLock lock(VirtualCriticalSection); - CPlayListPtr playlist = GetPlaylist(parameterObject); + int playlist = GetPlaylist(parameterObject["playlistid"]); + if (playlist == PLAYLIST_PICTURE) + return FailedToExecute; - if (playlist) - { - playlist->Shuffle(); - return ACK; - } + g_application.getApplicationMessenger().PlayListPlayerSwap(playlist, (int)parameterObject["position1"].asInteger(), (int)parameterObject["position2"].asInteger()); - return InvalidParams; + NotifyAll(); + return ACK; } -JSON_STATUS CPlaylistOperations::UnShuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) +int CPlaylistOperations::GetPlaylist(const CVariant &playlist) { - CSingleLock lock(VirtualCriticalSection); - CPlayListPtr playlist = GetPlaylist(parameterObject); - - if (playlist) - { - playlist->UnShuffle(); - return ACK; - } + int playlistid = (int)playlist.asInteger(); + if (playlistid > PLAYLIST_NONE && playlistid <= PLAYLIST_PICTURE) + return playlistid; - return InvalidParams; + return PLAYLIST_NONE; } -bool CPlaylistOperations::FillFileItemList(const CVariant ¶meterObject, CFileItemList &list) +void CPlaylistOperations::NotifyAll() { - bool found = false; + CGUIMessage msg(GUI_MSG_PLAYLIST_CHANGED, 0, 0); + g_windowManager.SendThreadMessage(msg); +} - if (parameterObject["playlist"].isMember(PLAYLIST_MEMBER_FILE) && parameterObject["playlist"][PLAYLIST_MEMBER_FILE].isString()) +JSON_STATUS CPlaylistOperations::GetPropertyValue(int playlist, const CStdString &property, CVariant &result) +{ + if (property.Equals("type")) { - CStdString file = parameterObject["playlist"][PLAYLIST_MEMBER_FILE].asString(); - CPlayListPtr playlist = CPlayListPtr(CPlayListFactory::Create(file)); - if (playlist && playlist->Load(file)) + switch (playlist) { - for (int i = 0; i < playlist->size(); i++) - list.Add((*playlist)[i]); - - found = true; + case PLAYLIST_MUSIC: + result = "audio"; + break; + + case PLAYLIST_VIDEO: + result = "video"; + break; + + case PLAYLIST_PICTURE: + result = "pictures"; + break; + + default: + result = "unknown"; + break; } } - - CSingleLock lock(VirtualCriticalSection); - if (parameterObject["playlist"].isMember(PLAYLIST_MEMBER_VIRTUAL) && parameterObject["playlist"][PLAYLIST_MEMBER_VIRTUAL].isString()) + else if (property.Equals("size")) { - CStdString id = parameterObject["playlist"][PLAYLIST_MEMBER_VIRTUAL].asString(); - CPlayListPtr playlist = VirtualPlaylists[id]; - if (playlist) + CFileItemList list; + CGUIWindowSlideShow *slideshow = NULL; + switch (playlist) { - for (int i = 0; i < playlist->size(); i++) - list.Add((*playlist)[i]); - - found = true; + case PLAYLIST_MUSIC: + case PLAYLIST_VIDEO: + g_application.getApplicationMessenger().PlayListPlayerGetItems(playlist, list); + result = list.Size(); + break; + + case PLAYLIST_PICTURE: + slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW); + if (slideshow) + result = slideshow->NumSlides(); + else + result = 0; + break; + + default: + result = 0; + break; } } + else + return InvalidParams; - return found; -} - -CPlayListPtr CPlaylistOperations::GetPlaylist(const CVariant ¶meterObject) -{ - if (parameterObject["playlist"].isMember(PLAYLIST_MEMBER_VIRTUAL) && parameterObject["playlist"][PLAYLIST_MEMBER_VIRTUAL].isString()) - { - CStdString id = parameterObject["playlist"][PLAYLIST_MEMBER_VIRTUAL].asString(); - return VirtualPlaylists[id]; - } - else if (parameterObject["playlist"].isMember(PLAYLIST_MEMBER_FILE) && parameterObject["playlist"][PLAYLIST_MEMBER_FILE].isString()) - { - CStdString file = parameterObject["playlist"][PLAYLIST_MEMBER_FILE].asString(); - CPlayListPtr playlist = CPlayListPtr(CPlayListFactory::Create(file)); - if (playlist && playlist->Load(file)) - return playlist; - } - - return CPlayListPtr(); + return OK; } diff --git a/xbmc/interfaces/json-rpc/PlaylistOperations.h b/xbmc/interfaces/json-rpc/PlaylistOperations.h index ffd095cc55..a86ed9046c 100644 --- a/xbmc/interfaces/json-rpc/PlaylistOperations.h +++ b/xbmc/interfaces/json-rpc/PlaylistOperations.h @@ -23,28 +23,24 @@ #include "utils/StdString.h" #include "JSONRPC.h" #include "FileItemHandler.h" -#include "playlists/PlayList.h" namespace JSONRPC { class CPlaylistOperations : public CFileItemHandler { public: - static JSON_STATUS Create(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Destroy(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS GetPlaylists(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS GetProperties(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); static JSON_STATUS GetItems(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); static JSON_STATUS Add(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Remove(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Swap(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS Remove(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); + static JSON_STATUS Insert(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); static JSON_STATUS Clear(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS Shuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS UnShuffle(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - - static bool FillFileItemList(const CVariant ¶meterObject, CFileItemList &list); + static JSON_STATUS Swap(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); private: - static std::map VirtualPlaylists; - static CCriticalSection VirtualCriticalSection; - static PLAYLIST::CPlayListPtr GetPlaylist(const CVariant ¶meterObject); + static int GetPlaylist(const CVariant &playlist); + static inline void NotifyAll(); + static JSON_STATUS GetPropertyValue(int playlist, const CStdString &property, CVariant &result); }; } diff --git a/xbmc/interfaces/json-rpc/ServiceDescription.h b/xbmc/interfaces/json-rpc/ServiceDescription.h index cd946f8f81..d9e7dde93a 100644 --- a/xbmc/interfaces/json-rpc/ServiceDescription.h +++ b/xbmc/interfaces/json-rpc/ServiceDescription.h @@ -67,35 +67,178 @@ namespace JSONRPC "\"notifications\": { \"$ref\": \"Configuration.Notifications\", \"required\": true }" "}" "}", - "\"Player.State\": {" + "\"Library.Id\": {" + "\"type\": \"integer\"," + "\"default\": -1," + "\"minimum\": 1" + "}", + "\"Playlist.Id\": {" + "\"type\": \"integer\"," + "\"minimum\": 0," + "\"maximum\": 2," + "\"default\": -1" + "}", + "\"Playlist.Type\": {" + "\"type\": \"string\"," + "\"enum\": [ \"unknown\", \"video\", \"audio\", \"picture\", \"mixed\" ]" + "}", + "\"Playlist.Property.Name\": {" + "\"type\": \"string\"," + "\"enum\": [ \"type\", \"size\" ]" + "}", + "\"Playlist.Property.Value\": {" "\"type\": \"object\"," "\"properties\": {" - "\"playing\": { \"type\": \"boolean\", \"required\": true, \"description\": \"\" }," - "\"paused\": { \"type\": \"boolean\", \"required\": true, \"description\": \"\" }" + "\"type\": { \"$ref\": \"Playlist.Type\" }," + "\"size\": { \"type\": \"integer\", \"minimum\": 0 }" "}" "}", - "\"Player.State.Extended\": {" - "\"extends\": \"Player.State\"," - "\"properties\": {" - "\"partymode\": { \"type\": \"boolean\", \"required\": true, \"description\": \"\" }" - "}" + "\"Playlist.Position\": {" + "\"type\": \"integer\"," + "\"minimum\": 0," + "\"default\": -1" "}", - "\"Player.TimeValues\": {" - "\"extends\": \"Player.State\"," - "\"properties\": {" - "\"time\": { \"$ref\": \"Global.Time\", \"required\": true, \"description\": \"\" }," - "\"total\": { \"$ref\": \"Global.Time\", \"required\": true, \"description\": \"\" }" - "}" + "\"Playlist.Item\": {" + "\"type\": [" + "{ \"type\": \"object\", \"properties\": { \"file\": { \"type\": \"string\", \"description\": \"Path to a file (not a directory) to be added to the playlist\", \"required\": true } }, \"additionalProperties\": false }," + "{ \"type\": \"object\", \"properties\": { \"directory\": { \"type\": \"string\", \"required\": true } }, \"additionalProperties\": false }," + "{ \"type\": \"object\", \"properties\": { \"movieid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," + "{ \"type\": \"object\", \"properties\": { \"episodeid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," + "{ \"type\": \"object\", \"properties\": { \"musicvideoid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," + "{ \"type\": \"object\", \"properties\": { \"artistid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," + "{ \"type\": \"object\", \"properties\": { \"albumid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," + "{ \"type\": \"object\", \"properties\": { \"songid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," + "{ \"type\": \"object\", \"properties\": { \"genreid\": { \"$ref\": \"Library.Id\", \"required\": true, \"description\": \"Identification of a genre from the AudioLibrary\" } }, \"additionalProperties\": false }" + "]" "}", - "\"Player.SeekTime\": {" + "\"Player.Id\": {" "\"type\": \"integer\"," - "\"minimum\": 0" + "\"minimum\": 0," + "\"maximum\": 2," + "\"default\": -1" "}", - "\"Player.SeekPercentage\": {" + "\"Player.Type\": {" + "\"type\": \"string\"," + "\"enum\": [ \"video\", \"audio\", \"picture\" ]" + "}", + "\"Player.Position.Percentage\": {" "\"type\": \"number\"," "\"minimum\": 0.0," "\"maximum\": 100.0" "}", + "\"Player.Speed\": {" + "\"type\": \"object\"," + "\"required\": true," + "\"properties\": {" + "\"speed\": { \"type\": \"integer\" }" + "}" + "}", + "\"Player.Repeat\": {" + "\"type\": \"string\"," + "\"enum\": [ \"off\", \"one\", \"all\" ]" + "}", + "\"Player.Property.Name\": {" + "\"type\": \"string\"," + "\"enum\": [ \"type\", \"partymode\", \"speed\", \"time\", \"percentage\"," + "\"totaltime\", \"playlistid\", \"position\", \"repeat\", \"shuffled\"," + "\"canseek\", \"canchangespeed\", \"canmove\", \"canzoom\", \"canrotate\"," + "\"canshuffle\", \"canrepeat\" ]" + "}", + "\"Player.Property.Value\": {" + "\"type\": \"object\"," + "\"properties\": {" + "\"type\": { \"$ref\": \"Player.Type\" }," + "\"partymode\": { \"type\": \"boolean\" }," + "\"speed\": { \"type\": \"integer\" }," + "\"time\": { \"$ref\": \"Global.Time\" }," + "\"percentage\": { \"$ref\": \"Player.Position.Percentage\" }," + "\"totaltime\": { \"$ref\": \"Global.Time\" }," + "\"playlistid\": { \"$ref\": \"Playlist.Id\" }," + "\"position\": { \"$ref\": \"Playlist.Position\" }," + "\"repeat\": { \"$ref\": \"Player.Repeat\" }," + "\"shuffled\": { \"type\": \"boolean\" }," + "\"canseek\": { \"type\": \"boolean\" }," + "\"canchangespeed\": { \"type\": \"boolean\" }," + "\"canmove\": { \"type\": \"boolean\" }," + "\"canzoom\": { \"type\": \"boolean\" }," + "\"canrotate\": { \"type\": \"boolean\" }," + "\"canshuffle\": { \"type\": \"boolean\" }," + "\"canrepeat\": { \"type\": \"boolean\" }" + "}" + "}", + "\"Player.Notifications.Item.Type\": {" + "\"type\": \"string\"," + "\"enum\": [ \"unknown\", \"movie\", \"episode\", \"musicvideo\", \"song\" ]" + "}", + "\"Player.Notifications.Item\": {" + "\"type\": [" + "{ \"type\": \"object\", \"description\": \"An unknown item does not have any additional information.\"," + "\"properties\": {" + "\"type\": { \"$ref\": \"Player.Notifications.Item.Type\", \"required\": true }" + "}" + "}," + "{ \"type\": \"object\", \"description\": \"An item known to the database has an identification.\"," + "\"properties\": {" + "\"type\": { \"$ref\": \"Player.Notifications.Item.Type\", \"required\": true }," + "\"id\": { \"$ref\": \"Library.Id\", \"required\": true }" + "}" + "}," + "{ \"type\": \"object\", \"description\": \"A movie item has a title and may have a release year.\"," + "\"properties\": {" + "\"type\": { \"$ref\": \"Player.Notifications.Item.Type\", \"required\": true }," + "\"title\": { \"type\": \"string\", \"required\": true }," + "\"year\": { \"type\": \"integer\" }" + "}" + "}," + "{ \"type\": \"object\", \"description\": \"A tv episode has a title and may have an episode number, season number and the title of the show it belongs to.\"," + "\"properties\": {" + "\"type\": { \"$ref\": \"Player.Notifications.Item.Type\", \"required\": true }," + "\"title\": { \"type\": \"string\", \"required\": true }," + "\"episode\": { \"type\": \"integer\" }," + "\"season\": { \"type\": \"integer\" }," + "\"showtitle\": { \"type\": \"string\" }" + "}" + "}," + "{ \"type\": \"object\", \"description\": \"A music video has a title and may have an album and an artist.\"," + "\"properties\": {" + "\"type\": { \"$ref\": \"Player.Notifications.Item.Type\", \"required\": true }," + "\"title\": { \"type\": \"string\", \"required\": true }," + "\"album\": { \"type\": \"string\" }," + "\"artist\": { \"type\": \"string\" }" + "}" + "}," + "{ \"type\": \"object\", \"description\": \"A song has a title and may have an album, an artist and a track number.\"," + "\"properties\": {" + "\"type\": { \"$ref\": \"Player.Notifications.Item.Type\", \"required\": true }," + "\"title\": { \"type\": \"string\", \"required\": true }," + "\"album\": { \"type\": \"string\" }," + "\"artist\": { \"type\": \"string\" }," + "\"track\": { \"type\": \"integer\" }" + "}" + "}" + "]" + "}", + "\"Player.Notifications.Player\": {" + "\"type\": \"object\"," + "\"properties\": {" + "\"playerid\": { \"$ref\": \"Player.Id\", \"required\": true }," + "\"speed\": { \"type\": \"integer\" }" + "}" + "}", + "\"Player.Notifications.Player.Seek\": {" + "\"extends\": \"Player.Notifications.Player\"," + "\"properties\": {" + "\"time\": { \"$ref\": \"Global.Time\" }," + "\"seekoffset\": { \"$ref\": \"Global.Time\" }" + "}" + "}", + "\"Player.Notifications.Data\": {" + "\"type\": \"object\"," + "\"properties\": {" + "\"item\": { \"$ref\": \"Player.Notifications.Item\", \"required\": true }," + "\"player\": { \"$ref\": \"Player.Notifications.Player\", \"required\": true }" + "}" + "}", "\"Item.Fields.Base\": {" "\"type\": \"array\"," "\"uniqueItems\": true," @@ -114,11 +257,6 @@ namespace JSONRPC "\"thumbnail\": { \"type\": \"string\" }" "}" "}", - "\"Library.Id\": {" - "\"type\": \"integer\"," - "\"default\": -1," - "\"minimum\": 1" - "}", "\"Library.Fields.Genre\": {" "\"extends\": \"Item.Fields.Base\"," "\"items\": { \"type\": \"string\", \"enum\": [ \"title\", \"thumbnail\" ] }" @@ -464,51 +602,6 @@ namespace JSONRPC "\"track\": { \"type\": \"integer\" }" "}" "}", - "\"Playlist.Id\": {" - "\"type\": [" - "{ \"type\": \"object\", \"properties\": { \"id\": { \"type\": \"string\", \"minLength\": 1, \"description\": \"Identification of a virtual playlist\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"file\": { \"type\": \"string\", \"minLength\": 5, \"description\": \"File from which to load a playlist\", \"required\": true } }, \"additionalProperties\": false }" - "]" - "}", - "\"Playlist.Item.Position\": {" - "\"type\": \"integer\"," - "\"minimum\": 0," - "\"default\": -1" - "}", - "\"Playlist.Repeat\": {" - "\"type\": \"string\"," - "\"enum\": [ \"off\", \"one\", \"all\" ]" - "}", - "\"Playlist.State\": {" - "\"extends\": \"Player.State\"," - "\"properties\": {" - "\"current\": { \"type\": \"integer\", \"required\": true }," - "\"repeat\": { \"$ref\": \"Playlist.Repeat\", \"required\": true }," - "\"shuffled\": { \"type\": \"boolean\", \"required\": true }" - "}," - "\"additionalProperties\": false" - "}", - "\"Playlist.Video.Item\": {" - "\"type\": [" - "{ \"type\": \"object\", \"properties\": { \"file\": { \"type\": \"string\", \"description\": \"Path to a file (not a directory) to be added to the playlist\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"directory\": { \"type\": \"string\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"movieid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"episodeid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"musicvideoid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"playlist\": { \"$ref\": \"Playlist.Id\", \"required\": true } }, \"additionalProperties\": false }" - "]" - "}", - "\"Playlist.Audio.Item\": {" - "\"type\": [" - "{ \"type\": \"object\", \"properties\": { \"file\": { \"type\": \"string\", \"description\": \"Path to a file (not a directory) to be added to the playlist\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"directory\": { \"type\": \"string\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"artistid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"albumid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"songid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"genreid\": { \"$ref\": \"Library.Id\", \"required\": true } }, \"additionalProperties\": false }," - "{ \"type\": \"object\", \"properties\": { \"playlist\": { \"$ref\": \"Playlist.Id\", \"required\": true } }, \"additionalProperties\": false }" - "]" - "}", "\"Files.Media\": {" "\"type\": \"string\"," "\"enum\": [ \"video\", \"music\", \"pictures\", \"files\", \"programs\" ]" @@ -562,25 +655,13 @@ namespace JSONRPC "\"resume\", \"artistid\", \"albumid\", \"tvshowid\", \"setid\" ]" "}" "}", - "\"List.Fields.Video\": {" - "\"extends\": \"Item.Fields.Base\"," - "\"items\": { \"type\": \"string\"," - "\"enum\": [ \"title\", \"artist\", \"genre\", \"year\", \"rating\", \"album\", \"track\"," - "\"playcount\", \"fanart\", \"director\", \"trailer\", \"tagline\", \"plot\"," - "\"plotoutline\", \"originaltitle\", \"lastplayed\", \"writer\", \"studio\"," - "\"mpaa\", \"country\", \"imdbnumber\", \"premiered\", \"productioncode\"," - "\"runtime\", \"showlink\", \"streamdetails\", \"top250\", \"votes\"," - "\"firstaired\", \"season\", \"episode\", \"showtitle\", \"thumbnail\"," - "\"file\", \"sorttitle\", \"episodeguide\", \"resume\", \"tvshowid\", \"setid\" ]" - "}" - "}", "\"List.Items.All\": {" "\"type\": \"array\"," "\"items\": { " "\"extends\": [ \"Video.Details.File\", \"Audio.Details.Media\" ]," "\"properties\": {" "\"id\": { \"$ref\": \"Library.Id\" }," - "\"type\": { \"type\": \"string\", \"enum\": [ \"unknown\", \"movie\", \"episode\", \"musicvideo\", \"song\" ] }," + "\"type\": { \"type\": \"string\", \"enum\": [ \"unknown\", \"movie\", \"episode\", \"musicvideo\", \"song\", \"picture\" ] }," "\"albumartist\": { \"type\": \"string\" }," "\"album\": { \"type\": \"string\" }," "\"track\": { \"type\": \"integer\" }," @@ -616,67 +697,7 @@ namespace JSONRPC "}" "}" "}", - "\"List.Items.Video\": {" - "\"type\": \"array\"," - "\"items\": { " - "\"extends\": \"Video.Details.File\"," - "\"properties\": {" - "\"id\": { \"$ref\": \"Library.Id\" }," - "\"type\": { \"type\": \"string\", \"enum\": [ \"unknown\", \"movie\", \"episode\", \"musicvideo\" ] }," - "\"artist\": { \"type\": \"string\" }," - "\"genre\": { \"type\": \"string\" }," - "\"year\": { \"type\": \"integer\" }," - "\"rating\": { \"type\": \"number\" }," - "\"album\": { \"type\": \"string\" }," - "\"track\": { \"type\": \"integer\" }," - "\"trailer\": { \"type\": \"string\" }," - "\"tagline\": { \"type\": \"string\" }," - "\"plotoutline\": { \"type\": \"string\" }," - "\"originaltitle\": { \"type\": \"string\" }," - "\"sorttitle\": { \"type\": \"string\" }," - "\"writer\": { \"type\": \"string\" }," - "\"studio\": { \"type\": \"string\" }," - "\"mpaa\": { \"type\": \"string\" }," - "\"country\": { \"type\": \"string\" }," - "\"imdbnumber\": { \"type\": \"string\" }," - "\"premiered\": { \"type\": \"string\" }," - "\"productioncode\": { \"type\": \"string\" }," - "\"showlink\": { \"type\": \"string\" }," - "\"top250\": { \"type\": \"integer\" }," - "\"votes\": { \"type\": \"string\" }," - "\"firstaired\": { \"type\": \"string\" }," - "\"season\": { \"type\": \"integer\" }," - "\"episode\": { \"type\": \"integer\" }," - "\"episodeguide\": { \"type\": \"string\" }," - "\"showtitle\": { \"type\": \"string\" }," - "\"setid\": { \"type\": \"string\", \"description\": \"Comma-separated list of sets\" }," - "\"tvshowid\": { \"$ref\": \"Library.Id\" }" - "}" - "}" - "}", - "\"List.Items.Audio\": {" - "\"type\": \"array\"," - "\"items\": { " - "\"extends\": \"Audio.Details.Media\"," - "\"properties\": {" - "\"id\": { \"$ref\": \"Library.Id\" }," - "\"type\": { \"type\": \"string\", \"enum\": [ \"unknown\", \"song\" ] }," - "\"file\": { \"type\": \"string\" }," - "\"albumartist\": { \"type\": \"string\" }," - "\"album\": { \"type\": \"string\" }," - "\"track\": { \"type\": \"integer\" }," - "\"duration\": { \"type\": \"integer\" }," - "\"comment\": { \"type\": \"string\" }," - "\"lyrics\": { \"type\": \"string\" }," - "\"playcount\": { \"type\": \"integer\" }," - "\"musicbrainztrackid\": { \"type\": \"string\" }," - "\"musicbrainzalbumid\": { \"type\": \"string\" }," - "\"artistid\": { \"$ref\": \"Library.Id\" }," - "\"albumid\": { \"$ref\": \"Library.Id\" }" - "}" - "}" - "}", - "\"List.Items.Shares\": {" + "\"List.Items.Sources\": {" "\"type\": \"array\"," "\"items\": {" "\"extends\": \"Item.Details.Base\"," @@ -743,800 +764,438 @@ namespace JSONRPC "}", "\"JSONRPC.Version\": {" "\"type\": \"method\"," - "\"description\": \"Retrieve the jsonrpc protocol version\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"JSONRPC.Permission\": {" - "\"type\": \"method\"," - "\"description\": \"Retrieve the clients permissions\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": []," - "\"returns\": {" - "\"type\": \"object\"," - "\"properties\": {" - "\"ReadData\": { \"type\": \"boolean\", \"required\": true }," - "\"ControlPlayback\": { \"type\": \"boolean\", \"required\": true }," - "\"ControlNotify\": { \"type\": \"boolean\", \"required\": true }," - "\"ControlPower\": { \"type\": \"boolean\", \"required\": true }," - "\"UpdateData\": { \"type\": \"boolean\", \"required\": true }," - "\"RemoveData\": { \"type\": \"boolean\", \"required\": true }," - "\"WriteFile\": { \"type\": \"boolean\", \"required\": true }" - "}" - "}" - "}", - "\"JSONRPC.Ping\": {" - "\"type\": \"method\"," - "\"description\": \"Ping responder\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"JSONRPC.GetConfiguration\": {" - "\"type\": \"method\"," - "\"description\": \"Get client-specific configurations\"," - "\"transport\": \"Announcing\"," - "\"permission\": \"ReadData\"," - "\"params\": []," - "\"returns\": { \"$ref\": \"Configuration\" }" - "}", - "\"JSONRPC.SetConfiguration\": {" - "\"type\": \"method\"," - "\"description\": \"Change the client-specific configuration\"," - "\"transport\": \"Announcing\"," - "\"permission\": \"ControlNotify\"," - "\"params\": [" - "{ \"name\": \"notifications\", \"type\": \"object\"," - "\"properties\": {" - "\"Player\": { \"$ref\": \"Optional.Boolean\" }," - "\"GUI\": { \"$ref\": \"Optional.Boolean\" }," - "\"System\": { \"$ref\": \"Optional.Boolean\" }," - "\"AudioLibrary\": { \"$ref\": \"Optional.Boolean\" }," - "\"VideoLibrary\": { \"$ref\": \"Optional.Boolean\" }," - "\"Other\": { \"$ref\": \"Optional.Boolean\" }" - "}" - "}" - "]," - "\"returns\": { \"$ref\": \"Configuration\" }" - "}", - "\"JSONRPC.NotifyAll\": {" - "\"type\": \"method\"," - "\"description\": \"Notify all other connected clients\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": [" - "{ \"name\": \"sender\", \"type\": \"string\", \"required\": true }," - "{ \"name\": \"message\", \"type\": \"string\", \"required\": true }," - "{ \"name\": \"data\", \"type\": \"any\", \"default\": null }" - "]," - "\"returns\": \"any\"" - "}", - "\"Player.GetActivePlayers\": {" - "\"type\": \"method\"," - "\"description\": \"Returns all active players\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": []," - "\"returns\": {" - "\"type\": \"object\"," - "\"properties\": {" - "\"video\": { \"type\": \"boolean\", \"required\": true }," - "\"audio\": { \"type\": \"boolean\", \"required\": true }," - "\"picture\": { \"type\": \"boolean\", \"required\": true }" - "}" - "}" - "}", - "\"AudioPlayer.State\": {" - "\"type\": \"method\"," - "\"description\": \"Returns playback state of the audio player (if it is active)\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": []," - "\"returns\": { \"$ref\": \"Player.State.Extended\" }" - "}", - "\"AudioPlayer.PlayPause\": {" - "\"type\": \"method\"," - "\"description\": \"Pauses or unpause playback and returns the new state\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": { \"$ref\": \"Player.State\" }" - "}", - "\"AudioPlayer.Stop\": {" - "\"type\": \"method\"," - "\"description\": \"Stops playback\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"AudioPlayer.SkipPrevious\": {" - "\"type\": \"method\"," - "\"description\": \"Skips to previous item on the playlist\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"AudioPlayer.SkipNext\": {" - "\"type\": \"method\"," - "\"description\": \"Skips to next item on the playlist\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"AudioPlayer.BigSkipBackward\": {" - "\"type\": \"method\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"AudioPlayer.BigSkipForward\": {" - "\"type\": \"method\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"AudioPlayer.SmallSkipBackward\": {" - "\"type\": \"method\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"AudioPlayer.SmallSkipForward\": {" - "\"type\": \"method\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"AudioPlayer.Rewind\": {" - "\"type\": \"method\"," - "\"description\": \"Rewind current playback\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"AudioPlayer.Forward\": {" - "\"type\": \"method\"," - "\"description\": \"Forward current playback\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"AudioPlayer.GetTime\": {" - "\"type\": \"method\"," - "\"description\": \"Retrieves the current and total time of the currently playing file\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": []," - "\"returns\": { \"$ref\": \"Player.TimeValues\" }" - "}", - "\"AudioPlayer.GetPercentage\": {" - "\"type\": \"method\"," - "\"description\": \"Retrieve current playback progress in percentage\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": []," - "\"returns\": \"number\"" - "}", - "\"AudioPlayer.SeekTime\": {" - "\"type\": \"method\"," - "\"description\": \"Seek to a specific time\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [" - "{ \"name\": \"value\", \"$ref\": \"Player.SeekTime\", \"required\": true, \"description\": \"Time to seek to in seconds\" }" - "]," - "\"returns\": \"string\"" - "}", - "\"AudioPlayer.SeekPercentage\": {" - "\"type\": \"method\"," - "\"description\": \"Seek to a specific percentage\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [" - "{ \"name\": \"value\", \"$ref\": \"Player.SeekPercentage\", \"required\": true, \"description\": \"Percentage value to seek to\" }" - "]," - "\"returns\": \"string\"" - "}", - "\"VideoPlayer.State\": {" - "\"type\": \"method\"," - "\"description\": \"Returns playback state of the video player (if it is active)\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": []," - "\"returns\": { \"$ref\": \"Player.State.Extended\" }" - "}", - "\"VideoPlayer.PlayPause\": {" - "\"type\": \"method\"," - "\"description\": \"Pauses or unpause playback and returns the new state\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": { \"$ref\": \"Player.State\" }" - "}", - "\"VideoPlayer.Stop\": {" - "\"type\": \"method\"," - "\"description\": \"Stops playback\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"VideoPlayer.SkipPrevious\": {" - "\"type\": \"method\"," - "\"description\": \"Skips to previous item on the playlist\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"VideoPlayer.SkipNext\": {" - "\"type\": \"method\"," - "\"description\": \"Skips to next item on the playlist\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"VideoPlayer.BigSkipBackward\": {" - "\"type\": \"method\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"VideoPlayer.BigSkipForward\": {" - "\"type\": \"method\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"VideoPlayer.SmallSkipBackward\": {" - "\"type\": \"method\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"VideoPlayer.SmallSkipForward\": {" - "\"type\": \"method\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"VideoPlayer.Rewind\": {" - "\"type\": \"method\"," - "\"description\": \"Rewind current playback\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"VideoPlayer.Forward\": {" - "\"type\": \"method\"," - "\"description\": \"Forward current playback\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"VideoPlayer.GetTime\": {" - "\"type\": \"method\"," - "\"description\": \"Retrieves the current and total time of the currently playing file\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": []," - "\"returns\": { \"$ref\": \"Player.TimeValues\" }" - "}", - "\"VideoPlayer.GetPercentage\": {" - "\"type\": \"method\"," - "\"description\": \"Retrieve current playback progress in percentage\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": []," - "\"returns\": \"number\"" - "}", - "\"VideoPlayer.SeekTime\": {" - "\"type\": \"method\"," - "\"description\": \"Seek to a specific time\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [" - "{ \"name\": \"value\", \"$ref\": \"Player.SeekTime\", \"required\": true }" - "]," - "\"returns\": \"string\"" - "}", - "\"VideoPlayer.SeekPercentage\": {" - "\"type\": \"method\"," - "\"description\": \"Seek to a specific percentage\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [" - "{ \"name\": \"value\", \"$ref\": \"Player.SeekPercentage\", \"required\": true }" - "]," - "\"returns\": \"string\"" - "}", - "\"PicturePlayer.PlayPause\": {" - "\"type\": \"method\"," - "\"description\": \"Pauses or unpause slideshow\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"PicturePlayer.Stop\": {" - "\"type\": \"method\"," - "\"description\": \"Stops slideshow\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"PicturePlayer.SkipPrevious\": {" - "\"type\": \"method\"," - "\"description\": \"Skips to previous picture in the slideshow\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"PicturePlayer.SkipNext\": {" - "\"type\": \"method\"," - "\"description\": \"Skips to next picture in the slideshow\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"PicturePlayer.MoveLeft\": {" - "\"type\": \"method\"," - "\"description\": \"If picture is zoomed move viewport left otherwise skip previous\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"PicturePlayer.MoveRight\": {" - "\"type\": \"method\"," - "\"description\": \"If picture is zoomed move viewport right otherwise skip next\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": []," - "\"returns\": \"string\"" - "}", - "\"PicturePlayer.MoveDown\": {" - "\"type\": \"method\"," - "\"description\": \"If picture is zoomed move viewport down\"," + "\"description\": \"Retrieve the jsonrpc protocol version\"," "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," + "\"permission\": \"ReadData\"," "\"params\": []," "\"returns\": \"string\"" "}", - "\"PicturePlayer.MoveUp\": {" + "\"JSONRPC.Permission\": {" "\"type\": \"method\"," - "\"description\": \"If picture is zoomed move viewport up\"," + "\"description\": \"Retrieve the clients permissions\"," "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," + "\"permission\": \"ReadData\"," "\"params\": []," - "\"returns\": \"string\"" + "\"returns\": {" + "\"type\": \"object\"," + "\"properties\": {" + "\"ReadData\": { \"type\": \"boolean\", \"required\": true }," + "\"ControlPlayback\": { \"type\": \"boolean\", \"required\": true }," + "\"ControlNotify\": { \"type\": \"boolean\", \"required\": true }," + "\"ControlPower\": { \"type\": \"boolean\", \"required\": true }," + "\"UpdateData\": { \"type\": \"boolean\", \"required\": true }," + "\"RemoveData\": { \"type\": \"boolean\", \"required\": true }," + "\"WriteFile\": { \"type\": \"boolean\", \"required\": true }" + "}" + "}" "}", - "\"PicturePlayer.ZoomOut\": {" + "\"JSONRPC.Ping\": {" "\"type\": \"method\"," - "\"description\": \"Zoom out once\"," + "\"description\": \"Ping responder\"," "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," + "\"permission\": \"ReadData\"," "\"params\": []," "\"returns\": \"string\"" "}", - "\"PicturePlayer.ZoomIn\": {" + "\"JSONRPC.GetConfiguration\": {" "\"type\": \"method\"," - "\"description\": \"Zoom in once\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," + "\"description\": \"Get client-specific configurations\"," + "\"transport\": \"Announcing\"," + "\"permission\": \"ReadData\"," "\"params\": []," - "\"returns\": \"string\"" + "\"returns\": { \"$ref\": \"Configuration\" }" "}", - "\"PicturePlayer.Zoom\": {" + "\"JSONRPC.SetConfiguration\": {" "\"type\": \"method\"," - "\"description\": \"Zooms current picture\"," + "\"description\": \"Change the client-specific configuration\"," + "\"transport\": \"Announcing\"," + "\"permission\": \"ControlNotify\"," + "\"params\": [" + "{ \"name\": \"notifications\", \"type\": \"object\"," + "\"properties\": {" + "\"Player\": { \"$ref\": \"Optional.Boolean\" }," + "\"GUI\": { \"$ref\": \"Optional.Boolean\" }," + "\"System\": { \"$ref\": \"Optional.Boolean\" }," + "\"AudioLibrary\": { \"$ref\": \"Optional.Boolean\" }," + "\"VideoLibrary\": { \"$ref\": \"Optional.Boolean\" }," + "\"Other\": { \"$ref\": \"Optional.Boolean\" }" + "}" + "}" + "]," + "\"returns\": { \"$ref\": \"Configuration\" }" + "}", + "\"JSONRPC.NotifyAll\": {" + "\"type\": \"method\"," + "\"description\": \"Notify all other connected clients\"," "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," + "\"permission\": \"ReadData\"," "\"params\": [" - "{ \"name\": \"value\", \"type\": \"integer\", \"required\": true, \"minimum\": 1, \"maximum\": 10, \"description\": \"Zoom level\" }" + "{ \"name\": \"sender\", \"type\": \"string\", \"required\": true }," + "{ \"name\": \"message\", \"type\": \"string\", \"required\": true }," + "{ \"name\": \"data\", \"type\": \"any\", \"default\": null }" "]," - "\"returns\": \"string\"" + "\"returns\": \"any\"" "}", - "\"PicturePlayer.Rotate\": {" + "\"Player.Open\": {" "\"type\": \"method\"," - "\"description\": \"Rotates current picture\"," + "\"description\": \"Start playback of either the playlist with the given ID, a slideshow with the pictures from the given directory or a single file or an item from the database.\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," - "\"params\": []," + "\"params\": [" + "{ \"name\": \"item\", " + "\"type\": [" + "{ \"type\": \"object\", \"required\": true, \"additionalProperties\": false," + "\"properties\": {" + "\"playlistid\": { \"$ref\": \"Playlist.Id\", \"required\": true }," + "\"position\": { \"$ref\": \"Playlist.Position\", \"default\": 0 }" + "}" + "}," + "{ \"$ref\": \"Playlist.Item\", \"required\": true }," + "{ \"type\": \"object\", \"required\": true, \"additionalProperties\": false," + "\"properties\": {" + "\"path\": { \"type\": \"string\", \"required\": true }," + "\"random\": { \"type\": \"boolean\", \"default\": true }," + "\"recursive\": { \"type\": \"boolean\", \"default\": true }" + "}" + "}" + "]" + "}" + "]," "\"returns\": \"string\"" "}", - "\"Playlist.Create\": {" + "\"Player.GetActivePlayers\": {" "\"type\": \"method\"," - "\"description\": \"Creates a virtual playlist from a given one from a file\"," + "\"description\": \"Returns all active players\"," "\"transport\": \"Response\"," "\"permission\": \"ReadData\"," - "\"params\": [" - "{ \"name\": \"playlist\", \"$ref\": \"Playlist.Id\", \"required\": true }" - "]," - "\"returns\": { \"type\": \"object\"," - "\"properties\": {" - "\"playlistid\": { \"type\": \"string\", \"required\": true }" + "\"params\": []," + "\"returns\": {" + "\"type\": \"array\"," + "\"uniqueItems\": true," + "\"items\": { " + "\"type\": \"object\"," + "\"properties\": {" + "\"playerid\": { \"$ref\": \"Player.Id\", \"required\": true }," + "\"type\": { \"$ref\": \"Player.Type\", \"required\": true }" + "}" "}" "}" "}", - "\"Playlist.Destroy\": {" + "\"Player.GetProperties\": {" "\"type\": \"method\"," - "\"description\": \"Destroys a virtual playlist\"," + "\"description\": \"Retrieves the values of the given properties\"," "\"transport\": \"Response\"," "\"permission\": \"ReadData\"," "\"params\": [" - "{ \"name\": \"playlistid\", \"type\": \"string\", \"required\": true, \"description\": \"Identification of the playlist\" }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }," + "{ \"name\": \"properties\", \"type\": \"array\", \"uniqueItems\": true, \"required\": true, \"items\": { \"$ref\": \"Player.Property.Name\" } }" "]," - "\"returns\": \"string\"" + "\"returns\": { \"$ref\": \"Player.Property.Value\", \"required\": true }" "}", - "\"Playlist.GetItems\": {" + "\"Player.PlayPause\": {" "\"type\": \"method\"," - "\"description\": \"Retrieve items in the playlist\"," + "\"description\": \"Pauses or unpause playback and returns the new state\"," "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," + "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"playlist\", \"$ref\": \"Playlist.Id\", \"required\": true }," - "{ \"name\": \"fields\", \"$ref\": \"List.Fields.All\" }," - "{ \"name\": \"limits\", \"$ref\": \"List.Limits\" }," - "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" "]," - "\"returns\": { \"type\": \"object\"," - "\"properties\": {" - "\"name\": { \"type\": \"string\", \"description\": \"Name of the playlist (if available)\" }," - "\"limits\": { \"$ref\": \"List.LimitsReturned\", \"required\": true }," - "\"items\": { \"$ref\": \"List.Items.All\", \"required\": true }" - "}" - "}" + "\"returns\": { \"$ref\": \"Player.Speed\" }" "}", - "\"Playlist.Add\": {" + "\"Player.Stop\": {" "\"type\": \"method\"," - "\"description\": \"Add items to the playlist\"," + "\"description\": \"Stops playback\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"playlist\", \"$ref\": \"Playlist.Id\", \"required\": true }," - "{ \"name\": \"items\", \"$ref\": \"Playlist.Id\", \"required\": true, \"description\": \"Adds items from given virtual and/or file based playlist\" }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"Playlist.Remove\": {" + "\"Player.SetSpeed\": {" "\"type\": \"method\"," - "\"description\": \"Remove item from the playlist\"," + "\"description\": \"Set the speed of the current playback\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"playlist\", \"$ref\": \"Playlist.Id\", \"required\": true }," - "{ \"name\": \"item\", \"type\": [ \"integer\", \"string\" ], \"required\": true }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }," + "{ \"name\": \"speed\", \"type\": [ \"integer\", \"string\" ], \"enum\": [ -16, -8, -4, -2, -1, 0, 1, 2, 4, 8, 16, \"increment\", \"decrement\" ], \"required\": true }" "]," - "\"returns\": \"string\"" + "\"returns\": { \"$ref\": \"Player.Speed\" }" "}", - "\"Playlist.Swap\": {" + "\"Player.Seek\": {" "\"type\": \"method\"," - "\"description\": \"Swap items in the playlist\"," + "\"description\": \"Seek through the playing item\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"playlist\", \"$ref\": \"Playlist.Id\", \"required\": true }," - "{ \"name\": \"item1\", \"$ref\": \"Playlist.Item.Position\", \"required\": true }," - "{ \"name\": \"item2\", \"$ref\": \"Playlist.Item.Position\", \"required\": true }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }," + "{ \"name\": \"value\", \"required\": true, \"type\": [" + "{ \"$ref\": \"Player.Position.Percentage\", \"required\": true, \"description\": \"Percentage value to seek to\" }," + "{ \"type\": \"object\", \"additionalProperties\": false, \"required\": true, \"description\": \"Time to seek to\"," + "\"properties\": {" + "\"hours\": { \"type\": \"integer\", \"minimum\": 0, \"maximum\": 23 }," + "\"minutes\": { \"type\": \"integer\", \"minimum\": 0, \"maximum\": 59 }," + "\"seconds\": { \"type\": \"integer\", \"minimum\": 0, \"maximum\": 59 }," + "\"milliseconds\": { \"type\": \"integer\", \"minimum\": 0, \"maximum\": 999 }" + "}" + "}," + "{ \"type\": \"string\", \"enum\": [ \"smallforward\", \"smallbackward\", \"bigforward\", \"bigbackward\" ], \"required\": true, \"description\": \"Seek by predefined jumps\" }" + "]" + "}" "]," - "\"returns\": \"string\"" + "\"returns\": {" + "\"type\": \"object\"," + "\"properties\": {" + "\"percentage\": { \"$ref\": \"Player.Position.Percentage\" }," + "\"time\": { \"$ref\": \"Global.Time\" }," + "\"totaltime\": { \"$ref\": \"Global.Time\" }" + "}" + "}" "}", - "\"Playlist.Clear\": {" + "\"Player.MoveLeft\": {" "\"type\": \"method\"," - "\"description\": \"Clear playlist\"," + "\"description\": \"If picture is zoomed move viewport left otherwise skip previous\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"playlist\", \"$ref\": \"Playlist.Id\", \"required\": true }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"Playlist.Shuffle\": {" + "\"Player.MoveRight\": {" "\"type\": \"method\"," - "\"description\": \"Shuffle playlist\"," + "\"description\": \"If picture is zoomed move viewport right otherwise skip next\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"playlist\", \"$ref\": \"Playlist.Id\", \"required\": true }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"Playlist.UnShuffle\": {" + "\"Player.MoveDown\": {" "\"type\": \"method\"," - "\"description\": \"Unshuffle playlist\"," + "\"description\": \"If picture is zoomed move viewport down\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"playlist\", \"$ref\": \"Playlist.Id\", \"required\": true }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"VideoPlaylist.State\": {" - "\"type\": \"method\"," - "\"description\": \"Provides information about the current state of the playlist\"," - "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," - "\"params\": [ ]," - "\"returns\": { \"$ref\": \"Playlist.State\", \"required\": true }" - "}", - "\"VideoPlaylist.Play\": {" + "\"Player.MoveUp\": {" "\"type\": \"method\"," - "\"description\": \"Play current or a specific item\"," + "\"description\": \"If picture is zoomed move viewport up\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"item\", \"$ref\": \"Playlist.Item.Position\", \"description\": \"Position of the item\" }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" "]," - "\"returns\": { \"type\": \"object\"," - "\"properties\": {" - "\"success\": { \"type\": \"boolean\", \"required\": true }" - "}" - "}" - "}", - "\"VideoPlaylist.SkipPrevious\": {" - "\"type\": \"method\"," - "\"description\": \"Skip current item and play previous item\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [ ]," "\"returns\": \"string\"" "}", - "\"VideoPlaylist.SkipNext\": {" + "\"Player.ZoomOut\": {" "\"type\": \"method\"," - "\"description\": \"Skip current item and play next item\"," + "\"description\": \"Zoom out once\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," - "\"params\": [ ]," + "\"params\": [" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" + "]," "\"returns\": \"string\"" "}", - "\"VideoPlaylist.GetItems\": {" + "\"Player.ZoomIn\": {" "\"type\": \"method\"," - "\"description\": \"Get all items from playlist\"," + "\"description\": \"Zoom in once\"," "\"transport\": \"Response\"," - "\"permission\": \"ReadData\"," + "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"fields\", \"$ref\": \"List.Fields.Video\" }," - "{ \"name\": \"limits\", \"$ref\": \"List.Limits\" }," - "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" "]," - "\"returns\": { \"type\": \"object\"," - "\"properties\": {" - "\"state\": { \"$ref\": \"Playlist.State\" }," - "\"limits\": { \"$ref\": \"List.LimitsReturned\", \"required\": true }," - "\"items\": { \"$ref\": \"List.Items.Video\", \"required\": true }" - "}" - "}" + "\"returns\": \"string\"" "}", - "\"VideoPlaylist.Add\": {" + "\"Player.Zoom\": {" "\"type\": \"method\"," - "\"description\": \"Add item(s) to playlist\"," + "\"description\": \"Zooms current picture\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"item\", \"$ref\": \"Playlist.Video.Item\", \"required\": true }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }," + "{ \"name\": \"value\", \"type\": \"integer\", \"required\": true, \"minimum\": 1, \"maximum\": 10, \"description\": \"Zoom level\" }" "]," "\"returns\": \"string\"" "}", - "\"VideoPlaylist.Insert\": {" + "\"Player.Rotate\": {" "\"type\": \"method\"," - "\"description\": \"Insert item(s) into playlist\"," + "\"description\": \"Rotates current picture\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"index\", \"$ref\": \"Playlist.Item.Position\", \"required\": true }," - "{ \"name\": \"item\", \"$ref\": \"Playlist.Video.Item\", \"required\": true }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"VideoPlaylist.Remove\": {" + "\"Player.GoPrevious\": {" "\"type\": \"method\"," - "\"description\": \"Remove item from playlist\"," + "\"description\": \"Go to previous item on the playlist\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"item\", \"$ref\": \"Playlist.Item.Position\", \"required\": true }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"VideoPlaylist.Clear\": {" + "\"Player.GoNext\": {" "\"type\": \"method\"," - "\"description\": \"Clear playlist\"," + "\"description\": \"Go to next item on the playlist\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," - "\"params\": [ ]," + "\"params\": [" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" + "]," "\"returns\": \"string\"" "}", - "\"VideoPlaylist.Shuffle\": {" + "\"Player.GoTo\": {" "\"type\": \"method\"," - "\"description\": \"Shuffle playlist\"," + "\"description\": \"Go to item at the given position in the playlist\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," - "\"params\": [ ]," + "\"params\": [" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }," + "{ \"name\": \"position\", \"$ref\": \"Playlist.Position\", \"required\": true }" + "]," "\"returns\": \"string\"" "}", - "\"VideoPlaylist.UnShuffle\": {" + "\"Player.Shuffle\": {" "\"type\": \"method\"," - "\"description\": \"Unshuffle playlist\"," + "\"description\": \"Shuffle items in the player\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," - "\"params\": [ ]," + "\"params\": [" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" + "]," "\"returns\": \"string\"" "}", - "\"VideoPlaylist.Repeat\": {" + "\"Player.UnShuffle\": {" "\"type\": \"method\"," - "\"description\": \"Set the repeat mode of the playlist\"," + "\"description\": \"Unshuffle items in the player\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"state\", \"$ref\": \"Playlist.Repeat\", \"required\": true }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"VideoPlaylist.Swap\": {" + "\"Player.Repeat\": {" "\"type\": \"method\"," - "\"description\": \"Swap items in the playlist\"," + "\"description\": \"Set the repeat mode of the player\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"item1\", \"$ref\": \"Playlist.Item.Position\", \"required\": true }," - "{ \"name\": \"item2\", \"$ref\": \"Playlist.Item.Position\", \"required\": true }" + "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }," + "{ \"name\": \"state\", \"$ref\": \"Player.Repeat\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"AudioPlaylist.State\": {" + "\"Playlist.GetPlaylists\": {" "\"type\": \"method\"," - "\"description\": \"Provides information about the current state of the playlist\"," + "\"description\": \"Returns all existing playlists\"," "\"transport\": \"Response\"," "\"permission\": \"ReadData\"," - "\"params\": [ ]," - "\"returns\": { \"$ref\": \"Playlist.State\", \"required\": true }" - "}", - "\"AudioPlaylist.Play\": {" - "\"type\": \"method\"," - "\"description\": \"Play current or a specific item\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [" - "{ \"name\": \"item\", \"$ref\": \"Playlist.Item.Position\" }," - "{ \"name\": \"songid\", \"$ref\": \"Library.Id\", \"description\": \"Identification of a song from the audio library\" }" - "]," - "\"returns\": { \"type\": \"object\"," - "\"properties\": {" - "\"success\": { \"type\": \"boolean\", \"required\": true }" + "\"params\": []," + "\"returns\": {" + "\"type\": \"array\"," + "\"uniqueItems\": true," + "\"items\": { " + "\"type\": \"object\"," + "\"properties\": {" + "\"playlistid\": { \"$ref\": \"Playlist.Id\", \"required\": true }," + "\"type\": { \"$ref\": \"Playlist.Type\", \"required\": true }" + "}" "}" "}" "}", - "\"AudioPlaylist.SkipPrevious\": {" - "\"type\": \"method\"," - "\"description\": \"Skip current item and play previous item\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [ ]," - "\"returns\": \"string\"" - "}", - "\"AudioPlaylist.SkipNext\": {" + "\"Playlist.GetProperties\": {" "\"type\": \"method\"," - "\"description\": \"Skip current item and play next item\"," + "\"description\": \"Retrieves the values of the given properties\"," "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [ ]," - "\"returns\": \"string\"" + "\"permission\": \"ReadData\"," + "\"params\": [" + "{ \"name\": \"playlistid\", \"$ref\": \"Playlist.Id\", \"required\": true }," + "{ \"name\": \"properties\", \"type\": \"array\", \"uniqueItems\": true, \"required\": true, \"items\": { \"$ref\": \"Playlist.Property.Name\" } }" + "]," + "\"returns\": { \"$ref\": \"Playlist.Property.Value\", \"required\": true }" "}", - "\"AudioPlaylist.GetItems\": {" + "\"Playlist.GetItems\": {" "\"type\": \"method\"," "\"description\": \"Get all items from playlist\"," "\"transport\": \"Response\"," "\"permission\": \"ReadData\"," "\"params\": [" - "{ \"name\": \"fields\", \"$ref\": \"Audio.Fields.Song\" }," + "{ \"name\": \"playlistid\", \"$ref\": \"Playlist.Id\", \"required\": true }," + "{ \"name\": \"fields\", \"$ref\": \"List.Fields.All\" }," "{ \"name\": \"limits\", \"$ref\": \"List.Limits\" }," "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }" "]," "\"returns\": { \"type\": \"object\"," "\"properties\": {" - "\"state\": { \"$ref\": \"Playlist.State\" }," "\"limits\": { \"$ref\": \"List.LimitsReturned\", \"required\": true }," - "\"items\": { \"$ref\": \"List.Items.Audio\", \"required\": true }" + "\"items\": { \"$ref\": \"List.Items.All\", \"required\": true }" "}" "}" "}", - "\"AudioPlaylist.Add\": {" + "\"Playlist.Add\": {" "\"type\": \"method\"," "\"description\": \"Add item(s) to playlist\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"item\", \"$ref\": \"Playlist.Audio.Item\", \"required\": true }" + "{ \"name\": \"playlistid\", \"$ref\": \"Playlist.Id\", \"required\": true }," + "{ \"name\": \"item\", \"$ref\": \"Playlist.Item\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"AudioPlaylist.Insert\": {" + "\"Playlist.Insert\": {" "\"type\": \"method\"," - "\"description\": \"Insert item(s) into playlist\"," + "\"description\": \"Insert item(s) into playlist. Does not work for picture playlists (aka slideshows).\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"index\", \"$ref\": \"Playlist.Item.Position\", \"required\": true }," - "{ \"name\": \"item\", \"$ref\": \"Playlist.Audio.Item\", \"required\": true }" + "{ \"name\": \"playlistid\", \"$ref\": \"Playlist.Id\", \"required\": true }," + "{ \"name\": \"position\", \"$ref\": \"Playlist.Position\", \"required\": true }," + "{ \"name\": \"item\", \"$ref\": \"Playlist.Item\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"AudioPlaylist.Remove\": {" + "\"Playlist.Remove\": {" "\"type\": \"method\"," - "\"description\": \"Remove item from playlist\"," + "\"description\": \"Remove item from playlist. Does not work for picture playlists (aka slideshows).\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"item\", \"$ref\": \"Playlist.Item.Position\", \"required\": true }" + "{ \"name\": \"playlistid\", \"$ref\": \"Playlist.Id\", \"required\": true }," + "{ \"name\": \"position\", \"$ref\": \"Playlist.Position\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"AudioPlaylist.Clear\": {" + "\"Playlist.Clear\": {" "\"type\": \"method\"," "\"description\": \"Clear playlist\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," - "\"params\": [ ]," - "\"returns\": \"string\"" - "}", - "\"AudioPlaylist.Shuffle\": {" - "\"type\": \"method\"," - "\"description\": \"Shuffle playlist\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [ ]," - "\"returns\": \"string\"" - "}", - "\"AudioPlaylist.UnShuffle\": {" - "\"type\": \"method\"," - "\"description\": \"Unshuffle playlist\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [ ]," - "\"returns\": \"string\"" - "}", - "\"AudioPlaylist.Repeat\": {" - "\"type\": \"method\"," - "\"description\": \"Set the repeat mode of the playlist\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"state\", \"$ref\": \"Playlist.Repeat\", \"required\": true }" + "{ \"name\": \"playlistid\", \"$ref\": \"Playlist.Id\", \"required\": true }" "]," "\"returns\": \"string\"" "}", - "\"AudioPlaylist.Swap\": {" + "\"Playlist.Swap\": {" "\"type\": \"method\"," - "\"description\": \"Swap items in the playlist\"," + "\"description\": \"Swap items in the playlist. Does not work for picture playlists (aka slideshows).\"," "\"transport\": \"Response\"," "\"permission\": \"ControlPlayback\"," "\"params\": [" - "{ \"name\": \"item1\", \"$ref\": \"Playlist.Item.Position\", \"required\": true }," - "{ \"name\": \"item2\", \"$ref\": \"Playlist.Item.Position\", \"required\": true }" + "{ \"name\": \"playlistid\", \"$ref\": \"Playlist.Id\", \"required\": true }," + "{ \"name\": \"position1\", \"$ref\": \"Playlist.Position\", \"required\": true }," + "{ \"name\": \"position2\", \"$ref\": \"Playlist.Position\", \"required\": true }" "]," "\"returns\": \"string\"" "}", @@ -1554,7 +1213,7 @@ namespace JSONRPC "\"type\": \"object\"," "\"properties\": {" "\"limits\": { \"$ref\": \"List.LimitsReturned\", \"required\": true }," - "\"shares\": { \"$ref\": \"List.Items.Shares\", \"required\": true }" + "\"sources\": { \"$ref\": \"List.Items.Sources\", \"required\": true }" "}" "}" "}", @@ -2237,28 +1896,6 @@ namespace JSONRPC "\"params\": []," "\"returns\": \"string\"" "}", - "\"XBMC.Play\": {" - "\"type\": \"method\"," - "\"description\": \"Starts playback of the given file\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [" - "{ \"name\": \"file\", \"type\": \"string\", \"required\": true }" - "]," - "\"returns\": \"string\"" - "}", - "\"XBMC.StartSlideshow\": {" - "\"type\": \"method\"," - "\"description\": \"Starts slideshow with the images from the given directory\"," - "\"transport\": \"Response\"," - "\"permission\": \"ControlPlayback\"," - "\"params\": [" - "{ \"name\": \"directory\", \"type\": \"string\", \"required\": true }," - "{ \"name\": \"random\", \"type\": \"boolean\", \"default\": true }," - "{ \"name\": \"recursive\", \"type\": \"boolean\", \"default\": true }" - "]," - "\"returns\": \"string\"" - "}", "\"XBMC.GetInfoLabels\": {" "\"type\": \"method\"," "\"description\": \"Retrieve info labels about XBMC and the system\"," @@ -2293,21 +1930,7 @@ namespace JSONRPC "\"description\": \"Playback of a media item has been started or the playback speed has changed. If there is no ID available extra information will be provided.\"," "\"params\": [" "{ \"name\": \"sender\", \"type\": \"string\", \"required\": true }," - "{ \"name\": \"data\", \"type\": \"object\", \"required\": true," - "\"properties\": {" - "\"speed\": { \"type\": \"integer\", \"required\": true }," - "\"type\": { \"type\": \"string\", \"id\": \"Notifications.Player.Type\", \"enum\": [ \"unknown\", \"movie\", \"episode\", \"musicvideo\", \"song\" ], \"required\": true }," - "\"id\": { \"$ref\": \"Library.Id\" }," - "\"title\": { \"type\": \"string\" }," - "\"year\": { \"type\": \"integer\" }," - "\"episode\": { \"type\": \"integer\" }," - "\"season\": { \"type\": \"integer\" }," - "\"showtitle\": { \"type\": \"string\" }," - "\"album\": { \"type\": \"string\" }," - "\"artist\": { \"type\": \"string\" }," - "\"track\": { \"type\": \"integer\" }" - "}" - "}" + "{ \"name\": \"data\", \"$ref\": \"Player.Notifications.Data\", \"required\": true }" "]," "\"returns\": null" "}", @@ -2316,20 +1939,7 @@ namespace JSONRPC "\"description\": \"Playback of a media item has been paused. If there is no ID available extra information will be provided.\"," "\"params\": [" "{ \"name\": \"sender\", \"type\": \"string\", \"required\": true }," - "{ \"name\": \"data\", \"type\": \"object\", \"required\": true," - "\"properties\": {" - "\"type\": { \"$ref\": \"Notifications.Player.Type\", \"required\": true }," - "\"id\": { \"$ref\": \"Library.Id\" }," - "\"title\": { \"type\": \"string\" }," - "\"year\": { \"type\": \"integer\" }," - "\"episode\": { \"type\": \"integer\" }," - "\"season\": { \"type\": \"integer\" }," - "\"showtitle\": { \"type\": \"string\" }," - "\"album\": { \"type\": \"string\" }," - "\"artist\": { \"type\": \"string\" }," - "\"track\": { \"type\": \"integer\" }" - "}" - "}" + "{ \"name\": \"data\", \"$ref\": \"Player.Notifications.Data\", \"required\": true }" "]," "\"returns\": null" "}", @@ -2338,32 +1948,32 @@ namespace JSONRPC "\"description\": \"Playback of a media item has been stopped. If there is no ID available extra information will be provided.\"," "\"params\": [" "{ \"name\": \"sender\", \"type\": \"string\", \"required\": true }," - "{ \"name\": \"data\", \"type\": \"object\", \"required\": true," + "{ \"name\": \"data\", \"type\": \"object\", \"required\": true, " "\"properties\": {" - "\"type\": { \"$ref\": \"Notifications.Player.Type\" }," - "\"id\": { \"$ref\": \"Library.Id\" }," - "\"title\": { \"type\": \"string\" }," - "\"year\": { \"type\": \"integer\" }," - "\"episode\": { \"type\": \"integer\" }," - "\"season\": { \"type\": \"integer\" }," - "\"showtitle\": { \"type\": \"string\" }," - "\"album\": { \"type\": \"string\" }," - "\"artist\": { \"type\": \"string\" }," - "\"track\": { \"type\": \"integer\" }" + "\"item\": { \"$ref\": \"Player.Notifications.Item\" }" "}" "}" "]," "\"returns\": null" "}", + "\"Player.OnSpeedChanged\": {" + "\"type\": \"notification\"," + "\"description\": \"Speed of the playback of a media item has been changed. If there is no ID available extra information will be provided.\"," + "\"params\": [" + "{ \"name\": \"sender\", \"type\": \"string\", \"required\": true }," + "{ \"name\": \"data\", \"$ref\": \"Player.Notifications.Data\", \"required\": true }" + "]," + "\"returns\": null" + "}", "\"Player.OnSeek\": {" "\"type\": \"notification\"," - "\"description\": \"The playback position has been changed.\"," + "\"description\": \"The playback position has been changed. If there is no ID available extra information will be provided.\"," "\"params\": [" "{ \"name\": \"sender\", \"type\": \"string\", \"required\": true }," - "{ \"name\": \"data\", \"type\": \"object\", \"required\": true," + "{ \"name\": \"data\", \"type\": \"object\", \"required\": true, " "\"properties\": {" - "\"time\": { \"type\": \"integer\", \"required\": true }," - "\"seekoffset\": { \"type\": \"integer\", \"required\": true }" + "\"item\": { \"$ref\": \"Player.Notifications.Item\" }," + "\"player\": { \"$ref\": \"Player.Notifications.Player.Seek\", \"required\": true }" "}" "}" "]," diff --git a/xbmc/interfaces/json-rpc/XBMCOperations.cpp b/xbmc/interfaces/json-rpc/XBMCOperations.cpp index 9b628fbac1..c84b00423e 100644 --- a/xbmc/interfaces/json-rpc/XBMCOperations.cpp +++ b/xbmc/interfaces/json-rpc/XBMCOperations.cpp @@ -22,45 +22,11 @@ #include "XBMCOperations.h" #include "Application.h" #include "ApplicationMessenger.h" -#include "FileItem.h" #include "Util.h" #include "powermanagement/PowerManager.h" using namespace JSONRPC; -JSON_STATUS CXBMCOperations::Play(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - CFileItemList list; - if (FillFileItemList(parameterObject, list) && list.Size() > 0) - { - g_application.getApplicationMessenger().MediaPlay(list); - return ACK; - } - else - return InvalidParams; -} - -JSON_STATUS CXBMCOperations::StartSlideshow(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) -{ - CStdString exec = "slideShow("; - - exec += parameterObject["directory"].asString(); - - if (parameterObject["random"].asBoolean()) - exec += ", random"; - else - exec += ", notrandom"; - - if (parameterObject["recursive"].asBoolean()) - exec += ", recursive"; - - exec += ")"; - ThreadMessage msg = { TMSG_EXECUTE_BUILT_IN, (DWORD)0, (DWORD)0, exec }; - g_application.getApplicationMessenger().SendMessage(msg); - - return ACK; -} - JSON_STATUS CXBMCOperations::GetInfoLabels(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { std::vector info; diff --git a/xbmc/interfaces/json-rpc/XBMCOperations.h b/xbmc/interfaces/json-rpc/XBMCOperations.h index 2cc779037c..d76b560302 100644 --- a/xbmc/interfaces/json-rpc/XBMCOperations.h +++ b/xbmc/interfaces/json-rpc/XBMCOperations.h @@ -22,16 +22,12 @@ #include "utils/StdString.h" #include "JSONRPC.h" -#include "FileItemHandler.h" namespace JSONRPC { - class CXBMCOperations : CFileItemHandler + class CXBMCOperations { public: - static JSON_STATUS Play(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS StartSlideshow(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); - static JSON_STATUS GetInfoLabels(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); static JSON_STATUS GetInfoBooleans(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result); }; diff --git a/xbmc/interfaces/json-rpc/methods.json b/xbmc/interfaces/json-rpc/methods.json index 859c9ce895..c3bd795abf 100644 --- a/xbmc/interfaces/json-rpc/methods.json +++ b/xbmc/interfaces/json-rpc/methods.json @@ -92,6 +92,33 @@ ], "returns": "any" }, + "Player.Open": { + "type": "method", + "description": "Start playback of either the playlist with the given ID, a slideshow with the pictures from the given directory or a single file or an item from the database.", + "transport": "Response", + "permission": "ControlPlayback", + "params": [ + { "name": "item", + "type": [ + { "type": "object", "required": true, "additionalProperties": false, + "properties": { + "playlistid": { "$ref": "Playlist.Id", "required": true }, + "position": { "$ref": "Playlist.Position", "default": 0 } + } + }, + { "$ref": "Playlist.Item", "required": true }, + { "type": "object", "required": true, "additionalProperties": false, + "properties": { + "path": { "type": "string", "required": true }, + "random": { "type": "boolean", "default": true }, + "recursive": { "type": "boolean", "default": true } + } + } + ] + } + ], + "returns": "string" + }, "Player.GetActivePlayers": { "type": "method", "description": "Returns all active players", @@ -99,721 +126,332 @@ "permission": "ReadData", "params": [], "returns": { - "type": "object", - "properties": { - "video": { "type": "boolean", "required": true }, - "audio": { "type": "boolean", "required": true }, - "picture": { "type": "boolean", "required": true } + "type": "array", + "uniqueItems": true, + "items": { + "type": "object", + "properties": { + "playerid": { "$ref": "Player.Id", "required": true }, + "type": { "$ref": "Player.Type", "required": true } + } } } }, - "AudioPlayer.State": { - "type": "method", - "description": "Returns playback state of the audio player (if it is active)", - "transport": "Response", - "permission": "ReadData", - "params": [], - "returns": { "$ref": "Player.State.Extended" } - }, - "AudioPlayer.PlayPause": { - "type": "method", - "description": "Pauses or unpause playback and returns the new state", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": { "$ref": "Player.State" } - }, - "AudioPlayer.Stop": { - "type": "method", - "description": "Stops playback", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "AudioPlayer.SkipPrevious": { - "type": "method", - "description": "Skips to previous item on the playlist", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "AudioPlayer.SkipNext": { - "type": "method", - "description": "Skips to next item on the playlist", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "AudioPlayer.BigSkipBackward": { - "type": "method", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "AudioPlayer.BigSkipForward": { - "type": "method", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "AudioPlayer.SmallSkipBackward": { + "Player.GetProperties": { "type": "method", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "AudioPlayer.SmallSkipForward": { - "type": "method", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "AudioPlayer.Rewind": { - "type": "method", - "description": "Rewind current playback", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "AudioPlayer.Forward": { - "type": "method", - "description": "Forward current playback", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "AudioPlayer.GetTime": { - "type": "method", - "description": "Retrieves the current and total time of the currently playing file", - "transport": "Response", - "permission": "ReadData", - "params": [], - "returns": { "$ref": "Player.TimeValues" } - }, - "AudioPlayer.GetPercentage": { - "type": "method", - "description": "Retrieve current playback progress in percentage", + "description": "Retrieves the values of the given properties", "transport": "Response", "permission": "ReadData", - "params": [], - "returns": "number" - }, - "AudioPlayer.SeekTime": { - "type": "method", - "description": "Seek to a specific time", - "transport": "Response", - "permission": "ControlPlayback", - "params": [ - { "name": "value", "$ref": "Player.SeekTime", "required": true, "description": "Time to seek to in seconds" } - ], - "returns": "string" - }, - "AudioPlayer.SeekPercentage": { - "type": "method", - "description": "Seek to a specific percentage", - "transport": "Response", - "permission": "ControlPlayback", "params": [ - { "name": "value", "$ref": "Player.SeekPercentage", "required": true, "description": "Percentage value to seek to" } + { "name": "playerid", "$ref": "Player.Id", "required": true }, + { "name": "properties", "type": "array", "uniqueItems": true, "required": true, "items": { "$ref": "Player.Property.Name" } } ], - "returns": "string" + "returns": { "$ref": "Player.Property.Value", "required": true } }, - "VideoPlayer.State": { - "type": "method", - "description": "Returns playback state of the video player (if it is active)", - "transport": "Response", - "permission": "ReadData", - "params": [], - "returns": { "$ref": "Player.State.Extended" } - }, - "VideoPlayer.PlayPause": { + "Player.PlayPause": { "type": "method", "description": "Pauses or unpause playback and returns the new state", "transport": "Response", "permission": "ControlPlayback", - "params": [], - "returns": { "$ref": "Player.State" } - }, - "VideoPlayer.Stop": { - "type": "method", - "description": "Stops playback", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "VideoPlayer.SkipPrevious": { - "type": "method", - "description": "Skips to previous item on the playlist", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "VideoPlayer.SkipNext": { - "type": "method", - "description": "Skips to next item on the playlist", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "VideoPlayer.BigSkipBackward": { - "type": "method", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "VideoPlayer.BigSkipForward": { - "type": "method", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "VideoPlayer.SmallSkipBackward": { - "type": "method", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "VideoPlayer.SmallSkipForward": { - "type": "method", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "VideoPlayer.Rewind": { - "type": "method", - "description": "Rewind current playback", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "VideoPlayer.Forward": { - "type": "method", - "description": "Forward current playback", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "VideoPlayer.GetTime": { - "type": "method", - "description": "Retrieves the current and total time of the currently playing file", - "transport": "Response", - "permission": "ReadData", - "params": [], - "returns": { "$ref": "Player.TimeValues" } - }, - "VideoPlayer.GetPercentage": { - "type": "method", - "description": "Retrieve current playback progress in percentage", - "transport": "Response", - "permission": "ReadData", - "params": [], - "returns": "number" - }, - "VideoPlayer.SeekTime": { - "type": "method", - "description": "Seek to a specific time", - "transport": "Response", - "permission": "ControlPlayback", "params": [ - { "name": "value", "$ref": "Player.SeekTime", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], - "returns": "string" + "returns": { "$ref": "Player.Speed" } }, - "VideoPlayer.SeekPercentage": { + "Player.Stop": { "type": "method", - "description": "Seek to a specific percentage", + "description": "Stops playback", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "value", "$ref": "Player.SeekPercentage", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], "returns": "string" }, - "PicturePlayer.PlayPause": { - "type": "method", - "description": "Pauses or unpause slideshow", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "PicturePlayer.Stop": { - "type": "method", - "description": "Stops slideshow", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "PicturePlayer.SkipPrevious": { - "type": "method", - "description": "Skips to previous picture in the slideshow", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "PicturePlayer.SkipNext": { - "type": "method", - "description": "Skips to next picture in the slideshow", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "PicturePlayer.MoveLeft": { - "type": "method", - "description": "If picture is zoomed move viewport left otherwise skip previous", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "PicturePlayer.MoveRight": { - "type": "method", - "description": "If picture is zoomed move viewport right otherwise skip next", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "PicturePlayer.MoveDown": { - "type": "method", - "description": "If picture is zoomed move viewport down", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "PicturePlayer.MoveUp": { - "type": "method", - "description": "If picture is zoomed move viewport up", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "PicturePlayer.ZoomOut": { - "type": "method", - "description": "Zoom out once", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "PicturePlayer.ZoomIn": { + "Player.SetSpeed": { "type": "method", - "description": "Zoom in once", - "transport": "Response", - "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "PicturePlayer.Zoom": { - "type": "method", - "description": "Zooms current picture", + "description": "Set the speed of the current playback", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "value", "type": "integer", "required": true, "minimum": 1, "maximum": 10, "description": "Zoom level" } + { "name": "playerid", "$ref": "Player.Id", "required": true }, + { "name": "speed", "type": [ "integer", "string" ], "enum": [ -16, -8, -4, -2, -1, 0, 1, 2, 4, 8, 16, "increment", "decrement" ], "required": true } ], - "returns": "string" + "returns": { "$ref": "Player.Speed" } }, - "PicturePlayer.Rotate": { + "Player.Seek": { "type": "method", - "description": "Rotates current picture", + "description": "Seek through the playing item", "transport": "Response", "permission": "ControlPlayback", - "params": [], - "returns": "string" - }, - "Playlist.Create": { - "type": "method", - "description": "Creates a virtual playlist from a given one from a file", - "transport": "Response", - "permission": "ReadData", "params": [ - { "name": "playlist", "$ref": "Playlist.Id", "required": true } - ], - "returns": { "type": "object", - "properties": { - "playlistid": { "type": "string", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true }, + { "name": "value", "required": true, "type": [ + { "$ref": "Player.Position.Percentage", "required": true, "description": "Percentage value to seek to" }, + { "type": "object", "additionalProperties": false, "required": true, "description": "Time to seek to", + "properties": { + "hours": { "type": "integer", "minimum": 0, "maximum": 23 }, + "minutes": { "type": "integer", "minimum": 0, "maximum": 59 }, + "seconds": { "type": "integer", "minimum": 0, "maximum": 59 }, + "milliseconds": { "type": "integer", "minimum": 0, "maximum": 999 } + } + }, + { "type": "string", "enum": [ "smallforward", "smallbackward", "bigforward", "bigbackward" ], "required": true, "description": "Seek by predefined jumps" } + ] } - } - }, - "Playlist.Destroy": { - "type": "method", - "description": "Destroys a virtual playlist", - "transport": "Response", - "permission": "ReadData", - "params": [ - { "name": "playlistid", "type": "string", "required": true, "description": "Identification of the playlist" } ], - "returns": "string" - }, - "Playlist.GetItems": { - "type": "method", - "description": "Retrieve items in the playlist", - "transport": "Response", - "permission": "ReadData", - "params": [ - { "name": "playlist", "$ref": "Playlist.Id", "required": true }, - { "name": "fields", "$ref": "List.Fields.All" }, - { "name": "limits", "$ref": "List.Limits" }, - { "name": "sort", "$ref": "List.Sort" } - ], - "returns": { "type": "object", + "returns": { + "type": "object", "properties": { - "name": { "type": "string", "description": "Name of the playlist (if available)" }, - "limits": { "$ref": "List.LimitsReturned", "required": true }, - "items": { "$ref": "List.Items.All", "required": true } + "percentage": { "$ref": "Player.Position.Percentage" }, + "time": { "$ref": "Global.Time" }, + "totaltime": { "$ref": "Global.Time" } } } }, - "Playlist.Add": { + "Player.MoveLeft": { "type": "method", - "description": "Add items to the playlist", + "description": "If picture is zoomed move viewport left otherwise skip previous", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "playlist", "$ref": "Playlist.Id", "required": true }, - { "name": "items", "$ref": "Playlist.Id", "required": true, "description": "Adds items from given virtual and/or file based playlist" } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], "returns": "string" }, - "Playlist.Remove": { + "Player.MoveRight": { "type": "method", - "description": "Remove item from the playlist", + "description": "If picture is zoomed move viewport right otherwise skip next", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "playlist", "$ref": "Playlist.Id", "required": true }, - { "name": "item", "type": [ "integer", "string" ], "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], "returns": "string" }, - "Playlist.Swap": { + "Player.MoveDown": { "type": "method", - "description": "Swap items in the playlist", + "description": "If picture is zoomed move viewport down", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "playlist", "$ref": "Playlist.Id", "required": true }, - { "name": "item1", "$ref": "Playlist.Item.Position", "required": true }, - { "name": "item2", "$ref": "Playlist.Item.Position", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], "returns": "string" }, - "Playlist.Clear": { + "Player.MoveUp": { "type": "method", - "description": "Clear playlist", + "description": "If picture is zoomed move viewport up", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "playlist", "$ref": "Playlist.Id", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], "returns": "string" }, - "Playlist.Shuffle": { + "Player.ZoomOut": { "type": "method", - "description": "Shuffle playlist", + "description": "Zoom out once", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "playlist", "$ref": "Playlist.Id", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], "returns": "string" }, - "Playlist.UnShuffle": { + "Player.ZoomIn": { "type": "method", - "description": "Unshuffle playlist", + "description": "Zoom in once", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "playlist", "$ref": "Playlist.Id", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], "returns": "string" }, - "VideoPlaylist.State": { - "type": "method", - "description": "Provides information about the current state of the playlist", - "transport": "Response", - "permission": "ReadData", - "params": [ ], - "returns": { "$ref": "Playlist.State", "required": true } - }, - "VideoPlaylist.Play": { + "Player.Zoom": { "type": "method", - "description": "Play current or a specific item", + "description": "Zooms current picture", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "item", "$ref": "Playlist.Item.Position", "description": "Position of the item" } + { "name": "playerid", "$ref": "Player.Id", "required": true }, + { "name": "value", "type": "integer", "required": true, "minimum": 1, "maximum": 10, "description": "Zoom level" } ], - "returns": { "type": "object", - "properties": { - "success": { "type": "boolean", "required": true } - } - } - }, - "VideoPlaylist.SkipPrevious": { - "type": "method", - "description": "Skip current item and play previous item", - "transport": "Response", - "permission": "ControlPlayback", - "params": [ ], "returns": "string" }, - "VideoPlaylist.SkipNext": { + "Player.Rotate": { "type": "method", - "description": "Skip current item and play next item", + "description": "Rotates current picture", "transport": "Response", "permission": "ControlPlayback", - "params": [ ], - "returns": "string" - }, - "VideoPlaylist.GetItems": { - "type": "method", - "description": "Get all items from playlist", - "transport": "Response", - "permission": "ReadData", "params": [ - { "name": "fields", "$ref": "List.Fields.Video" }, - { "name": "limits", "$ref": "List.Limits" }, - { "name": "sort", "$ref": "List.Sort" } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], - "returns": { "type": "object", - "properties": { - "state": { "$ref": "Playlist.State" }, - "limits": { "$ref": "List.LimitsReturned", "required": true }, - "items": { "$ref": "List.Items.Video", "required": true } - } - } + "returns": "string" }, - "VideoPlaylist.Add": { + "Player.GoPrevious": { "type": "method", - "description": "Add item(s) to playlist", + "description": "Go to previous item on the playlist", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "item", "$ref": "Playlist.Video.Item", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], "returns": "string" }, - "VideoPlaylist.Insert": { + "Player.GoNext": { "type": "method", - "description": "Insert item(s) into playlist", + "description": "Go to next item on the playlist", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "index", "$ref": "Playlist.Item.Position", "required": true }, - { "name": "item", "$ref": "Playlist.Video.Item", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], "returns": "string" }, - "VideoPlaylist.Remove": { + "Player.GoTo": { "type": "method", - "description": "Remove item from playlist", + "description": "Go to item at the given position in the playlist", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "item", "$ref": "Playlist.Item.Position", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true }, + { "name": "position", "$ref": "Playlist.Position", "required": true } ], "returns": "string" }, - "VideoPlaylist.Clear": { - "type": "method", - "description": "Clear playlist", - "transport": "Response", - "permission": "ControlPlayback", - "params": [ ], - "returns": "string" - }, - "VideoPlaylist.Shuffle": { - "type": "method", - "description": "Shuffle playlist", - "transport": "Response", - "permission": "ControlPlayback", - "params": [ ], - "returns": "string" - }, - "VideoPlaylist.UnShuffle": { + "Player.Shuffle": { "type": "method", - "description": "Unshuffle playlist", + "description": "Shuffle items in the player", "transport": "Response", "permission": "ControlPlayback", - "params": [ ], + "params": [ + { "name": "playerid", "$ref": "Player.Id", "required": true } + ], "returns": "string" }, - "VideoPlaylist.Repeat": { + "Player.UnShuffle": { "type": "method", - "description": "Set the repeat mode of the playlist", + "description": "Unshuffle items in the player", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "state", "$ref": "Playlist.Repeat", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true } ], "returns": "string" }, - "VideoPlaylist.Swap": { + "Player.Repeat": { "type": "method", - "description": "Swap items in the playlist", + "description": "Set the repeat mode of the player", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "item1", "$ref": "Playlist.Item.Position", "required": true }, - { "name": "item2", "$ref": "Playlist.Item.Position", "required": true } + { "name": "playerid", "$ref": "Player.Id", "required": true }, + { "name": "state", "$ref": "Player.Repeat", "required": true } ], "returns": "string" }, - "AudioPlaylist.State": { + "Playlist.GetPlaylists": { "type": "method", - "description": "Provides information about the current state of the playlist", + "description": "Returns all existing playlists", "transport": "Response", "permission": "ReadData", - "params": [ ], - "returns": { "$ref": "Playlist.State", "required": true } - }, - "AudioPlaylist.Play": { - "type": "method", - "description": "Play current or a specific item", - "transport": "Response", - "permission": "ControlPlayback", - "params": [ - { "name": "item", "$ref": "Playlist.Item.Position" }, - { "name": "songid", "$ref": "Library.Id", "description": "Identification of a song from the audio library" } - ], - "returns": { "type": "object", - "properties": { - "success": { "type": "boolean", "required": true } + "params": [], + "returns": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "object", + "properties": { + "playlistid": { "$ref": "Playlist.Id", "required": true }, + "type": { "$ref": "Playlist.Type", "required": true } + } } } }, - "AudioPlaylist.SkipPrevious": { + "Playlist.GetProperties": { "type": "method", - "description": "Skip current item and play previous item", - "transport": "Response", - "permission": "ControlPlayback", - "params": [ ], - "returns": "string" - }, - "AudioPlaylist.SkipNext": { - "type": "method", - "description": "Skip current item and play next item", + "description": "Retrieves the values of the given properties", "transport": "Response", - "permission": "ControlPlayback", - "params": [ ], - "returns": "string" + "permission": "ReadData", + "params": [ + { "name": "playlistid", "$ref": "Playlist.Id", "required": true }, + { "name": "properties", "type": "array", "uniqueItems": true, "required": true, "items": { "$ref": "Playlist.Property.Name" } } + ], + "returns": { "$ref": "Playlist.Property.Value", "required": true } }, - "AudioPlaylist.GetItems": { + "Playlist.GetItems": { "type": "method", "description": "Get all items from playlist", "transport": "Response", "permission": "ReadData", "params": [ - { "name": "fields", "$ref": "Audio.Fields.Song" }, + { "name": "playlistid", "$ref": "Playlist.Id", "required": true }, + { "name": "fields", "$ref": "List.Fields.All" }, { "name": "limits", "$ref": "List.Limits" }, { "name": "sort", "$ref": "List.Sort" } ], "returns": { "type": "object", "properties": { - "state": { "$ref": "Playlist.State" }, "limits": { "$ref": "List.LimitsReturned", "required": true }, - "items": { "$ref": "List.Items.Audio", "required": true } + "items": { "$ref": "List.Items.All", "required": true } } } }, - "AudioPlaylist.Add": { + "Playlist.Add": { "type": "method", "description": "Add item(s) to playlist", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "item", "$ref": "Playlist.Audio.Item", "required": true } + { "name": "playlistid", "$ref": "Playlist.Id", "required": true }, + { "name": "item", "$ref": "Playlist.Item", "required": true } ], "returns": "string" }, - "AudioPlaylist.Insert": { + "Playlist.Insert": { "type": "method", - "description": "Insert item(s) into playlist", + "description": "Insert item(s) into playlist. Does not work for picture playlists (aka slideshows).", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "index", "$ref": "Playlist.Item.Position", "required": true }, - { "name": "item", "$ref": "Playlist.Audio.Item", "required": true } + { "name": "playlistid", "$ref": "Playlist.Id", "required": true }, + { "name": "position", "$ref": "Playlist.Position", "required": true }, + { "name": "item", "$ref": "Playlist.Item", "required": true } ], "returns": "string" }, - "AudioPlaylist.Remove": { + "Playlist.Remove": { "type": "method", - "description": "Remove item from playlist", + "description": "Remove item from playlist. Does not work for picture playlists (aka slideshows).", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "item", "$ref": "Playlist.Item.Position", "required": true } + { "name": "playlistid", "$ref": "Playlist.Id", "required": true }, + { "name": "position", "$ref": "Playlist.Position", "required": true } ], "returns": "string" }, - "AudioPlaylist.Clear": { + "Playlist.Clear": { "type": "method", "description": "Clear playlist", "transport": "Response", "permission": "ControlPlayback", - "params": [ ], - "returns": "string" - }, - "AudioPlaylist.Shuffle": { - "type": "method", - "description": "Shuffle playlist", - "transport": "Response", - "permission": "ControlPlayback", - "params": [ ], - "returns": "string" - }, - "AudioPlaylist.UnShuffle": { - "type": "method", - "description": "Unshuffle playlist", - "transport": "Response", - "permission": "ControlPlayback", - "params": [ ], - "returns": "string" - }, - "AudioPlaylist.Repeat": { - "type": "method", - "description": "Set the repeat mode of the playlist", - "transport": "Response", - "permission": "ControlPlayback", "params": [ - { "name": "state", "$ref": "Playlist.Repeat", "required": true } + { "name": "playlistid", "$ref": "Playlist.Id", "required": true } ], "returns": "string" }, - "AudioPlaylist.Swap": { + "Playlist.Swap": { "type": "method", - "description": "Swap items in the playlist", + "description": "Swap items in the playlist. Does not work for picture playlists (aka slideshows).", "transport": "Response", "permission": "ControlPlayback", "params": [ - { "name": "item1", "$ref": "Playlist.Item.Position", "required": true }, - { "name": "item2", "$ref": "Playlist.Item.Position", "required": true } + { "name": "playlistid", "$ref": "Playlist.Id", "required": true }, + { "name": "position1", "$ref": "Playlist.Position", "required": true }, + { "name": "position2", "$ref": "Playlist.Position", "required": true } ], "returns": "string" }, @@ -1514,28 +1152,6 @@ "params": [], "returns": "string" }, - "XBMC.Play": { - "type": "method", - "description": "Starts playback of the given file", - "transport": "Response", - "permission": "ControlPlayback", - "params": [ - { "name": "file", "type": "string", "required": true } - ], - "returns": "string" - }, - "XBMC.StartSlideshow": { - "type": "method", - "description": "Starts slideshow with the images from the given directory", - "transport": "Response", - "permission": "ControlPlayback", - "params": [ - { "name": "directory", "type": "string", "required": true }, - { "name": "random", "type": "boolean", "default": true }, - { "name": "recursive", "type": "boolean", "default": true } - ], - "returns": "string" - }, "XBMC.GetInfoLabels": { "type": "method", "description": "Retrieve info labels about XBMC and the system", diff --git a/xbmc/interfaces/json-rpc/notifications.json b/xbmc/interfaces/json-rpc/notifications.json index 87f5b328f0..27bc0c0a5b 100644 --- a/xbmc/interfaces/json-rpc/notifications.json +++ b/xbmc/interfaces/json-rpc/notifications.json @@ -4,21 +4,7 @@ "description": "Playback of a media item has been started or the playback speed has changed. If there is no ID available extra information will be provided.", "params": [ { "name": "sender", "type": "string", "required": true }, - { "name": "data", "type": "object", "required": true, - "properties": { - "speed": { "type": "integer", "required": true }, - "type": { "type": "string", "id": "Notifications.Player.Type", "enum": [ "unknown", "movie", "episode", "musicvideo", "song" ], "required": true }, - "id": { "$ref": "Library.Id" }, - "title": { "type": "string" }, - "year": { "type": "integer" }, - "episode": { "type": "integer" }, - "season": { "type": "integer" }, - "showtitle": { "type": "string" }, - "album": { "type": "string" }, - "artist": { "type": "string" }, - "track": { "type": "integer" } - } - } + { "name": "data", "$ref": "Player.Notifications.Data", "required": true } ], "returns": null }, @@ -27,20 +13,7 @@ "description": "Playback of a media item has been paused. If there is no ID available extra information will be provided.", "params": [ { "name": "sender", "type": "string", "required": true }, - { "name": "data", "type": "object", "required": true, - "properties": { - "type": { "$ref": "Notifications.Player.Type", "required": true }, - "id": { "$ref": "Library.Id" }, - "title": { "type": "string" }, - "year": { "type": "integer" }, - "episode": { "type": "integer" }, - "season": { "type": "integer" }, - "showtitle": { "type": "string" }, - "album": { "type": "string" }, - "artist": { "type": "string" }, - "track": { "type": "integer" } - } - } + { "name": "data", "$ref": "Player.Notifications.Data", "required": true } ], "returns": null }, @@ -49,32 +22,32 @@ "description": "Playback of a media item has been stopped. If there is no ID available extra information will be provided.", "params": [ { "name": "sender", "type": "string", "required": true }, - { "name": "data", "type": "object", "required": true, + { "name": "data", "type": "object", "required": true, "properties": { - "type": { "$ref": "Notifications.Player.Type" }, - "id": { "$ref": "Library.Id" }, - "title": { "type": "string" }, - "year": { "type": "integer" }, - "episode": { "type": "integer" }, - "season": { "type": "integer" }, - "showtitle": { "type": "string" }, - "album": { "type": "string" }, - "artist": { "type": "string" }, - "track": { "type": "integer" } + "item": { "$ref": "Player.Notifications.Item" } } } ], "returns": null }, + "Player.OnSpeedChanged": { + "type": "notification", + "description": "Speed of the playback of a media item has been changed. If there is no ID available extra information will be provided.", + "params": [ + { "name": "sender", "type": "string", "required": true }, + { "name": "data", "$ref": "Player.Notifications.Data", "required": true } + ], + "returns": null + }, "Player.OnSeek": { "type": "notification", - "description": "The playback position has been changed.", + "description": "The playback position has been changed. If there is no ID available extra information will be provided.", "params": [ { "name": "sender", "type": "string", "required": true }, - { "name": "data", "type": "object", "required": true, + { "name": "data", "type": "object", "required": true, "properties": { - "time": { "type": "integer", "required": true }, - "seekoffset": { "type": "integer", "required": true } + "item": { "$ref": "Player.Notifications.Item" }, + "player": { "$ref": "Player.Notifications.Player.Seek", "required": true } } } ], diff --git a/xbmc/interfaces/json-rpc/types.json b/xbmc/interfaces/json-rpc/types.json index b2b8bc658d..7321797481 100644 --- a/xbmc/interfaces/json-rpc/types.json +++ b/xbmc/interfaces/json-rpc/types.json @@ -39,35 +39,178 @@ "notifications": { "$ref": "Configuration.Notifications", "required": true } } }, - "Player.State": { + "Library.Id": { + "type": "integer", + "default": -1, + "minimum": 1 + }, + "Playlist.Id": { + "type": "integer", + "minimum": 0, + "maximum": 2, + "default": -1 + }, + "Playlist.Type": { + "type": "string", + "enum": [ "unknown", "video", "audio", "picture", "mixed" ] + }, + "Playlist.Property.Name": { + "type": "string", + "enum": [ "type", "size" ] + }, + "Playlist.Property.Value": { "type": "object", "properties": { - "playing": { "type": "boolean", "required": true, "description": "" }, - "paused": { "type": "boolean", "required": true, "description": "" } + "type": { "$ref": "Playlist.Type" }, + "size": { "type": "integer", "minimum": 0 } } }, - "Player.State.Extended": { - "extends": "Player.State", - "properties": { - "partymode": { "type": "boolean", "required": true, "description": "" } - } + "Playlist.Position": { + "type": "integer", + "minimum": 0, + "default": -1 }, - "Player.TimeValues": { - "extends": "Player.State", - "properties": { - "time": { "$ref": "Global.Time", "required": true, "description": "" }, - "total": { "$ref": "Global.Time", "required": true, "description": "" } - } + "Playlist.Item": { + "type": [ + { "type": "object", "properties": { "file": { "type": "string", "description": "Path to a file (not a directory) to be added to the playlist", "required": true } }, "additionalProperties": false }, + { "type": "object", "properties": { "directory": { "type": "string", "required": true } }, "additionalProperties": false }, + { "type": "object", "properties": { "movieid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, + { "type": "object", "properties": { "episodeid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, + { "type": "object", "properties": { "musicvideoid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, + { "type": "object", "properties": { "artistid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, + { "type": "object", "properties": { "albumid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, + { "type": "object", "properties": { "songid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, + { "type": "object", "properties": { "genreid": { "$ref": "Library.Id", "required": true, "description": "Identification of a genre from the AudioLibrary" } }, "additionalProperties": false } + ] }, - "Player.SeekTime": { + "Player.Id": { "type": "integer", - "minimum": 0 + "minimum": 0, + "maximum": 2, + "default": -1 + }, + "Player.Type": { + "type": "string", + "enum": [ "video", "audio", "picture" ] }, - "Player.SeekPercentage": { + "Player.Position.Percentage": { "type": "number", "minimum": 0.0, "maximum": 100.0 }, + "Player.Speed": { + "type": "object", + "required": true, + "properties": { + "speed": { "type": "integer" } + } + }, + "Player.Repeat": { + "type": "string", + "enum": [ "off", "one", "all" ] + }, + "Player.Property.Name": { + "type": "string", + "enum": [ "type", "partymode", "speed", "time", "percentage", + "totaltime", "playlistid", "position", "repeat", "shuffled", + "canseek", "canchangespeed", "canmove", "canzoom", "canrotate", + "canshuffle", "canrepeat" ] + }, + "Player.Property.Value": { + "type": "object", + "properties": { + "type": { "$ref": "Player.Type" }, + "partymode": { "type": "boolean" }, + "speed": { "type": "integer" }, + "time": { "$ref": "Global.Time" }, + "percentage": { "$ref": "Player.Position.Percentage" }, + "totaltime": { "$ref": "Global.Time" }, + "playlistid": { "$ref": "Playlist.Id" }, + "position": { "$ref": "Playlist.Position" }, + "repeat": { "$ref": "Player.Repeat" }, + "shuffled": { "type": "boolean" }, + "canseek": { "type": "boolean" }, + "canchangespeed": { "type": "boolean" }, + "canmove": { "type": "boolean" }, + "canzoom": { "type": "boolean" }, + "canrotate": { "type": "boolean" }, + "canshuffle": { "type": "boolean" }, + "canrepeat": { "type": "boolean" } + } + }, + "Player.Notifications.Item.Type": { + "type": "string", + "enum": [ "unknown", "movie", "episode", "musicvideo", "song" ] + }, + "Player.Notifications.Item": { + "type": [ + { "type": "object", "description": "An unknown item does not have any additional information.", + "properties": { + "type": { "$ref": "Player.Notifications.Item.Type", "required": true } + } + }, + { "type": "object", "description": "An item known to the database has an identification.", + "properties": { + "type": { "$ref": "Player.Notifications.Item.Type", "required": true }, + "id": { "$ref": "Library.Id", "required": true } + } + }, + { "type": "object", "description": "A movie item has a title and may have a release year.", + "properties": { + "type": { "$ref": "Player.Notifications.Item.Type", "required": true }, + "title": { "type": "string", "required": true }, + "year": { "type": "integer" } + } + }, + { "type": "object", "description": "A tv episode has a title and may have an episode number, season number and the title of the show it belongs to.", + "properties": { + "type": { "$ref": "Player.Notifications.Item.Type", "required": true }, + "title": { "type": "string", "required": true }, + "episode": { "type": "integer" }, + "season": { "type": "integer" }, + "showtitle": { "type": "string" } + } + }, + { "type": "object", "description": "A music video has a title and may have an album and an artist.", + "properties": { + "type": { "$ref": "Player.Notifications.Item.Type", "required": true }, + "title": { "type": "string", "required": true }, + "album": { "type": "string" }, + "artist": { "type": "string" } + } + }, + { "type": "object", "description": "A song has a title and may have an album, an artist and a track number.", + "properties": { + "type": { "$ref": "Player.Notifications.Item.Type", "required": true }, + "title": { "type": "string", "required": true }, + "album": { "type": "string" }, + "artist": { "type": "string" }, + "track": { "type": "integer" } + } + } + ] + }, + "Player.Notifications.Player": { + "type": "object", + "properties": { + "playerid": { "$ref": "Player.Id", "required": true }, + "speed": { "type": "integer" } + } + }, + "Player.Notifications.Player.Seek": { + "extends": "Player.Notifications.Player", + "properties": { + "time": { "$ref": "Global.Time" }, + "seekoffset": { "$ref": "Global.Time" } + } + }, + "Player.Notifications.Data": { + "type": "object", + "properties": { + "item": { "$ref": "Player.Notifications.Item", "required": true }, + "player": { "$ref": "Player.Notifications.Player", "required": true } + } + }, "Item.Fields.Base": { "type": "array", "uniqueItems": true, @@ -86,11 +229,6 @@ "thumbnail": { "type": "string" } } }, - "Library.Id": { - "type": "integer", - "default": -1, - "minimum": 1 - }, "Library.Fields.Genre": { "extends": "Item.Fields.Base", "items": { "type": "string", "enum": [ "title", "thumbnail" ] } @@ -436,51 +574,6 @@ "track": { "type": "integer" } } }, - "Playlist.Id": { - "type": [ - { "type": "object", "properties": { "id": { "type": "string", "minLength": 1, "description": "Identification of a virtual playlist", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "file": { "type": "string", "minLength": 5, "description": "File from which to load a playlist", "required": true } }, "additionalProperties": false } - ] - }, - "Playlist.Item.Position": { - "type": "integer", - "minimum": 0, - "default": -1 - }, - "Playlist.Repeat": { - "type": "string", - "enum": [ "off", "one", "all" ] - }, - "Playlist.State": { - "extends": "Player.State", - "properties": { - "current": { "type": "integer", "required": true }, - "repeat": { "$ref": "Playlist.Repeat", "required": true }, - "shuffled": { "type": "boolean", "required": true } - }, - "additionalProperties": false - }, - "Playlist.Video.Item": { - "type": [ - { "type": "object", "properties": { "file": { "type": "string", "description": "Path to a file (not a directory) to be added to the playlist", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "directory": { "type": "string", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "movieid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "episodeid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "musicvideoid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "playlist": { "$ref": "Playlist.Id", "required": true } }, "additionalProperties": false } - ] - }, - "Playlist.Audio.Item": { - "type": [ - { "type": "object", "properties": { "file": { "type": "string", "description": "Path to a file (not a directory) to be added to the playlist", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "directory": { "type": "string", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "artistid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "albumid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "songid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "genreid": { "$ref": "Library.Id", "required": true } }, "additionalProperties": false }, - { "type": "object", "properties": { "playlist": { "$ref": "Playlist.Id", "required": true } }, "additionalProperties": false } - ] - }, "Files.Media": { "type": "string", "enum": [ "video", "music", "pictures", "files", "programs" ] @@ -534,25 +627,13 @@ "resume", "artistid", "albumid", "tvshowid", "setid" ] } }, - "List.Fields.Video": { - "extends": "Item.Fields.Base", - "items": { "type": "string", - "enum": [ "title", "artist", "genre", "year", "rating", "album", "track", - "playcount", "fanart", "director", "trailer", "tagline", "plot", - "plotoutline", "originaltitle", "lastplayed", "writer", "studio", - "mpaa", "country", "imdbnumber", "premiered", "productioncode", - "runtime", "showlink", "streamdetails", "top250", "votes", - "firstaired", "season", "episode", "showtitle", "thumbnail", - "file", "sorttitle", "episodeguide", "resume", "tvshowid", "setid" ] - } - }, "List.Items.All": { "type": "array", "items": { "extends": [ "Video.Details.File", "Audio.Details.Media" ], "properties": { "id": { "$ref": "Library.Id" }, - "type": { "type": "string", "enum": [ "unknown", "movie", "episode", "musicvideo", "song" ] }, + "type": { "type": "string", "enum": [ "unknown", "movie", "episode", "musicvideo", "song", "picture" ] }, "albumartist": { "type": "string" }, "album": { "type": "string" }, "track": { "type": "integer" }, @@ -588,66 +669,6 @@ } } }, - "List.Items.Video": { - "type": "array", - "items": { - "extends": "Video.Details.File", - "properties": { - "id": { "$ref": "Library.Id" }, - "type": { "type": "string", "enum": [ "unknown", "movie", "episode", "musicvideo" ] }, - "artist": { "type": "string" }, - "genre": { "type": "string" }, - "year": { "type": "integer" }, - "rating": { "type": "number" }, - "album": { "type": "string" }, - "track": { "type": "integer" }, - "trailer": { "type": "string" }, - "tagline": { "type": "string" }, - "plotoutline": { "type": "string" }, - "originaltitle": { "type": "string" }, - "sorttitle": { "type": "string" }, - "writer": { "type": "string" }, - "studio": { "type": "string" }, - "mpaa": { "type": "string" }, - "country": { "type": "string" }, - "imdbnumber": { "type": "string" }, - "premiered": { "type": "string" }, - "productioncode": { "type": "string" }, - "showlink": { "type": "string" }, - "top250": { "type": "integer" }, - "votes": { "type": "string" }, - "firstaired": { "type": "string" }, - "season": { "type": "integer" }, - "episode": { "type": "integer" }, - "episodeguide": { "type": "string" }, - "showtitle": { "type": "string" }, - "setid": { "type": "string", "description": "Comma-separated list of sets" }, - "tvshowid": { "$ref": "Library.Id" } - } - } - }, - "List.Items.Audio": { - "type": "array", - "items": { - "extends": "Audio.Details.Media", - "properties": { - "id": { "$ref": "Library.Id" }, - "type": { "type": "string", "enum": [ "unknown", "song" ] }, - "file": { "type": "string" }, - "albumartist": { "type": "string" }, - "album": { "type": "string" }, - "track": { "type": "integer" }, - "duration": { "type": "integer" }, - "comment": { "type": "string" }, - "lyrics": { "type": "string" }, - "playcount": { "type": "integer" }, - "musicbrainztrackid": { "type": "string" }, - "musicbrainzalbumid": { "type": "string" }, - "artistid": { "$ref": "Library.Id" }, - "albumid": { "$ref": "Library.Id" } - } - } - }, "List.Items.Sources": { "type": "array", "items": { diff --git a/xbmc/pictures/GUIWindowSlideShow.cpp b/xbmc/pictures/GUIWindowSlideShow.cpp index cb727e9357..e10c1cd6e6 100644 --- a/xbmc/pictures/GUIWindowSlideShow.cpp +++ b/xbmc/pictures/GUIWindowSlideShow.cpp @@ -257,6 +257,12 @@ const CFileItemList &CGUIWindowSlideShow::GetSlideShowContents() return *m_slides; } +void CGUIWindowSlideShow::GetSlideShowContents(CFileItemList &list) +{ + for (int index = 0; index < m_slides->Size(); index++) + list.Add(CFileItemPtr(new CFileItem(*m_slides->Get(index)))); +} + const CFileItemPtr CGUIWindowSlideShow::GetCurrentSlide() { if (m_iCurrentSlide >= 0 && m_iCurrentSlide < m_slides->Size()) diff --git a/xbmc/pictures/GUIWindowSlideShow.h b/xbmc/pictures/GUIWindowSlideShow.h index 73e1070d60..e83b7b700d 100644 --- a/xbmc/pictures/GUIWindowSlideShow.h +++ b/xbmc/pictures/GUIWindowSlideShow.h @@ -71,6 +71,7 @@ class CGUIWindowSlideShow : public CGUIWindow void ShowPrevious(); void Select(const CStdString& strPicture); const CFileItemList &GetSlideShowContents(); + void GetSlideShowContents(CFileItemList &list); const CFileItemPtr GetCurrentSlide(); void RunSlideShow(const CStdString &strPath, bool bRecursive = false, bool bRandom = false, bool bNotRandom = false, @@ -92,6 +93,7 @@ class CGUIWindowSlideShow : public CGUIWindow void Shuffle(); bool IsPaused() const { return m_bPause; } bool IsShuffled() const { return m_bShuffled; } + int GetDirection() const { return m_iDirection; } private: typedef std::set path_set; // set to track which paths we're adding void AddItems(const CStdString &strPath, path_set *recursivePaths,