24 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
25 strlist <<
"GET_FLAGS";
29 return strlist[0].toInt();
42 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
43 strlist <<
"GET_STATE";
47 return strlist[0].toInt();
52 std::chrono::seconds secsleft,
bool hasLater)
65 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
66 strlist <<
"RECORD_PENDING";
67 strlist << QString::number(secsleft.count());
68 strlist << QString::number(static_cast<int>(hasLater));
74 return strlist[0].toUpper() ==
"OK";
90 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
91 strlist <<
"STOP_LIVETV";
96 return strlist[0].toUpper() ==
"OK";
112 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
113 strlist <<
"STOP_RECORDING";
118 return strlist[0].toUpper() ==
"OK";
123 QStringList strlist(QString(
"STOP_RECORDING"));
131 QStringList strlist(QString(
"QUERY_RECORDER %1").arg(inputid));
132 strlist <<
"CANCEL_NEXT_RECORDING";
133 strlist << QString::number((cancel) ? 1 : 0);
140 LOG(VB_CHANNEL, LOG_INFO,
141 QString(
"RemoteRequestFreeInputInfo excluding input %1")
142 .arg(excluded_input));
144 std::vector<InputInfo> inputs;
146 QStringList strlist(QString(
"GET_FREE_INPUT_INFO %1")
147 .arg(excluded_input));
151 QStringList::const_iterator it = strlist.cbegin();
152 while (it != strlist.cend())
155 if (!
info.FromStringList(it, strlist.cend()))
157 inputs.push_back(
info);
158 LOG(VB_CHANNEL, LOG_INFO,
159 QString(
"RemoteRequestFreeInputInfo got input %1 (%2/%3)")
160 .arg(
info.m_inputId).arg(
info.m_chanId).arg(
info.m_mplexId));
163 LOG(VB_CHANNEL, LOG_INFO,
164 QString(
"RemoteRequestFreeInputInfo got %1 inputs")
165 .arg(inputs.size()));
171 LOG(VB_CHANNEL, LOG_INFO, QString(
"RemoteGetFreeRecorderCount"));
173 std::vector<InputInfo> inputs =
176 LOG(VB_CHANNEL, LOG_INFO, QString(
"RemoteGetFreeRecorderCount got %1")
177 .arg(inputs.size()));
178 return inputs.size();
183 LOG(VB_CHANNEL, LOG_INFO,
184 QString(
"RemoteRequestNextFreeRecorder after input %1)")
187 std::vector<InputInfo> inputs =
192 LOG(VB_CHANNEL, LOG_INFO,
193 QString(
"RemoteRequestNextFreeRecorder got no input (after input %1)")
199 for ( ; i < inputs.size(); ++i)
200 if (inputs[i].m_inputId == (
uint)inputid)
203 if (i >= inputs.size())
214 i = (i + 1) % inputs.size();
215 while (i != j && inputs[i].m_displayName == inputs[j].m_displayName)
217 i = (i + 1) % inputs.size();
221 LOG(VB_CHANNEL, LOG_INFO,
222 QString(
"RemoteRequestNextFreeRecorder got input %1")
223 .arg(inputs[i].m_inputId));
230 LOG(VB_CHANNEL, LOG_INFO,
231 QString(
"RemoteRequestFreeRecorderList excluding input %1")
232 .arg(excluded_input));
234 std::vector<InputInfo> inputs =
237 std::vector<uint> inputids;
238 std::transform(inputs.cbegin(), inputs.cend(), std::back_inserter(inputids),
239 [](
const auto & input){ return input.m_inputId; } );
241 LOG(VB_CHANNEL, LOG_INFO,
242 QString(
"RemoteRequestFreeRecorderList got inputs"));
248 LOG(VB_CHANNEL, LOG_INFO,
249 QString(
"RemoteRequestFreeInputList excluding input %1")
250 .arg(excluded_input));
252 std::vector<InputInfo> inputs =
255 std::vector<uint> inputids;
256 std::transform(inputs.cbegin(), inputs.cend(), std::back_inserter(inputids),
257 [](
const auto & input){ return input.m_inputId; } );
259 LOG(VB_CHANNEL, LOG_INFO,
260 QString(
"RemoteRequestFreeInputList got inputs"));
265(
const QStringList &qualifiedRecorders,
uint excluded_input)
267 LOG(VB_CHANNEL, LOG_INFO,
268 QString(
"RemoteRequestFreeRecorderFromList excluding input %1")
269 .arg(excluded_input));
271 std::vector<InputInfo> inputs =
274 for (
const auto &
recorder : std::as_const(qualifiedRecorders))
277 auto sameinput = [inputid](
const auto & input){
return input.m_inputId == inputid; };
278 if (std::any_of(inputs.cbegin(), inputs.cend(), sameinput))
280 LOG(VB_CHANNEL, LOG_INFO,
281 QString(
"RemoteRequestFreeRecorderFromList got input %1")
287 LOG(VB_CHANNEL, LOG_INFO,
288 QString(
"RemoteRequestFreeRecorderFromList got no input"));
294 LOG(VB_CHANNEL, LOG_INFO,
295 QString(
"RemoteRequestRecorder entered"));
297 std::vector<InputInfo> inputs =
302 LOG(VB_CHANNEL, LOG_INFO,
303 QString(
"RemoteRequestRecorder got no input"));
307 LOG(VB_CHANNEL, LOG_INFO,
308 QString(
"RemoteRequestRecorder got input %1")
309 .arg(inputs[0].m_inputId));
315 LOG(VB_CHANNEL, LOG_INFO,
316 QString(
"RemoteGetExistingRecorder program %1")
319 QStringList strlist(
"GET_RECORDER_NUM" );
324 LOG(VB_CHANNEL, LOG_INFO,
325 QString(
"RemoteGetExistingRecorder got no input"));
329 int num = strlist[0].toInt();
331 int port = strlist[2].toInt();
333 LOG(VB_CHANNEL, LOG_INFO,
334 QString(
"RemoteGetExistingRecorder got input %1").arg(num));
340 LOG(VB_CHANNEL, LOG_INFO,
341 QString(
"RemoteGetExistingRecorder input %1")
344 QStringList strlist(
"GET_RECORDER_FROM_NUM" );
345 strlist << QString(
"%1").arg(recordernum);
349 LOG(VB_CHANNEL, LOG_INFO,
350 QString(
"RemoteGetExistingRecorder got no input"));
355 int port = strlist[1].toInt();
357 LOG(VB_CHANNEL, LOG_INFO,
358 QString(
"RemoteGetExistingRecorder got input %1")
366 LOG(VB_GENERAL, LOG_DEBUG, QString(
"RemoteIsBusy(%1) %2")
376 return rec->
IsBusy(&busy_input);
387 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
388 strlist <<
"IS_BUSY";
392 QStringList::const_iterator it = strlist.cbegin();
393 bool state = (*it).toInt() != 0;
402 std::vector<TunerStatus> *tunerList,
bool list_inactive)
410 for (
uint inputid : inputlist)
413 QString channelName =
"";
415 QString subtitle =
"";
416 QDateTime dtStart = QDateTime();
417 QDateTime dtEnd = QDateTime();
420 QString cmd = QString(
"QUERY_REMOTEENCODER %1").arg(inputid);
424 strlist = QStringList(cmd);
425 strlist <<
"GET_STATE";
431 state = strlist[0].toInt();
433 std::this_thread::sleep_for(5ms);
443 strlist = QStringList(QString(
"QUERY_RECORDER %1").arg(inputid));
444 strlist <<
"GET_RECORDING";
455 else if (!list_inactive)
468 QObject::tr(
"Error querying recorder state") : title;
472 tunerList->push_back(tuner);
static std::vector< uint > GetInputList(void)
bool IsBackend(void) const
is this process a backend process
bool SendReceiveStringList(QStringList &strlist, bool quickTimeout=false, bool block=true)
Send a message to the backend and wait for a response.
Holds information on recordings and videos.
QDateTime GetScheduledEndTime(void) const
The scheduled end time of the program.
QString GetChannelName(void) const
This is the channel name in the local market, i.e.
QString GetTitle(void) const
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
void ToStringList(QStringList &list) const
Serializes ProgramInfo into a QStringList which can be passed over a socket.
QString GetSubtitle(void) const
This is the coordinating class of the Recorder Subsystem.
uint GetFlags(void) const
void RecordPending(const ProgramInfo *rcinfo, std::chrono::seconds secsleft, bool hasLater)
Tells TVRec "rcinfo" is the next pending recording.
void StopLiveTV(void)
Tells TVRec to stop a "Live TV" recorder.
bool IsBusy(InputInfo *busy_input=nullptr, std::chrono::seconds time_buffer=5s) const
Returns true if the recorder is busy, or will be within the next time_buffer seconds.
static TVRec * GetTVRec(uint inputid)
TVState GetState(void) const
Returns the TVState of the recorder.
void StopRecording(bool killFile=false)
Changes from a recording state to kState_None.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static bool isRecording()
@ kState_RecordingOnly
Recording Only is a TVRec only state for when we are recording a program, but there is no one current...
@ kState_WatchingRecording
Watching Recording is the state for when we are watching an in progress recording,...
@ kState_ChangingState
This is a placeholder state which we never actually enter, but is returned by GetState() when we are ...
bool RemoteStopLiveTV(uint inputid)
RemoteEncoder * RemoteRequestRecorder(void)
std::vector< uint > RemoteRequestFreeInputList(uint excluded_input)
bool RemoteStopRecording(uint inputid)
bool RemoteIsBusy(uint inputid, InputInfo &busy_input)
bool RemoteRecordPending(uint inputid, const ProgramInfo *pginfo, std::chrono::seconds secsleft, bool hasLater)
RemoteEncoder * RemoteGetExistingRecorder(const ProgramInfo *pginfo)
RemoteEncoder * RemoteRequestNextFreeRecorder(int inputid)
std::vector< InputInfo > RemoteRequestFreeInputInfo(uint excluded_input)
int RemoteGetFreeRecorderCount(void)
bool RemoteGetRecordingStatus(std::vector< TunerStatus > *tunerList, bool list_inactive)
uint RemoteGetState(uint inputid)
uint RemoteGetFlags(uint inputid)
std::vector< uint > RemoteRequestFreeRecorderList(uint excluded_input)
RemoteEncoder * RemoteRequestFreeRecorderFromList(const QStringList &qualifiedRecorders, uint excluded_input)
void RemoteCancelNextRecording(uint inputid, bool cancel)