bool EpgSearchFilter::MatchStartAndEndTimes(const CEpgInfoTag &tag) const { return (tag.StartAsLocalTime() >= m_startDateTime && tag.EndAsLocalTime() <= m_endDateTime); }
JSON_STATUS CPVROperations::ScheduleRecording(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result) { if (!g_PVRManager.IsStarted()) { CLog::Log(LOGDEBUG, "JSONRPC: PVR not started"); return FailedToExecute; } int iEpgId = (int)parameterObject["epgid"].asInteger(); int iUniqueId = (int)parameterObject["uniqueid"].asInteger(); int iStartTime = (int)parameterObject["starttime"].asInteger(); if (iEpgId > 0 && iUniqueId > 0 && iStartTime > 0) { CDateTime startTime(iStartTime); CEpgInfoTag *tag = g_EpgContainer.GetById(iEpgId)->GetTag(iUniqueId, startTime); if (tag && tag->ChannelTag()) { CLog::Log(LOGDEBUG, "JSONRPC: schedule recording - channel: '%s' start: '%s' end: '%s'", tag->ChannelTag()->ChannelName().c_str(), tag->StartAsLocalTime().GetAsLocalizedDateTime(false, false).c_str(), tag->EndAsLocalTime().GetAsLocalizedDateTime(false, false).c_str()); CPVRTimerInfoTag *newTimer = CPVRTimerInfoTag::CreateFromEpg(*tag); bool bCreated = (newTimer != NULL); bool bAdded = false; if (bCreated) { CLog::Log(LOGDEBUG, "JSONRPC: recording scheduled"); bAdded = CPVRTimers::AddTimer(*newTimer); } else { CLog::Log(LOGERROR, "JSONRPC: failed to schedule recording"); } delete newTimer; return bAdded ? ACK : InternalError; } } return InvalidParams; }