aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/interfaces/json-rpc/PVROperations.cpp284
1 files changed, 186 insertions, 98 deletions
diff --git a/xbmc/interfaces/json-rpc/PVROperations.cpp b/xbmc/interfaces/json-rpc/PVROperations.cpp
index 597d8b850d..3665b3773c 100644
--- a/xbmc/interfaces/json-rpc/PVROperations.cpp
+++ b/xbmc/interfaces/json-rpc/PVROperations.cpp
@@ -34,18 +34,22 @@ using namespace JSONRPC;
using namespace PVR;
using namespace KODI::MESSAGING;
-JSONRPC_STATUS CPVROperations::GetProperties(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetProperties(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- CVariant properties = CVariant(CVariant::VariantTypeObject);
- for (unsigned int index = 0; index < parameterObject["properties"].size(); index++)
+ CVariant properties{CVariant::VariantTypeObject};
+ for (unsigned int index = 0; index < parameterObject["properties"].size(); ++index)
{
- std::string propertyName = parameterObject["properties"][index].asString();
+ const std::string propertyName{parameterObject["properties"][index].asString()};
CVariant property;
- JSONRPC_STATUS ret;
- if ((ret = GetPropertyValue(propertyName, property)) != OK)
+ const JSONRPC_STATUS ret{GetPropertyValue(propertyName, property)};
+ if (ret != OK)
return ret;
properties[propertyName] = property;
@@ -56,47 +60,58 @@ JSONRPC_STATUS CPVROperations::GetProperties(const std::string &method, ITranspo
return OK;
}
-JSONRPC_STATUS CPVROperations::GetChannelGroups(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetChannelGroups(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- std::shared_ptr<CPVRChannelGroupsContainer> channelGroupContainer = CServiceBroker::GetPVRManager().ChannelGroups();
+ const std::shared_ptr<const CPVRChannelGroupsContainer> channelGroupContainer{
+ CServiceBroker::GetPVRManager().ChannelGroups()};
if (!channelGroupContainer)
return FailedToExecute;
const std::shared_ptr<const CPVRChannelGroups> channelGroups{
- channelGroupContainer->Get(parameterObject["channeltype"].asString().compare("radio") == 0)};
+ channelGroupContainer->Get(parameterObject["channeltype"].asString() == "radio")};
if (!channelGroups)
return FailedToExecute;
- int start, end;
+ int start{0};
+ int end{0};
- std::vector<std::shared_ptr<CPVRChannelGroup>> groupList = channelGroups->GetMembers(true);
- HandleLimits(parameterObject, result, groupList.size(), start, end);
- for (int index = start; index < end; index++)
+ std::vector<std::shared_ptr<CPVRChannelGroup>> groupList{channelGroups->GetMembers(true)};
+ HandleLimits(parameterObject, result, static_cast<int>(groupList.size()), start, end);
+ for (int index = start; index < end; ++index)
FillChannelGroupDetails(groupList.at(index), parameterObject, result["channelgroups"], true);
return OK;
}
-JSONRPC_STATUS CPVROperations::GetChannelGroupDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetChannelGroupDetails(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- std::shared_ptr<CPVRChannelGroupsContainer> channelGroupContainer = CServiceBroker::GetPVRManager().ChannelGroups();
+ const std::shared_ptr<const CPVRChannelGroupsContainer> channelGroupContainer{
+ CServiceBroker::GetPVRManager().ChannelGroups()};
if (!channelGroupContainer)
return FailedToExecute;
- std::shared_ptr<CPVRChannelGroup> channelGroup;
- CVariant id = parameterObject["channelgroupid"];
+ std::shared_ptr<const CPVRChannelGroup> channelGroup;
+ const CVariant id{parameterObject["channelgroupid"]};
if (id.isInteger())
- channelGroup = channelGroupContainer->GetByIdFromAll((int)id.asInteger());
+ channelGroup = channelGroupContainer->GetByIdFromAll(static_cast<int>(id.asInteger()));
else if (id.isString())
channelGroup = channelGroupContainer->GetGroupAll(id.asString() == "allradio");
- if (channelGroup == NULL)
+ if (!channelGroup)
return InvalidParams;
FillChannelGroupDetails(channelGroup, parameterObject, result["channelgroupdetails"], false);
@@ -104,23 +119,28 @@ JSONRPC_STATUS CPVROperations::GetChannelGroupDetails(const std::string &method,
return OK;
}
-JSONRPC_STATUS CPVROperations::GetChannels(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetChannels(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- std::shared_ptr<CPVRChannelGroupsContainer> channelGroupContainer = CServiceBroker::GetPVRManager().ChannelGroups();
+ const std::shared_ptr<const CPVRChannelGroupsContainer> channelGroupContainer{
+ CServiceBroker::GetPVRManager().ChannelGroups()};
if (!channelGroupContainer)
return FailedToExecute;
- std::shared_ptr<CPVRChannelGroup> channelGroup;
- CVariant id = parameterObject["channelgroupid"];
+ std::shared_ptr<const CPVRChannelGroup> channelGroup;
+ const CVariant id{parameterObject["channelgroupid"]};
if (id.isInteger())
- channelGroup = channelGroupContainer->GetByIdFromAll((int)id.asInteger());
+ channelGroup = channelGroupContainer->GetByIdFromAll(static_cast<int>(id.asInteger()));
else if (id.isString())
channelGroup = channelGroupContainer->GetGroupAll(id.asString() == "allradio");
- if (channelGroup == NULL)
+ if (!channelGroup)
return InvalidParams;
CFileItemList channels;
@@ -135,22 +155,27 @@ JSONRPC_STATUS CPVROperations::GetChannels(const std::string &method, ITransport
return OK;
}
-JSONRPC_STATUS CPVROperations::GetChannelDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetChannelDetails(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- std::shared_ptr<CPVRChannelGroupsContainer> channelGroupContainer = CServiceBroker::GetPVRManager().ChannelGroups();
+ const std::shared_ptr<const CPVRChannelGroupsContainer> channelGroupContainer{
+ CServiceBroker::GetPVRManager().ChannelGroups()};
if (!channelGroupContainer)
return FailedToExecute;
- std::shared_ptr<CPVRChannel> channel = channelGroupContainer->GetChannelById(
- static_cast<int>(parameterObject["channelid"].asInteger()));
- if (channel == NULL)
+ const std::shared_ptr<const CPVRChannel> channel{channelGroupContainer->GetChannelById(
+ static_cast<int>(parameterObject["channelid"].asInteger()))};
+ if (!channel)
return InvalidParams;
- const std::shared_ptr<CPVRChannelGroupMember> groupMember =
- CServiceBroker::GetPVRManager().Get<PVR::GUI::Channels>().GetChannelGroupMember(channel);
+ const std::shared_ptr<CPVRChannelGroupMember> groupMember{
+ CServiceBroker::GetPVRManager().Get<PVR::GUI::Channels>().GetChannelGroupMember(channel)};
if (!groupMember)
return InvalidParams;
@@ -169,54 +194,68 @@ JSONRPC_STATUS CPVROperations::GetClients(const std::string& method,
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- int start, end;
-
+ int start{0};
+ int end{0};
auto clientInfos = CServiceBroker::GetPVRManager().Clients()->GetEnabledClientInfos();
- HandleLimits(parameterObject, result, clientInfos.size(), start, end);
- for (int index = start; index < end; index++)
+ HandleLimits(parameterObject, result, static_cast<int>(clientInfos.size()), start, end);
+
+ for (int index = start; index < end; ++index)
+ {
result["clients"].append(clientInfos[index]);
+ }
return OK;
}
-JSONRPC_STATUS CPVROperations::GetBroadcasts(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetBroadcasts(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- std::shared_ptr<CPVRChannelGroupsContainer> channelGroupContainer = CServiceBroker::GetPVRManager().ChannelGroups();
+ const std::shared_ptr<const CPVRChannelGroupsContainer> channelGroupContainer{
+ CServiceBroker::GetPVRManager().ChannelGroups()};
if (!channelGroupContainer)
return FailedToExecute;
- std::shared_ptr<CPVRChannel> channel = channelGroupContainer->GetChannelById((int)parameterObject["channelid"].asInteger());
- if (channel == NULL)
+ const std::shared_ptr<const CPVRChannel> channel{channelGroupContainer->GetChannelById(
+ static_cast<int>(parameterObject["channelid"].asInteger()))};
+ if (!channel)
return InvalidParams;
- std::shared_ptr<CPVREpg> channelEpg = channel->GetEPG();
+ const std::shared_ptr<const CPVREpg> channelEpg{channel->GetEPG()};
if (!channelEpg)
return InternalError;
CFileItemList programFull;
- const std::vector<std::shared_ptr<CPVREpgInfoTag>> tags = channelEpg->GetTags();
+ const std::vector<std::shared_ptr<CPVREpgInfoTag>> tags{channelEpg->GetTags()};
for (const auto& tag : tags)
{
programFull.Add(std::make_shared<CFileItem>(tag));
}
- HandleFileItemList("broadcastid", false, "broadcasts", programFull, parameterObject, result, programFull.Size(), true);
+ HandleFileItemList("broadcastid", false, "broadcasts", programFull, parameterObject, result,
+ programFull.Size(), true);
return OK;
}
-JSONRPC_STATUS CPVROperations::GetBroadcastDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetBroadcastDetails(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- const std::shared_ptr<CPVREpgInfoTag> epgTag =
+ const std::shared_ptr<CPVREpgInfoTag> epgTag{
CServiceBroker::GetPVRManager().EpgContainer().GetTagByDatabaseId(
- parameterObject["broadcastid"].asInteger());
+ static_cast<int>(parameterObject["broadcastid"].asInteger()))};
if (!epgTag)
return InvalidParams;
@@ -236,9 +275,9 @@ JSONRPC_STATUS CPVROperations::GetBroadcastIsPlayable(const std::string& method,
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- const std::shared_ptr<const CPVREpgInfoTag> epgTag =
+ const std::shared_ptr<const CPVREpgInfoTag> epgTag{
CServiceBroker::GetPVRManager().EpgContainer().GetTagByDatabaseId(
- parameterObject["broadcastid"].asInteger());
+ static_cast<int>(parameterObject["broadcastid"].asInteger()))};
if (!epgTag)
return InvalidParams;
@@ -248,13 +287,17 @@ JSONRPC_STATUS CPVROperations::GetBroadcastIsPlayable(const std::string& method,
return OK;
}
-JSONRPC_STATUS CPVROperations::Record(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::Record(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
std::shared_ptr<CPVRChannel> pChannel;
- CVariant channel = parameterObject["channel"];
+ const CVariant channel{parameterObject["channel"]};
if (channel.isString() && channel.asString() == "current")
{
pChannel = CServiceBroker::GetPVRManager().PlaybackState()->GetPlayingChannel();
@@ -263,37 +306,42 @@ JSONRPC_STATUS CPVROperations::Record(const std::string &method, ITransportLayer
}
else if (channel.isInteger())
{
- std::shared_ptr<CPVRChannelGroupsContainer> channelGroupContainer = CServiceBroker::GetPVRManager().ChannelGroups();
+ const std::shared_ptr<const CPVRChannelGroupsContainer> channelGroupContainer{
+ CServiceBroker::GetPVRManager().ChannelGroups()};
if (!channelGroupContainer)
return FailedToExecute;
- pChannel = channelGroupContainer->GetChannelById((int)channel.asInteger());
+ pChannel = channelGroupContainer->GetChannelById(static_cast<int>(channel.asInteger()));
}
else
return InvalidParams;
- if (pChannel == NULL)
+ if (!pChannel)
return InvalidParams;
else if (!pChannel->CanRecord())
return FailedToExecute;
- CVariant record = parameterObject["record"];
- bool bIsRecording = CServiceBroker::GetPVRManager().Timers()->IsRecordingOnChannel(*pChannel);
+ const CVariant record{parameterObject["record"]};
+ const bool isRecording{CServiceBroker::GetPVRManager().Timers()->IsRecordingOnChannel(*pChannel)};
bool toggle = true;
- if (record.isBoolean() && record.asBoolean() == bIsRecording)
+ if (record.isBoolean() && record.asBoolean() == isRecording)
toggle = false;
if (toggle)
{
if (!CServiceBroker::GetPVRManager().Get<PVR::GUI::Timers>().SetRecordingOnChannel(
- pChannel, !bIsRecording))
+ pChannel, !isRecording))
return FailedToExecute;
}
return ACK;
}
-JSONRPC_STATUS CPVROperations::Scan(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::Scan(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
@@ -301,7 +349,7 @@ JSONRPC_STATUS CPVROperations::Scan(const std::string &method, ITransportLayer *
if (parameterObject.isMember("clientid"))
{
if (CServiceBroker::GetPVRManager().Get<PVR::GUI::Channels>().StartChannelScan(
- parameterObject["clientid"].asInteger()))
+ static_cast<int>(parameterObject["clientid"].asInteger())))
return ACK;
}
else
@@ -313,9 +361,9 @@ JSONRPC_STATUS CPVROperations::Scan(const std::string &method, ITransportLayer *
return FailedToExecute;
}
-JSONRPC_STATUS CPVROperations::GetPropertyValue(const std::string &property, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetPropertyValue(const std::string& property, CVariant& result)
{
- bool started = CServiceBroker::GetPVRManager().IsStarted();
+ const bool started{CServiceBroker::GetPVRManager().IsStarted()};
if (property == "available")
result = started;
@@ -345,10 +393,10 @@ void CPVROperations::FillChannelGroupDetails(
CVariant& result,
bool append /* = false */)
{
- if (channelGroup == NULL)
+ if (!channelGroup)
return;
- CVariant object(CVariant::VariantTypeObject);
+ CVariant object{CVariant::VariantTypeObject};
object["channelgroupid"] = channelGroup->GroupID();
object["channeltype"] = channelGroup->IsRadio() ? "radio" : "tv";
object["label"] = channelGroup->GroupName();
@@ -358,30 +406,35 @@ void CPVROperations::FillChannelGroupDetails(
else
{
CFileItemList channels;
- const auto groupMembers = channelGroup->GetMembers(CPVRChannelGroup::Include::ONLY_VISIBLE);
+ const auto groupMembers{channelGroup->GetMembers(CPVRChannelGroup::Include::ONLY_VISIBLE)};
for (const auto& groupMember : groupMembers)
{
channels.Add(std::make_shared<CFileItem>(groupMember));
}
object["channels"] = CVariant(CVariant::VariantTypeArray);
- HandleFileItemList("channelid", false, "channels", channels, parameterObject["channels"], object, false);
+ HandleFileItemList("channelid", false, "channels", channels, parameterObject["channels"],
+ object, false);
result = object;
}
}
-JSONRPC_STATUS CPVROperations::GetTimers(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetTimers(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- std::shared_ptr<CPVRTimers> timers = CServiceBroker::GetPVRManager().Timers();
+ const std::shared_ptr<const CPVRTimers> timers{CServiceBroker::GetPVRManager().Timers()};
if (!timers)
return FailedToExecute;
CFileItemList timerList;
- const std::vector<std::shared_ptr<CPVRTimerInfoTag>> tags = timers->GetAll();
+ const std::vector<std::shared_ptr<CPVRTimerInfoTag>> tags{timers->GetAll()};
for (const auto& timer : tags)
{
timerList.Add(std::make_shared<CFileItem>(timer));
@@ -392,16 +445,21 @@ JSONRPC_STATUS CPVROperations::GetTimers(const std::string &method, ITransportLa
return OK;
}
-JSONRPC_STATUS CPVROperations::GetTimerDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetTimerDetails(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- std::shared_ptr<CPVRTimers> timers = CServiceBroker::GetPVRManager().Timers();
+ const std::shared_ptr<const CPVRTimers> timers{CServiceBroker::GetPVRManager().Timers()};
if (!timers)
return FailedToExecute;
- std::shared_ptr<CPVRTimerInfoTag> timer = timers->GetById((int)parameterObject["timerid"].asInteger());
+ const std::shared_ptr<CPVRTimerInfoTag> timer{
+ timers->GetById(static_cast<int>(parameterObject["timerid"].asInteger()))};
if (!timer)
return InvalidParams;
@@ -411,14 +469,18 @@ JSONRPC_STATUS CPVROperations::GetTimerDetails(const std::string &method, ITrans
return OK;
}
-JSONRPC_STATUS CPVROperations::AddTimer(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::AddTimer(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- const std::shared_ptr<CPVREpgInfoTag> epgTag =
+ const std::shared_ptr<CPVREpgInfoTag> epgTag{
CServiceBroker::GetPVRManager().EpgContainer().GetTagByDatabaseId(
- parameterObject["broadcastid"].asInteger());
+ static_cast<int>(parameterObject["broadcastid"].asInteger()))};
if (!epgTag)
return InvalidParams;
@@ -426,9 +488,9 @@ JSONRPC_STATUS CPVROperations::AddTimer(const std::string &method, ITransportLay
if (CServiceBroker::GetPVRManager().Timers()->GetTimerForEpgTag(epgTag))
return InvalidParams;
- const std::shared_ptr<CPVRTimerInfoTag> newTimer =
+ const std::shared_ptr<CPVRTimerInfoTag> newTimer{
CPVRTimerInfoTag::CreateFromEpg(epgTag, parameterObject["timerrule"].asBoolean(false),
- parameterObject["reminder"].asBoolean(false));
+ parameterObject["reminder"].asBoolean(false))};
if (newTimer)
{
if (CServiceBroker::GetPVRManager().Get<PVR::GUI::Timers>().AddTimer(newTimer))
@@ -437,17 +499,21 @@ JSONRPC_STATUS CPVROperations::AddTimer(const std::string &method, ITransportLay
return FailedToExecute;
}
-
-JSONRPC_STATUS CPVROperations::DeleteTimer(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::DeleteTimer(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- std::shared_ptr<CPVRTimers> timers = CServiceBroker::GetPVRManager().Timers();
+ const std::shared_ptr<CPVRTimers> timers{CServiceBroker::GetPVRManager().Timers()};
if (!timers)
return FailedToExecute;
- std::shared_ptr<CPVRTimerInfoTag> timer = timers->GetById(parameterObject["timerid"].asInteger());
+ const std::shared_ptr<CPVRTimerInfoTag> timer{
+ timers->GetById(static_cast<int>(parameterObject["timerid"].asInteger()))};
if (!timer)
return InvalidParams;
@@ -457,28 +523,37 @@ JSONRPC_STATUS CPVROperations::DeleteTimer(const std::string &method, ITransport
return FailedToExecute;
}
-JSONRPC_STATUS CPVROperations::ToggleTimer(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::ToggleTimer(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- const std::shared_ptr<CPVREpgInfoTag> epgTag =
+ const std::shared_ptr<CPVREpgInfoTag> epgTag{
CServiceBroker::GetPVRManager().EpgContainer().GetTagByDatabaseId(
- parameterObject["broadcastid"].asInteger());
+ static_cast<int>(parameterObject["broadcastid"].asInteger()))};
if (!epgTag)
return InvalidParams;
- bool timerrule = parameterObject["timerrule"].asBoolean(false);
+ const std::shared_ptr<CPVRTimers> timers{CServiceBroker::GetPVRManager().Timers()};
+ if (!timers)
+ return FailedToExecute;
+
+ const bool timerrule{parameterObject["timerrule"].asBoolean(false)};
bool sentOkay = false;
- std::shared_ptr<CPVRTimerInfoTag> timer = CServiceBroker::GetPVRManager().Timers()->GetTimerForEpgTag(epgTag);
+ std::shared_ptr<CPVRTimerInfoTag> timer{timers->GetTimerForEpgTag(epgTag)};
if (timer)
{
if (timerrule)
- timer = CServiceBroker::GetPVRManager().Timers()->GetTimerRule(timer);
+ timer = timers->GetTimerRule(timer);
if (timer)
- sentOkay = (CServiceBroker::GetPVRManager().Timers()->DeleteTimer(timer, timer->IsRecording(), false) == TimerOperationResult::OK);
+ sentOkay =
+ (timers->DeleteTimer(timer, timer->IsRecording(), false) == TimerOperationResult::OK);
}
else
{
@@ -495,41 +570,54 @@ JSONRPC_STATUS CPVROperations::ToggleTimer(const std::string &method, ITransport
return FailedToExecute;
}
-JSONRPC_STATUS CPVROperations::GetRecordings(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetRecordings(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- std::shared_ptr<CPVRRecordings> recordings = CServiceBroker::GetPVRManager().Recordings();
+ const std::shared_ptr<const CPVRRecordings> recordings{
+ CServiceBroker::GetPVRManager().Recordings()};
if (!recordings)
return FailedToExecute;
CFileItemList recordingsList;
- const std::vector<std::shared_ptr<CPVRRecording>> recs = recordings->GetAll();
+ const std::vector<std::shared_ptr<CPVRRecording>> recs{recordings->GetAll()};
for (const auto& recording : recs)
{
recordingsList.Add(std::make_shared<CFileItem>(recording));
}
- HandleFileItemList("recordingid", true, "recordings", recordingsList, parameterObject, result, true);
+ HandleFileItemList("recordingid", true, "recordings", recordingsList, parameterObject, result,
+ true);
return OK;
}
-JSONRPC_STATUS CPVROperations::GetRecordingDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
+JSONRPC_STATUS CPVROperations::GetRecordingDetails(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
{
if (!CServiceBroker::GetPVRManager().IsStarted())
return FailedToExecute;
- std::shared_ptr<CPVRRecordings> recordings = CServiceBroker::GetPVRManager().Recordings();
+ const std::shared_ptr<const CPVRRecordings> recordings{
+ CServiceBroker::GetPVRManager().Recordings()};
if (!recordings)
return FailedToExecute;
- const std::shared_ptr<CPVRRecording> recording = recordings->GetById(static_cast<int>(parameterObject["recordingid"].asInteger()));
+ const std::shared_ptr<CPVRRecording> recording{
+ recordings->GetById(static_cast<int>(parameterObject["recordingid"].asInteger()))};
if (!recording)
return InvalidParams;
- HandleFileItem("recordingid", true, "recordingdetails", std::make_shared<CFileItem>(recording), parameterObject, parameterObject["properties"], result, false);
+ HandleFileItem("recordingid", true, "recordingdetails", std::make_shared<CFileItem>(recording),
+ parameterObject, parameterObject["properties"], result, false);
return OK;
}
@@ -538,12 +626,12 @@ std::shared_ptr<CFileItem> CPVROperations::GetRecordingFileItem(int recordingId)
{
if (CServiceBroker::GetPVRManager().IsStarted())
{
- const std::shared_ptr<PVR::CPVRRecordings> recordings =
- CServiceBroker::GetPVRManager().Recordings();
+ const std::shared_ptr<const CPVRRecordings> recordings{
+ CServiceBroker::GetPVRManager().Recordings()};
if (recordings)
{
- const std::shared_ptr<PVR::CPVRRecording> recording = recordings->GetById(recordingId);
+ const std::shared_ptr<CPVRRecording> recording{recordings->GetById(recordingId)};
if (recording)
return std::make_shared<CFileItem>(recording);
}