Skip to content

Commit

Permalink
jsonrpc: add "channelid" property to Player.Open's "item" parameter t…
Browse files Browse the repository at this point in the history
…o start a PVR channel
  • Loading branch information
Montellese committed Oct 16, 2012
1 parent 74bf281 commit d5e3a2f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
17 changes: 17 additions & 0 deletions xbmc/interfaces/json-rpc/PlayerOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "epg/EpgInfoTag.h"
#include "pvr/PVRManager.h"
#include "pvr/channels/PVRChannel.h"
#include "pvr/channels/PVRChannelGroupsContainer.h"

using namespace JSONRPC;
using namespace PLAYLIST;
Expand Down Expand Up @@ -475,6 +476,22 @@ JSONRPC_STATUS CPlayerOperations::Open(const CStdString &method, ITransportLayer
CApplicationMessenger::Get().ExecBuiltIn("playercontrol(partymode(" + parameterObject["item"]["partymode"].asString() + "))");
return ACK;
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("channelid"))
{
if (!g_PVRManager.IsStarted())
return FailedToExecute;

CPVRChannelGroupsContainer *channelGroupContainer = g_PVRChannelGroups;
if (channelGroupContainer == NULL)
return FailedToExecute;

CPVRChannelPtr channel = channelGroupContainer->GetChannelById((int)parameterObject["item"]["channelid"].asInteger());
if (channel == NULL)
return InvalidParams;

CApplicationMessenger::Get().PlayFile(CFileItem(*channel.get()));
return ACK;
}
else
{
CFileItemList list;
Expand Down
5 changes: 5 additions & 0 deletions xbmc/interfaces/json-rpc/ServiceDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,11 @@ namespace JSONRPC
"]"
"}"
"}"
"},"
"{ \"type\": \"object\", \"required\": true, \"additionalProperties\": false,"
"\"properties\": {"
"\"channelid\": { \"$ref\": \"Library.Id\", \"required\": true }"
"}"
"}"
"]"
"},"
Expand Down
5 changes: 5 additions & 0 deletions xbmc/interfaces/json-rpc/methods.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@
]
}
}
},
{ "type": "object", "required": true, "additionalProperties": false,
"properties": {
"channelid": { "$ref": "Library.Id", "required": true }
}
}
]
},
Expand Down

0 comments on commit d5e3a2f

Please sign in to comment.