25 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
26 strlist <<
"GET_FLAGS";
30 return strlist[0].toInt();
43 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
44 strlist <<
"GET_STATE";
48 return strlist[0].toInt();
53 std::chrono::seconds secsleft,
bool hasLater)
66 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
67 strlist <<
"RECORD_PENDING";
68 strlist << QString::number(secsleft.count());
69 strlist << QString::number(static_cast<int>(hasLater));
75 return strlist[0].toUpper() ==
"OK";
91 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
92 strlist <<
"STOP_LIVETV";
97 return strlist[0].toUpper() ==
"OK";
113 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
114 strlist <<
"STOP_RECORDING";
119 return strlist[0].toUpper() ==
"OK";
124 QStringList strlist(QString(
"STOP_RECORDING"));
132 QStringList strlist(QString(
"QUERY_RECORDER %1").arg(inputid));
133 strlist <<
"CANCEL_NEXT_RECORDING";
134 strlist << QString::number((cancel) ? 1 : 0);
141 LOG(VB_CHANNEL, LOG_INFO,
142 QString(
"RemoteRequestFreeInputInfo excluding input %1")
143 .arg(excluded_input));
145 std::vector<InputInfo> inputs;
147 QStringList strlist(QString(
"GET_FREE_INPUT_INFO %1")
148 .arg(excluded_input));
152 QStringList::const_iterator it = strlist.cbegin();
153 while (it != strlist.cend())
156 if (!
info.FromStringList(it, strlist.cend()))
158 inputs.push_back(
info);
159 LOG(VB_CHANNEL, LOG_INFO,
160 QString(
"RemoteRequestFreeInputInfo got input %1 (%2/%3)")
161 .arg(
info.m_inputId).arg(
info.m_chanId).arg(
info.m_mplexId));
164 LOG(VB_CHANNEL, LOG_INFO,
165 QString(
"RemoteRequestFreeInputInfo got %1 inputs")
166 .arg(inputs.size()));
172 LOG(VB_CHANNEL, LOG_INFO, QString(
"RemoteGetFreeRecorderCount"));
174 std::vector<InputInfo> inputs =
177 LOG(VB_CHANNEL, LOG_INFO, QString(
"RemoteGetFreeRecorderCount got %1")
178 .arg(inputs.size()));
179 return inputs.size();
184 LOG(VB_CHANNEL, LOG_INFO,
185 QString(
"RemoteRequestNextFreeRecorder after input %1)")
188 std::vector<InputInfo> inputs =
193 LOG(VB_CHANNEL, LOG_INFO,
194 QString(
"RemoteRequestNextFreeRecorder got no input (after input %1)")
200 for ( ; i < inputs.size(); ++i)
201 if (inputs[i].m_inputId == (
uint)inputid)
204 if (i >= inputs.size())
215 i = (i + 1) % inputs.size();
216 while (i != j && inputs[i].m_displayName == inputs[j].m_displayName)
218 i = (i + 1) % inputs.size();
222 LOG(VB_CHANNEL, LOG_INFO,
223 QString(
"RemoteRequestNextFreeRecorder got input %1")
224 .arg(inputs[i].m_inputId));
231 LOG(VB_CHANNEL, LOG_INFO,
232 QString(
"RemoteRequestFreeRecorderList excluding input %1")
233 .arg(excluded_input));
235 std::vector<InputInfo> inputs =
238 std::vector<uint> inputids;
239 std::ranges::transform(inputs, std::back_inserter(inputids),
240 [](
const auto & input){
return input.m_inputId; } );
242 LOG(VB_CHANNEL, LOG_INFO,
243 QString(
"RemoteRequestFreeRecorderList got inputs"));
249 LOG(VB_CHANNEL, LOG_INFO,
250 QString(
"RemoteRequestFreeInputList excluding input %1")
251 .arg(excluded_input));
253 std::vector<InputInfo> inputs =
256 std::vector<uint> inputids;
257 std::ranges::transform(inputs, std::back_inserter(inputids),
258 [](
const auto & input){
return input.m_inputId; } );
260 LOG(VB_CHANNEL, LOG_INFO,
261 QString(
"RemoteRequestFreeInputList got inputs"));
266(
const QStringList &qualifiedRecorders,
uint excluded_input)
268 LOG(VB_CHANNEL, LOG_INFO,
269 QString(
"RemoteRequestFreeRecorderFromList excluding input %1")
270 .arg(excluded_input));
272 std::vector<InputInfo> inputs =
275 for (
const auto &
recorder : std::as_const(qualifiedRecorders))
278#ifdef __cpp_lib_ranges_contains
281 auto sameinput = [inputid](
const auto & input){
return input.m_inputId == inputid; };
282 if (std::ranges::any_of(inputs, sameinput))
285 LOG(VB_CHANNEL, LOG_INFO,
286 QString(
"RemoteRequestFreeRecorderFromList got input %1")
292 LOG(VB_CHANNEL, LOG_INFO,
293 QString(
"RemoteRequestFreeRecorderFromList got no input"));
299 LOG(VB_CHANNEL, LOG_INFO,
300 QString(
"RemoteRequestRecorder entered"));
302 std::vector<InputInfo> inputs =
307 LOG(VB_CHANNEL, LOG_INFO,
308 QString(
"RemoteRequestRecorder got no input"));
312 LOG(VB_CHANNEL, LOG_INFO,
313 QString(
"RemoteRequestRecorder got input %1")
314 .arg(inputs[0].m_inputId));
320 LOG(VB_CHANNEL, LOG_INFO,
321 QString(
"RemoteGetExistingRecorder program %1")
324 QStringList strlist(
"GET_RECORDER_NUM" );
329 LOG(VB_CHANNEL, LOG_INFO,
330 QString(
"RemoteGetExistingRecorder got no input"));
334 int num = strlist[0].toInt();
336 int port = strlist[2].toInt();
338 LOG(VB_CHANNEL, LOG_INFO,
339 QString(
"RemoteGetExistingRecorder got input %1").arg(num));
345 LOG(VB_CHANNEL, LOG_INFO,
346 QString(
"RemoteGetExistingRecorder input %1")
349 QStringList strlist(
"GET_RECORDER_FROM_NUM" );
350 strlist << QString(
"%1").arg(recordernum);
354 LOG(VB_CHANNEL, LOG_INFO,
355 QString(
"RemoteGetExistingRecorder got no input"));
360 int port = strlist[1].toInt();
362 LOG(VB_CHANNEL, LOG_INFO,
363 QString(
"RemoteGetExistingRecorder got input %1")
371 LOG(VB_GENERAL, LOG_DEBUG, QString(
"RemoteIsBusy(%1) %2")
381 return rec->
IsBusy(&busy_input);
392 QStringList strlist(QString(
"QUERY_REMOTEENCODER %1").arg(inputid));
393 strlist <<
"IS_BUSY";
397 QStringList::const_iterator it = strlist.cbegin();
398 bool state = (*it).toInt() != 0;
407 std::vector<TunerStatus> *tunerList,
bool list_inactive)
415 for (
uint inputid : inputlist)
418 QString channelName =
"";
420 QString subtitle =
"";
421 QDateTime dtStart = QDateTime();
422 QDateTime dtEnd = QDateTime();
425 QString cmd = QString(
"QUERY_REMOTEENCODER %1").arg(inputid);
429 strlist = QStringList(cmd);
430 strlist <<
"GET_STATE";
436 state = strlist[0].toInt();
438 std::this_thread::sleep_for(5ms);
448 strlist = QStringList(QString(
"QUERY_RECORDER %1").arg(inputid));
449 strlist <<
"GET_RECORDING";
460 else if (!list_inactive)
473 QObject::tr(
"Error querying recorder state") : title;
477 tunerList->push_back(tuner);
488 QString cmd =
"QUERY_ISRECORDING";
490 QStringList strlist( cmd );
495 int recCount = strlist[0].toInt();
497 for (
int i = 0, j = 0; j < recCount; i++)
499 cmd = QString(
"QUERY_RECORDER %1").arg(i + 1);
501 strlist = QStringList( cmd );
502 strlist <<
"IS_RECORDING";
506 if (strlist[0].toInt())
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)
int RemoteGetRecordingMask(void)
std::vector< uint > RemoteRequestFreeRecorderList(uint excluded_input)
RemoteEncoder * RemoteRequestFreeRecorderFromList(const QStringList &qualifiedRecorders, uint excluded_input)
void RemoteCancelNextRecording(uint inputid, bool cancel)