MythTV  master
v2status.cpp
Go to the documentation of this file.
1 // Program Name: httpstatus.cpp
3 //
4 // Purpose - Html & XML status HttpServerExtension
5 //
6 // Created By : David Blain Created On : Oct. 24, 2005
7 // Modified By : Modified On:
8 //
10 
11 // POSIX headers
12 #include <unistd.h>
13 
14 // ANSI C headers
15 #include <cmath>
16 #include <cstdio>
17 #include <cstdlib>
18 
19 // Qt headers
20 #include <QtGlobal>
21 #if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
22 #include <QStringConverter>
23 #endif
24 #include <QTextStream>
25 
26 // MythTV headers
27 #include "libmythbase/compat.h"
28 #include "libmythbase/exitcodes.h"
30 #include "libmythbase/mythconfig.h"
32 #include "libmythbase/mythdate.h"
33 #include "libmythbase/mythdbcon.h"
36 #include "libmythbase/mythversion.h"
37 #include "libmythtv/cardutil.h"
38 #include "libmythtv/jobqueue.h"
39 #include "libmythtv/tv.h"
40 #include "libmythtv/tv_rec.h"
41 #include "libmythupnp/upnp.h"
42 
43 // MythBackend
44 #include "autoexpire.h"
45 #include "backendcontext.h"
46 #include "encoderlink.h"
47 #include "mainserver.h"
48 #include "scheduler.h"
49 #include "v2backendStatus.h"
50 #include "v2serviceUtil.h"
51 #include "v2status.h"
52 
53 // This will be initialised in a thread safe manner on first use
55  (STATUS_HANDLE, V2Status::staticMetaObject, &V2Status::RegisterCustomTypes))
56 
58 {
59  qRegisterMetaType<Preformat*>("Preformat");
60  qRegisterMetaType<V2MachineInfo*>("V2MachineInfo");
61  qRegisterMetaType<V2BackendStatus*>("V2BackendStatus");
62  qRegisterMetaType<V2Encoder*>("V2Encoder");
63  qRegisterMetaType<V2Program*>("V2Program");
64  qRegisterMetaType<V2Frontend*>("V2Frontend");
65  qRegisterMetaType<V2StorageGroup*>("V2StorageGroup");
66  qRegisterMetaType<V2Job*>("V2Job");
67  qRegisterMetaType<V2ChannelInfo*>("V2ChannelInfo");
68  qRegisterMetaType<V2RecordingInfo*>("V2RecordingInfo");
69  qRegisterMetaType<V2ArtworkInfoList*>("V2ArtworkInfoList");
70  qRegisterMetaType<V2ArtworkInfo*>("V2ArtworkInfo");
71  qRegisterMetaType<V2CastMemberList*>("V2CastMemberList");
72  qRegisterMetaType<V2CastMember*>("V2CastMember");
73  qRegisterMetaType<V2Input*>("V2Input");
74  qRegisterMetaType<V2Backend*>("V2Backend");
75 }
76 
78 {
79  m_pEncoders = &gTVList; // extern
80  m_pSched = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
81  if (m_pSched)
84  m_nPreRollSeconds = gCoreContext->GetNumSetting("RecordPreRoll", 0);
85 }
86 
87 // HTML
89 {
90  return GetStatusHTML();
91 }
92 
93 // XML
95 {
96  return GetStatus();
97 }
98 
99 // XML
101 {
102  QDomDocument doc( "Status" );
103  // UTF-8 is the default, but good practice to specify it anyway
104  QDomProcessingInstruction encoding =
105  doc.createProcessingInstruction("xml",
106  R"(version="1.0" encoding="UTF-8")");
107  doc.appendChild(encoding);
108  FillStatusXML( &doc );
109  auto *pResult = new Preformat();
110  pResult->setmimetype("application/xml");
111  pResult->setbuffer(doc.toString());
112  return pResult;
113 }
114 
115 // HTML
117 {
118  QDomDocument doc( "Status" );
119  FillStatusXML( &doc );
120  QString html;
121  QTextStream stream( &html );
122  PrintStatus( stream, &doc );
123  auto *pResult = new Preformat();
124  pResult->setmimetype("text/html");
125  pResult->setbuffer(html);
126  return pResult;
127 }
128 
129 static QString setting_to_localtime(const char *setting)
130 {
131  QString origDateString = gCoreContext->GetSetting(setting);
132  QDateTime origDate = MythDate::fromString(origDateString);
134 }
135 
136 static QDateTime setting_to_qdatetime(const char *setting)
137 {
138  QString origDateString = gCoreContext->GetSetting(setting);
139  QDateTime origDate = MythDate::fromString(origDateString);
140  return origDate;
141 }
142 
143 // Standardized version of GetStatus that supports xml, json, etc.
145 {
146  auto* pStatus = new V2BackendStatus();
147  pStatus->setAsOf ( MythDate::current() );
148  pStatus->setVersion ( MYTH_BINARY_VERSION );
149  pStatus->setProtoVer ( MYTH_PROTO_VERSION );
150  // Encoders
151  FillEncoderList(pStatus->GetEncoders(), pStatus);
152  // Upcoming recordings
153  int nStartIndex = 0;
154  int nCount = 10;
155  // Scheduled Recordings
156  FillUpcomingList(pStatus->GetScheduled(), pStatus,
157  nStartIndex,
158  nCount,
159  true, // bShowAll,
160  -1, // nRecordId,
161  -999); // nRecStatus )
162  // Frontends
163  FillFrontendList(pStatus->GetFrontends(), pStatus,
164  false); // OnLine)
165  // Backends
166  V2Backend *backend {nullptr};
167 
168  // Add this host
169  backend = pStatus->AddNewBackend();
170  QString thisHost = gCoreContext->GetHostName();
171  backend->setName(thisHost);
172  backend->setIP(gCoreContext->GetBackendServerIP());
173 
174  if (m_pMainServer)
175  {
176  backend->setType("Master");
177  QStringList backends;
178  m_pMainServer->GetActiveBackends(backends);
179  for (const QString& hostname : qAsConst(backends))
180  {
181  if (hostname != thisHost)
182  {
184  backend = pStatus->AddNewBackend();
185  backend->setName(hostname);
186  backend->setType("Slave");
187  if (pSock)
188  {
189  backend->setIP(pSock->getIP());
190  }
191  }
192  }
193  }
194  else
195  {
196  backend->setType("Slave");
197  QString masterhost = gCoreContext->GetMasterHostName();
198  QString masterip = gCoreContext->GetMasterServerIP();
199  backend = pStatus->AddNewBackend();
200  backend->setName(masterhost);
201  backend->setIP(masterip);
202  backend->setType("Master");
203  }
204 
205  // Add Job Queue Entries
206  QMap<int, JobQueueEntry> jobs;
207  QMap<int, JobQueueEntry>::Iterator it;
208 
212 
213  for (it = jobs.begin(); it != jobs.end(); ++it)
214  {
215  ProgramInfo pginfo((*it).chanid, (*it).recstartts);
216  if (!pginfo.GetChanID())
217  continue;
218 
219  V2Job * pJob = pStatus->AddNewJob();
220 
221  pJob->setId( (*it).id );
222  pJob->setChanId((*it).chanid );
223  pJob->setStartTime( (*it).recstartts);
224  pJob->setStartTs( (*it).startts );
225  pJob->setInsertTime((*it).inserttime);
226  pJob->setType( (*it).type );
227  pJob->setCmds( (*it).cmds );
228  pJob->setFlags( (*it).flags );
229  pJob->setStatus( (*it).status );
230  pJob->setStatusTime( (*it).statustime);
231  pJob->setSchedRunTime( (*it).schedruntime);
232  pJob->setArgs( (*it).args );
233  if ((*it).hostname.isEmpty())
234  pJob->setHostName( QObject::tr("master"));
235  else
236  pJob->setHostName((*it).hostname);
237  pJob->setComment((*it).comment);
238  V2Program *pProgram = pJob->Program();
239  V2FillProgramInfo( pProgram, &pginfo, true, false, false);
240  }
241 
242  // Machine Info
243  V2MachineInfo *pMachineInfo = pStatus->MachineInfo();
244  FillDriveSpace(pMachineInfo);
245  // load average
246  loadArray rgdAverages = getLoadAvgs();
247  if (rgdAverages[0] != -1)
248  {
249  pMachineInfo->setLoadAvg1(rgdAverages[0]);
250  pMachineInfo->setLoadAvg2(rgdAverages[1]);
251  pMachineInfo->setLoadAvg3(rgdAverages[2]);
252  }
253 
254  // Guide Data
255  QDateTime GuideDataThrough;
256  MSqlQuery query(MSqlQuery::InitCon());
257  query.prepare("SELECT MAX(endtime) FROM program WHERE manualid = 0;");
258  if (query.exec() && query.next())
259  {
260  GuideDataThrough = MythDate::fromString(query.value(0).toString());
261  }
262  pMachineInfo->setGuideStart
263  (setting_to_qdatetime("mythfilldatabaseLastRunStart"));
264  pMachineInfo->setGuideEnd(
265  setting_to_qdatetime("mythfilldatabaseLastRunEnd"));
266  pMachineInfo->setGuideStatus(
267  gCoreContext->GetSetting("mythfilldatabaseLastRunStatus"));
268  if (gCoreContext->GetBoolSetting("MythFillGrabberSuggestsTime", false))
269  {
270  pMachineInfo->setGuideNext(
271  gCoreContext->GetSetting("MythFillSuggestedRunTime"));
272  }
273 
274  if (!GuideDataThrough.isNull())
275  {
276  QDateTime qdtNow = MythDate::current();
277  pMachineInfo->setGuideThru(GuideDataThrough);
278  pMachineInfo->setGuideDays(qdtNow.daysTo(GuideDataThrough));
279  }
280 
281  // Add Miscellaneous information
282  QString info_script = gCoreContext->GetSetting("MiscStatusScript");
283  if ((!info_script.isEmpty()) && (info_script != "none"))
284  {
285  uint flags = kMSRunShell | kMSStdOut;
286  MythSystemLegacy ms(info_script, flags);
287  ms.Run(10s);
288  if (ms.Wait() != GENERIC_EXIT_OK)
289  {
290  LOG(VB_GENERAL, LOG_ERR,
291  QString("Error running miscellaneous "
292  "status information script: %1").arg(info_script));
293  }
294 
295  QByteArray input = ms.ReadAll();
296  pStatus->setMiscellaneous(QString(input));
297  }
298  return pStatus;
299 }
300 
302 {
303  QStringList strlist;
304  QString hostname;
305  QString directory;
306  QString isLocalstr;
307  QString fsID;
308 
309  if (m_pMainServer)
311 
312  QStringList::const_iterator sit = strlist.cbegin();
313  while (sit != strlist.cend())
314  {
315  hostname = *(sit++);
316  directory = *(sit++);
317  isLocalstr = *(sit++);
318  fsID = *(sit++);
319  ++sit; // ignore dirID
320  ++sit; // ignore blocksize
321  long long iTotal = (*(sit++)).toLongLong();
322  long long iUsed = (*(sit++)).toLongLong();;
323  long long iAvail = iTotal - iUsed;
324 
325  if (fsID == "-2")
326  fsID = "total";
327 
328  V2StorageGroup* group = pMachineInfo->AddNewStorageGroup();
329  group->setId(QString(fsID));
330  group->setTotal((int)(iTotal>>10));
331  group->setUsed((int)(iUsed>>10));
332  group->setFree((int)(iAvail>>10));
333  group->setDirectory(directory);
334 
335  if (fsID == "total")
336  {
337  long long iLiveTV = -1;
338  long long iDeleted = -1;
339  long long iExpirable = -1;
340  MSqlQuery query(MSqlQuery::InitCon());
341  query.prepare("SELECT SUM(filesize) FROM recorded "
342  " WHERE recgroup = :RECGROUP;");
343 
344  query.bindValue(":RECGROUP", "LiveTV");
345  if (query.exec() && query.next())
346  {
347  iLiveTV = query.value(0).toLongLong();
348  }
349  query.bindValue(":RECGROUP", "Deleted");
350  if (query.exec() && query.next())
351  {
352  iDeleted = query.value(0).toLongLong();
353  }
354  query.prepare("SELECT SUM(filesize) FROM recorded "
355  " WHERE autoexpire = 1 "
356  " AND recgroup NOT IN ('LiveTV', 'Deleted');");
357  if (query.exec() && query.next())
358  {
359  iExpirable = query.value(0).toLongLong();
360  }
361  group->setLiveTV( (int)(iLiveTV>>20) );
362  group->setDeleted( (int)(iDeleted>>20) );
363  group->setExpirable ( (int)(iExpirable>>20) );
364  }
365  }
366 
367 }
368 
369 void V2Status::FillStatusXML( QDomDocument *pDoc )
370 {
371  QDateTime qdtNow = MythDate::current();
372 
373  // Add Root Node.
374 
375  QDomElement root = pDoc->createElement("Status");
376  pDoc->appendChild(root);
377 
378  root.setAttribute("date" , MythDate::toString(
380  root.setAttribute("time" ,
382  root.setAttribute("ISODate" , qdtNow.toString(Qt::ISODate) );
383  root.setAttribute("version" , MYTH_BINARY_VERSION );
384  root.setAttribute("protoVer", MYTH_PROTO_VERSION );
385 
386  // Add all encoders, if any
387 
388  QDomElement encoders = pDoc->createElement("Encoders");
389  root.appendChild(encoders);
390 
391  int numencoders = 0;
392  bool isLocal = true;
393 
394  TVRec::s_inputsLock.lockForRead();
395 
396  for (auto * elink : qAsConst(*m_pEncoders))
397  {
398  if (elink != nullptr)
399  {
400  TVState state = elink->GetState();
401  isLocal = elink->IsLocal();
402 
403  QDomElement encoder = pDoc->createElement("Encoder");
404  encoders.appendChild(encoder);
405 
406  encoder.setAttribute("id" , elink->GetInputID() );
407  encoder.setAttribute("local" , static_cast<int>(isLocal));
408  encoder.setAttribute("connected" , static_cast<int>(elink->IsConnected()));
409  encoder.setAttribute("state" , state );
410  encoder.setAttribute("sleepstatus" , elink->GetSleepStatus() );
411  //encoder.setAttribute("lowOnFreeSpace", elink->isLowOnFreeSpace());
412 
413  if (isLocal)
414  encoder.setAttribute("hostname", gCoreContext->GetHostName());
415  else
416  encoder.setAttribute("hostname", elink->GetHostName());
417 
418  encoder.setAttribute("devlabel",
419  CardUtil::GetDeviceLabel(elink->GetInputID()) );
420 
421  if (elink->IsConnected())
422  numencoders++;
423 
424  switch (state)
425  {
429  {
430  ProgramInfo *pInfo = elink->GetRecording();
431 
432  if (pInfo)
433  {
434  FillProgramInfo(pDoc, encoder, pInfo);
435  delete pInfo;
436  }
437 
438  break;
439  }
440 
441  default:
442  break;
443  }
444  }
445  }
446 
447  TVRec::s_inputsLock.unlock();
448 
449  encoders.setAttribute("count", numencoders);
450 
451  // Add upcoming shows
452 
453  QDomElement scheduled = pDoc->createElement("Scheduled");
454  root.appendChild(scheduled);
455 
456  RecList recordingList;
457 
458  if (m_pSched)
459  m_pSched->GetAllPending(recordingList);
460 
461  unsigned int iNum = 10;
462  unsigned int iNumRecordings = 0;
463 
464  auto itProg = recordingList.begin();
465  for (; (itProg != recordingList.end()) && iNumRecordings < iNum; ++itProg)
466  {
467  if (((*itProg)->GetRecordingStatus() <= RecStatus::WillRecord) &&
468  ((*itProg)->GetRecordingStartTime() >=
470  {
471  iNumRecordings++;
472  FillProgramInfo(pDoc, scheduled, *itProg);
473  }
474  }
475 
476  while (!recordingList.empty())
477  {
478  ProgramInfo *pginfo = recordingList.back();
479  delete pginfo;
480  recordingList.pop_back();
481  }
482 
483  scheduled.setAttribute("count", iNumRecordings);
484 
485  // Add known frontends
486 
487  QDomElement frontends = pDoc->createElement("Frontends");
488  root.appendChild(frontends);
489 
491  "urn:schemas-mythtv-org:service:MythFrontend:1");
492  if (fes)
493  {
494  EntryMap map;
495  fes->GetEntryMap(map);
496  fes->DecrRef();
497  fes = nullptr;
498 
499  frontends.setAttribute( "count", map.size() );
500  for (const auto & entry : qAsConst(map))
501  {
502  QDomElement fe = pDoc->createElement("Frontend");
503  frontends.appendChild(fe);
504  QUrl url(entry->m_sLocation);
505  fe.setAttribute("name", url.host());
506  fe.setAttribute("url", url.toString(QUrl::RemovePath));
507  entry->DecrRef();
508  }
509  }
510 
511  // Other backends
512 
513  QDomElement backends = pDoc->createElement("Backends");
514  root.appendChild(backends);
515 
516  int numbes = 0;
518  {
519  numbes++;
520  QString masterhost = gCoreContext->GetMasterHostName();
521  QString masterip = gCoreContext->GetMasterServerIP();
522  int masterport = gCoreContext->GetMasterServerStatusPort();
523 
524  QDomElement mbe = pDoc->createElement("Backend");
525  backends.appendChild(mbe);
526  mbe.setAttribute("type", "Master");
527  mbe.setAttribute("name", masterhost);
528  mbe.setAttribute("url" , masterip + ":" + QString::number(masterport));
529  }
530 
532  "urn:schemas-mythtv-org:device:SlaveMediaServer:1");
533  if (sbes)
534  {
535 
536  QString ipaddress = QString();
537  if (!UPnp::g_IPAddrList.isEmpty())
538  ipaddress = UPnp::g_IPAddrList.at(0).toString();
539 
540  EntryMap map;
541  sbes->GetEntryMap(map);
542  sbes->DecrRef();
543  sbes = nullptr;
544 
545  for (const auto & entry : qAsConst(map))
546  {
547  QUrl url(entry->m_sLocation);
548  if (url.host() != ipaddress)
549  {
550  numbes++;
551  QDomElement mbe = pDoc->createElement("Backend");
552  backends.appendChild(mbe);
553  mbe.setAttribute("type", "Slave");
554  mbe.setAttribute("name", url.host());
555  mbe.setAttribute("url" , url.toString(QUrl::RemovePath));
556  }
557  entry->DecrRef();
558  }
559  }
560 
561  backends.setAttribute("count", numbes);
562 
563  // Add Job Queue Entries
564 
565  QDomElement queue = pDoc->createElement("JobQueue");
566  root.appendChild(queue);
567 
568  QMap<int, JobQueueEntry> jobs;
569  QMap<int, JobQueueEntry>::Iterator it;
570 
574 
575  for (it = jobs.begin(); it != jobs.end(); ++it)
576  {
577  ProgramInfo pginfo((*it).chanid, (*it).recstartts);
578  if (!pginfo.GetChanID())
579  continue;
580 
581  QDomElement job = pDoc->createElement("Job");
582  queue.appendChild(job);
583 
584  job.setAttribute("id" , (*it).id );
585  job.setAttribute("chanId" , (*it).chanid );
586  job.setAttribute("startTime" ,
587  (*it).recstartts.toString(Qt::ISODate));
588  job.setAttribute("startTs" , (*it).startts );
589  job.setAttribute("insertTime",
590  (*it).inserttime.toString(Qt::ISODate));
591  job.setAttribute("type" , (*it).type );
592  job.setAttribute("cmds" , (*it).cmds );
593  job.setAttribute("flags" , (*it).flags );
594  job.setAttribute("status" , (*it).status );
595  job.setAttribute("statusTime",
596  (*it).statustime.toString(Qt::ISODate));
597  job.setAttribute("schedTime" ,
598  (*it).schedruntime.toString(Qt::ISODate));
599  job.setAttribute("args" , (*it).args );
600 
601  if ((*it).hostname.isEmpty())
602  job.setAttribute("hostname", QObject::tr("master"));
603  else
604  job.setAttribute("hostname",(*it).hostname);
605 
606  QDomText textNode = pDoc->createTextNode((*it).comment);
607  job.appendChild(textNode);
608 
609  FillProgramInfo(pDoc, job, &pginfo);
610  }
611 
612  queue.setAttribute( "count", jobs.size() );
613 
614  // Add Machine information
615 
616  QDomElement mInfo = pDoc->createElement("MachineInfo");
617  QDomElement storage = pDoc->createElement("Storage" );
618  QDomElement load = pDoc->createElement("Load" );
619  QDomElement guide = pDoc->createElement("Guide" );
620 
621  root.appendChild (mInfo );
622  mInfo.appendChild(storage);
623  mInfo.appendChild(load );
624  mInfo.appendChild(guide );
625 
626  // drive space ---------------------
627 
628  QStringList strlist;
629  QString hostname;
630  QString directory;
631  QString isLocalstr;
632  QString fsID;
633 
634  if (m_pMainServer)
636 
637  QDomElement total;
638 
639  // Make a temporary list to hold the per-filesystem elements so that the
640  // total is always the first element.
641  QList<QDomElement> fsXML;
642  QStringList::const_iterator sit = strlist.cbegin();
643  while (sit != strlist.cend())
644  {
645  hostname = *(sit++);
646  directory = *(sit++);
647  isLocalstr = *(sit++);
648  fsID = *(sit++);
649  ++sit; // ignore dirID
650  ++sit; // ignore blocksize
651  long long iTotal = (*(sit++)).toLongLong();
652  long long iUsed = (*(sit++)).toLongLong();;
653  long long iAvail = iTotal - iUsed;
654 
655  if (fsID == "-2")
656  fsID = "total";
657 
658  QDomElement group = pDoc->createElement("Group");
659 
660  group.setAttribute("id" , fsID );
661  group.setAttribute("total", (int)(iTotal>>10) );
662  group.setAttribute("used" , (int)(iUsed>>10) );
663  group.setAttribute("free" , (int)(iAvail>>10) );
664  group.setAttribute("dir" , directory );
665 
666  if (fsID == "total")
667  {
668  long long iLiveTV = -1;
669  long long iDeleted = -1;
670  long long iExpirable = -1;
671  MSqlQuery query(MSqlQuery::InitCon());
672  query.prepare("SELECT SUM(filesize) FROM recorded "
673  " WHERE recgroup = :RECGROUP;");
674 
675  query.bindValue(":RECGROUP", "LiveTV");
676  if (query.exec() && query.next())
677  {
678  iLiveTV = query.value(0).toLongLong();
679  }
680  query.bindValue(":RECGROUP", "Deleted");
681  if (query.exec() && query.next())
682  {
683  iDeleted = query.value(0).toLongLong();
684  }
685  query.prepare("SELECT SUM(filesize) FROM recorded "
686  " WHERE autoexpire = 1 "
687  " AND recgroup NOT IN ('LiveTV', 'Deleted');");
688  if (query.exec() && query.next())
689  {
690  iExpirable = query.value(0).toLongLong();
691  }
692  group.setAttribute("livetv", (int)(iLiveTV>>20) );
693  group.setAttribute("deleted", (int)(iDeleted>>20) );
694  group.setAttribute("expirable", (int)(iExpirable>>20) );
695  total = group;
696  }
697  else
698  fsXML << group;
699  }
700 
701  storage.appendChild(total);
702  int num_elements = fsXML.size();
703  for (int fs_index = 0; fs_index < num_elements; fs_index++)
704  {
705  storage.appendChild(fsXML[fs_index]);
706  }
707 
708  // load average ---------------------
709 
710 #ifdef Q_OS_ANDROID
711  load.setAttribute("avg1", 0);
712  load.setAttribute("avg2", 1);
713  load.setAttribute("avg3", 2);
714 #else
715  loadArray rgdAverages = getLoadAvgs();
716  if (rgdAverages[0] != -1)
717  {
718  load.setAttribute("avg1", rgdAverages[0]);
719  load.setAttribute("avg2", rgdAverages[1]);
720  load.setAttribute("avg3", rgdAverages[2]);
721  }
722 #endif
723 
724  // Guide Data ---------------------
725 
726  QDateTime GuideDataThrough;
727 
728  MSqlQuery query(MSqlQuery::InitCon());
729  query.prepare("SELECT MAX(endtime) FROM program WHERE manualid = 0;");
730 
731  if (query.exec() && query.next())
732  {
733  GuideDataThrough = MythDate::fromString(query.value(0).toString());
734  }
735 
736  guide.setAttribute("start",
737  setting_to_localtime("mythfilldatabaseLastRunStart"));
738  guide.setAttribute("end",
739  setting_to_localtime("mythfilldatabaseLastRunEnd"));
740  guide.setAttribute("status",
741  gCoreContext->GetSetting("mythfilldatabaseLastRunStatus"));
742  if (gCoreContext->GetBoolSetting("MythFillGrabberSuggestsTime", false))
743  {
744  guide.setAttribute("next",
745  gCoreContext->GetSetting("MythFillSuggestedRunTime"));
746  }
747 
748  if (!GuideDataThrough.isNull())
749  {
750  guide.setAttribute("guideThru",
751  GuideDataThrough.toString(Qt::ISODate));
752  guide.setAttribute("guideDays", qdtNow.daysTo(GuideDataThrough));
753  }
754 
755  // Add Miscellaneous information
756 
757  QString info_script = gCoreContext->GetSetting("MiscStatusScript");
758  if ((!info_script.isEmpty()) && (info_script != "none"))
759  {
760  QDomElement misc = pDoc->createElement("Miscellaneous");
761  root.appendChild(misc);
762 
763  uint flags = kMSRunShell | kMSStdOut;
764  MythSystemLegacy ms(info_script, flags);
765  ms.Run(10s);
766  if (ms.Wait() != GENERIC_EXIT_OK)
767  {
768  LOG(VB_GENERAL, LOG_ERR,
769  QString("Error running miscellaneous "
770  "status information script: %1").arg(info_script));
771  return;
772  }
773 
774  QByteArray input = ms.ReadAll();
775 
776 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
777  QStringList output = QString(input).split('\n',
778  QString::SkipEmptyParts);
779 #else
780  QStringList output = QString(input).split('\n',
781  Qt::SkipEmptyParts);
782 #endif
783 
784  for (const auto & line : qAsConst(output))
785  {
786  QDomElement info = pDoc->createElement("Information");
787 
788  QStringList list = line.split("[]:[]");
789  unsigned int size = list.size();
790  unsigned int hasAttributes = 0;
791 
792  if ((size > 0) && (!list[0].isEmpty()))
793  {
794  info.setAttribute("display", list[0]);
795  hasAttributes++;
796  }
797  if ((size > 1) && (!list[1].isEmpty()))
798  {
799  info.setAttribute("name", list[1]);
800  hasAttributes++;
801  }
802  if ((size > 2) && (!list[2].isEmpty()))
803  {
804  info.setAttribute("value", list[2]);
805  hasAttributes++;
806  }
807 
808  if (hasAttributes > 0)
809  misc.appendChild(info);
810  }
811  }
812 }
813 
815 //
817 
818 void V2Status::PrintStatus( QTextStream &os, QDomDocument *pDoc )
819 {
820 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
821  os.setCodec("UTF-8");
822 #else
823  os.setEncoding(QStringConverter::Utf8);
824 #endif
825 
826  QDateTime qdtNow = MythDate::current();
827 
828  QDomElement docElem = pDoc->documentElement();
829 
830  os << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
831  << "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n"
832  << "<html xmlns=\"http://www.w3.org/1999/xhtml\""
833  << " xml:lang=\"en\" lang=\"en\">\r\n"
834  << "<head>\r\n"
835  << " <meta http-equiv=\"Content-Type\""
836  << "content=\"text/html; charset=UTF-8\" />\r\n"
837  << " <link rel=\"stylesheet\" href=\"/css/Status.css\" type=\"text/css\">\r\n"
838  << " <title>MythTV Status - "
839  << docElem.attribute( "date", MythDate::toString(qdtNow, MythDate::kDateShort) )
840  << " "
841  << docElem.attribute( "time", MythDate::toString(qdtNow, MythDate::kTime) ) << " - "
842  << docElem.attribute( "version", MYTH_BINARY_VERSION ) << "</title>\r\n"
843  << "</head>\r\n"
844  << "<body bgcolor=\"#fff\">\r\n"
845  << "<div class=\"status\">\r\n"
846  << " <h1 class=\"status\">MythTV Status</h1>\r\n";
847 
848  // encoder information ---------------------
849 
850  QDomNode node = docElem.namedItem( "Encoders" );
851 
852  if (!node.isNull())
853  PrintEncoderStatus( os, node.toElement() );
854 
855  // upcoming shows --------------------------
856 
857  node = docElem.namedItem( "Scheduled" );
858 
859  if (!node.isNull())
860  PrintScheduled( os, node.toElement());
861 
862  // Frontends
863 
864  node = docElem.namedItem( "Frontends" );
865 
866  if (!node.isNull())
867  PrintFrontends (os, node.toElement());
868 
869  // Backends
870 
871  node = docElem.namedItem( "Backends" );
872 
873  if (!node.isNull())
874  PrintBackends (os, node.toElement());
875 
876  // Job Queue Entries -----------------------
877 
878  node = docElem.namedItem( "JobQueue" );
879 
880  if (!node.isNull())
881  PrintJobQueue( os, node.toElement());
882 
883  // Machine information ---------------------
884 
885  node = docElem.namedItem( "MachineInfo" );
886 
887  if (!node.isNull())
888  PrintMachineInfo( os, node.toElement());
889 
890  // Miscellaneous information ---------------
891 
892  node = docElem.namedItem( "Miscellaneous" );
893 
894  if (!node.isNull())
895  PrintMiscellaneousInfo( os, node.toElement());
896 
897  os << "\r\n</div>\r\n</body>\r\n</html>\r\n";
898 
899 }
900 
902 //
904 
905 int V2Status::PrintEncoderStatus( QTextStream &os, const QDomElement& encoders )
906 {
907  int nNumEncoders = 0;
908 
909  if (encoders.isNull())
910  return 0;
911 
912  os << " <div class=\"content\">\r\n"
913  << " <h2 class=\"status\">Encoder Status</h2>\r\n";
914 
915  QDomNode node = encoders.firstChild();
916 
917  while (!node.isNull())
918  {
919  QDomElement e = node.toElement();
920 
921  if (!e.isNull())
922  {
923  if (e.tagName() == "Encoder")
924  {
925  QString sIsLocal = (e.attribute( "local" , "remote" )== "1")
926  ? "local" : "remote";
927  QString sCardId = e.attribute( "id" , "0" );
928  QString sHostName = e.attribute( "hostname" , "Unknown");
929  bool bConnected= static_cast<bool>(e.attribute( "connected", "0" ).toInt());
930 
931  bool bIsLowOnFreeSpace=static_cast<bool>(e.attribute( "lowOnFreeSpace", "0").toInt());
932 
933  QString sDevlabel = e.attribute( "devlabel", "[ UNKNOWN ]");
934 
935  os << " Encoder " << sCardId << " " << sDevlabel
936  << " is " << sIsLocal << " on " << sHostName;
937 
938  if ((sIsLocal == "remote") && !bConnected)
939  {
940  SleepStatus sleepStatus =
941  (SleepStatus) e.attribute("sleepstatus",
942  QString::number(sStatus_Undefined)).toInt();
943 
944  if (sleepStatus == sStatus_Asleep)
945  os << " (currently asleep).<br />";
946  else
947  os << " (currently not connected).<br />";
948 
949  node = node.nextSibling();
950  continue;
951  }
952 
953  nNumEncoders++;
954 
955  TVState encState = (TVState) e.attribute( "state", "0").toInt();
956 
957  switch( encState )
958  {
960  os << " and is watching Live TV";
961  break;
962 
965  os << " and is recording";
966  break;
967 
968  default:
969  os << " and is not recording.";
970  break;
971  }
972 
973  // Display first Program Element listed under the encoder
974 
975  QDomNode tmpNode = e.namedItem( "Program" );
976 
977  if (!tmpNode.isNull())
978  {
979  QDomElement program = tmpNode.toElement();
980 
981  if (!program.isNull())
982  {
983  os << " '" << program.attribute( "title", "Unknown" ) << "'";
984 
985  // Get Channel information
986 
987  tmpNode = program.namedItem( "Channel" );
988 
989  if (!tmpNode.isNull())
990  {
991  QDomElement channel = tmpNode.toElement();
992 
993  if (!channel.isNull())
994  os << " on "
995  << channel.attribute( "callSign", "unknown" );
996  }
997 
998  // Get Recording Information (if any)
999 
1000  tmpNode = program.namedItem( "Recording" );
1001 
1002  if (!tmpNode.isNull())
1003  {
1004  QDomElement recording = tmpNode.toElement();
1005 
1006  if (!recording.isNull())
1007  {
1008  QDateTime endTs = MythDate::fromString(
1009  recording.attribute( "recEndTs", "" ));
1010 
1011  os << ". This recording ";
1012  if (endTs < MythDate::current())
1013  os << "was ";
1014  else
1015  os << "is ";
1016 
1017  os << "scheduled to end at "
1018  << MythDate::toString(endTs,
1019  MythDate::kTime);
1020  }
1021  }
1022  }
1023 
1024  os << ".";
1025  }
1026 
1027  if (bIsLowOnFreeSpace)
1028  {
1029  os << " <strong>WARNING</strong>:"
1030  << " This backend is low on free disk space!";
1031  }
1032 
1033  os << "<br />\r\n";
1034  }
1035  }
1036 
1037  node = node.nextSibling();
1038  }
1039 
1040  os << " </div>\r\n\r\n";
1041 
1042  return( nNumEncoders );
1043 }
1044 
1046 //
1048 
1049 int V2Status::PrintScheduled( QTextStream &os, const QDomElement& scheduled )
1050 {
1051  QDateTime qdtNow = MythDate::current();
1052 
1053  if (scheduled.isNull())
1054  return( 0 );
1055 
1056  int nNumRecordings= scheduled.attribute( "count", "0" ).toInt();
1057 
1058  os << " <div class=\"content\">\r\n"
1059  << " <h2 class=\"status\">Schedule</h2>\r\n";
1060 
1061  if (nNumRecordings == 0)
1062  {
1063  os << " There are no shows scheduled for recording.\r\n"
1064  << " </div>\r\n";
1065  return( 0 );
1066  }
1067 
1068  os << " The next " << nNumRecordings << " show" << (nNumRecordings == 1 ? "" : "s" )
1069  << " that " << (nNumRecordings == 1 ? "is" : "are")
1070  << " scheduled for recording:\r\n";
1071 
1072  os << " <div class=\"schedule\">\r\n";
1073 
1074  // Iterate through all scheduled programs
1075 
1076  QDomNode node = scheduled.firstChild();
1077 
1078  while (!node.isNull())
1079  {
1080  QDomElement e = node.toElement();
1081 
1082  if (!e.isNull())
1083  {
1084  QDomNode recNode = e.namedItem( "Recording" );
1085  QDomNode chanNode = e.namedItem( "Channel" );
1086 
1087  if ((e.tagName() == "Program") && !recNode.isNull() &&
1088  !chanNode.isNull())
1089  {
1090  QDomElement r = recNode.toElement();
1091  QDomElement c = chanNode.toElement();
1092 
1093  QString sTitle = e.attribute( "title" , "" );
1094  QString sSubTitle = e.attribute( "subTitle", "" );
1095  QDateTime airDate = MythDate::fromString( e.attribute( "airdate" ,"" ));
1096  QDateTime startTs = MythDate::fromString( e.attribute( "startTime" ,"" ));
1097  QDateTime endTs = MythDate::fromString( e.attribute( "endTime" ,"" ));
1098  QDateTime recStartTs = MythDate::fromString( r.attribute( "recStartTs","" ));
1099 // QDateTime recEndTs = MythDate::fromString( r.attribute( "recEndTs" ,"" ));
1100  int nPreRollSecs = r.attribute( "preRollSeconds", "0" ).toInt();
1101  int nEncoderId = r.attribute( "encoderId" , "0" ).toInt();
1102  QString sProfile = r.attribute( "recProfile" , "" );
1103  QString sChanName = c.attribute( "channelName" , "" );
1104  QString sDesc = "";
1105 
1106  QDomText text = e.firstChild().toText();
1107  if (!text.isNull())
1108  sDesc = text.nodeValue();
1109 
1110  // Build Time to recording start.
1111 
1112  int nTotalSecs = qdtNow.secsTo( recStartTs ) - nPreRollSecs;
1113 
1114  //since we're not displaying seconds
1115 
1116  nTotalSecs -= 60;
1117 
1118  int nTotalDays = nTotalSecs / 86400;
1119  int nTotalHours = (nTotalSecs / 3600)
1120  - (nTotalDays * 24);
1121  int nTotalMins = (nTotalSecs / 60) % 60;
1122 
1123  QString sTimeToStart = "in";
1124 
1125  sTimeToStart += QObject::tr(" %n day(s),", "", nTotalDays );
1126  sTimeToStart += QObject::tr(" %n hour(s) and", "", nTotalHours);
1127  sTimeToStart += QObject::tr(" %n minute(s)", "", nTotalMins);
1128 
1129  if ( nTotalHours == 0 && nTotalMins == 0)
1130  sTimeToStart = QObject::tr("within one minute", "Recording starting");
1131 
1132  if ( nTotalSecs < 0)
1133  sTimeToStart = QObject::tr("soon", "Recording starting");
1134 
1135  // Output HTML
1136 
1137  os << " <a href=\"#\">";
1138  os << MythDate::toString(recStartTs.addSecs(-nPreRollSecs),
1140  MythDate::kSimplify) << " "
1141  << MythDate::toString(recStartTs.addSecs(-nPreRollSecs),
1142  MythDate::kTime) << " - ";
1143 
1144  if (nEncoderId > 0)
1145  os << "Encoder " << nEncoderId << " - ";
1146 
1147  os << sChanName << " - " << sTitle << "<br />"
1148  << "<span><strong>" << sTitle << "</strong> ("
1149  << MythDate::toString(startTs, MythDate::kTime) << "-"
1150  << MythDate::toString(endTs, MythDate::kTime) << ")<br />";
1151 
1152  if ( !sSubTitle.isEmpty())
1153  os << "<em>" << sSubTitle << "</em><br /><br />";
1154 
1155  if ( airDate.isValid())
1156  {
1157  os << "Orig. Airdate: "
1160  << "<br /><br />";
1161  }
1162 
1163  os << sDesc << "<br /><br />"
1164  << "This recording will start " << sTimeToStart
1165  << " using encoder " << nEncoderId << " with the '"
1166  << sProfile << "' profile.</span></a><hr />\r\n";
1167  }
1168  }
1169 
1170  node = node.nextSibling();
1171  }
1172  os << " </div>\r\n";
1173  os << " </div>\r\n\r\n";
1174 
1175  return( nNumRecordings );
1176 }
1177 
1179 //
1181 
1182 int V2Status::PrintFrontends( QTextStream &os, const QDomElement& frontends )
1183 {
1184  if (frontends.isNull())
1185  return( 0 );
1186 
1187  int nNumFES= frontends.attribute( "count", "0" ).toInt();
1188 
1189  if (nNumFES < 1)
1190  return( 0 );
1191 
1192 
1193  os << " <div class=\"content\">\r\n"
1194  << " <h2 class=\"status\">Frontends</h2>\r\n";
1195 
1196  QDomNode node = frontends.firstChild();
1197  while (!node.isNull())
1198  {
1199  QDomElement e = node.toElement();
1200 
1201  if (!e.isNull())
1202  {
1203  QString name = e.attribute( "name" , "" );
1204  QString url = e.attribute( "url" , "" );
1205  os << name << "&nbsp(<a href=\"" << url << "\">Status page</a>)<br />";
1206  }
1207 
1208  node = node.nextSibling();
1209  }
1210 
1211  os << " </div>\r\n\r\n";
1212 
1213  return nNumFES;
1214 }
1215 
1217 //
1219 
1220 int V2Status::PrintBackends( QTextStream &os, const QDomElement& backends )
1221 {
1222  if (backends.isNull())
1223  return( 0 );
1224 
1225  int nNumBES= backends.attribute( "count", "0" ).toInt();
1226 
1227  if (nNumBES < 1)
1228  return( 0 );
1229 
1230 
1231  os << " <div class=\"content\">\r\n"
1232  << " <h2 class=\"status\">Other Backends</h2>\r\n";
1233 
1234  QDomNode node = backends.firstChild();
1235  while (!node.isNull())
1236  {
1237  QDomElement e = node.toElement();
1238 
1239  if (!e.isNull())
1240  {
1241  QString type = e.attribute( "type", "" );
1242  QString name = e.attribute( "name" , "" );
1243  QString url = e.attribute( "url" , "" );
1244  os << type << ": " << name << "&nbsp(<a href=\"" << url << "\">Status page</a>)<br />";
1245  }
1246 
1247  node = node.nextSibling();
1248  }
1249 
1250  os << " </div>\r\n\r\n";
1251 
1252  return nNumBES;
1253 }
1254 
1256 //
1258 
1259 int V2Status::PrintJobQueue( QTextStream &os, const QDomElement& jobs )
1260 {
1261  if (jobs.isNull())
1262  return( 0 );
1263 
1264  int nNumJobs= jobs.attribute( "count", "0" ).toInt();
1265 
1266  os << " <div class=\"content\">\r\n"
1267  << " <h2 class=\"status\">Job Queue</h2>\r\n";
1268 
1269  if (nNumJobs != 0)
1270  {
1271  QString statusColor;
1272  QString jobColor;
1273 
1274  os << " Jobs currently in Queue or recently ended:\r\n<br />"
1275  << " <div class=\"schedule\">\r\n";
1276 
1277 
1278  QDomNode node = jobs.firstChild();
1279 
1280  while (!node.isNull())
1281  {
1282  QDomElement e = node.toElement();
1283 
1284  if (!e.isNull())
1285  {
1286  QDomNode progNode = e.namedItem( "Program" );
1287 
1288  if ((e.tagName() == "Job") && !progNode.isNull() )
1289  {
1290  QDomElement p = progNode.toElement();
1291 
1292  QDomNode recNode = p.namedItem( "Recording" );
1293  QDomNode chanNode = p.namedItem( "Channel" );
1294 
1295  QDomElement r = recNode.toElement();
1296  QDomElement c = chanNode.toElement();
1297 
1298  int nType = e.attribute( "type" , "0" ).toInt();
1299  int nStatus = e.attribute( "status", "0" ).toInt();
1300 
1301  switch( nStatus )
1302  {
1303  case JOB_ABORTED:
1304  statusColor = " class=\"jobaborted\"";
1305  jobColor = "";
1306  break;
1307 
1308  case JOB_ERRORED:
1309  statusColor = " class=\"joberrored\"";
1310  jobColor = " class=\"joberrored\"";
1311  break;
1312 
1313  case JOB_FINISHED:
1314  statusColor = " class=\"jobfinished\"";
1315  jobColor = " class=\"jobfinished\"";
1316  break;
1317 
1318  case JOB_RUNNING:
1319  statusColor = " class=\"jobrunning\"";
1320  jobColor = " class=\"jobrunning\"";
1321  break;
1322 
1323  default:
1324  statusColor = " class=\"jobqueued\"";
1325  jobColor = " class=\"jobqueued\"";
1326  break;
1327  }
1328 
1329  QString sTitle = p.attribute( "title" , "" ); //.replace("\"", "&quot;");
1330  QString sSubTitle = p.attribute( "subTitle", "" );
1331  QDateTime startTs = MythDate::fromString( p.attribute( "startTime" ,"" ));
1332  QDateTime endTs = MythDate::fromString( p.attribute( "endTime" ,"" ));
1333  QDateTime recStartTs = MythDate::fromString( r.attribute( "recStartTs","" ));
1334  QDateTime statusTime = MythDate::fromString( e.attribute( "statusTime","" ));
1335  QDateTime schedRunTime = MythDate::fromString( e.attribute( "schedTime","" ));
1336  QString sHostname = e.attribute( "hostname", "master" );
1337  QString sComment = "";
1338 
1339  QDomText text = e.firstChild().toText();
1340  if (!text.isNull())
1341  sComment = text.nodeValue();
1342 
1343  os << "<a href=\"javascript:void(0)\">"
1344  << MythDate::toString(recStartTs, MythDate::kDateFull |
1346  << " - "
1347  << sTitle << " - <font" << jobColor << ">"
1348  << JobQueue::JobText( nType ) << "</font><br />"
1349  << "<span><strong>" << sTitle << "</strong> ("
1350  << MythDate::toString(startTs, MythDate::kTime) << "-"
1351  << MythDate::toString(endTs, MythDate::kTime) << ")<br />";
1352 
1353  if (!sSubTitle.isEmpty())
1354  os << "<em>" << sSubTitle << "</em><br /><br />";
1355 
1356  os << "Job: " << JobQueue::JobText( nType ) << "<br />";
1357 
1358  if (schedRunTime > MythDate::current())
1359  {
1360  os << "Scheduled Run Time: "
1361  << MythDate::toString(schedRunTime,
1364  << "<br />";
1365  }
1366 
1367  os << "Status: <font" << statusColor << ">"
1368  << JobQueue::StatusText( nStatus )
1369  << "</font><br />"
1370  << "Status Time: "
1371  << MythDate::toString(statusTime, MythDate::kDateFull |
1373  << "<br />";
1374 
1375  if ( nStatus != JOB_QUEUED)
1376  os << "Host: " << sHostname << "<br />";
1377 
1378  if (!sComment.isEmpty())
1379  os << "<br />Comments:<br />" << sComment << "<br />";
1380 
1381  os << "</span></a><hr />\r\n";
1382  }
1383  }
1384 
1385  node = node.nextSibling();
1386  }
1387  os << " </div>\r\n";
1388  }
1389  else
1390  os << " Job Queue is currently empty.\r\n\r\n";
1391 
1392  os << " </div>\r\n\r\n ";
1393 
1394  return( nNumJobs );
1395 
1396 }
1397 
1399 //
1401 
1402 int V2Status::PrintMachineInfo( QTextStream &os, const QDomElement& info )
1403 {
1404  QString sRep;
1405 
1406  if (info.isNull())
1407  return( 0 );
1408 
1409  os << "<div class=\"content\">\r\n"
1410  << " <h2 class=\"status\">Machine Information</h2>\r\n";
1411 
1412  // load average ---------------------
1413 
1414  QDomNode node = info.namedItem( "Load" );
1415 
1416  if (!node.isNull())
1417  {
1418  QDomElement e = node.toElement();
1419 
1420  if (!e.isNull())
1421  {
1422  double dAvg1 = e.attribute( "avg1" , "0" ).toDouble();
1423  double dAvg2 = e.attribute( "avg2" , "0" ).toDouble();
1424  double dAvg3 = e.attribute( "avg3" , "0" ).toDouble();
1425 
1426  os << " <div class=\"loadstatus\">\r\n"
1427  << " This machine's load average:"
1428  << "\r\n <ul>\r\n <li>"
1429  << "1 Minute: " << dAvg1 << "</li>\r\n"
1430  << " <li>5 Minutes: " << dAvg2 << "</li>\r\n"
1431  << " <li>15 Minutes: " << dAvg3
1432  << "</li>\r\n </ul>\r\n"
1433  << " </div>\r\n";
1434  }
1435  }
1436 
1437  // local drive space ---------------------
1438  node = info.namedItem( "Storage" );
1439  QDomElement storage = node.toElement();
1440  node = storage.firstChild();
1441 
1442  // Loop once until we find id == "total". This should be first, but a loop
1443  // separate from the per-filesystem details loop ensures total is first,
1444  // regardless.
1445  while (!node.isNull())
1446  {
1447  QDomElement g = node.toElement();
1448 
1449  if (!g.isNull() && g.tagName() == "Group")
1450  {
1451  QString id = g.attribute("id", "" );
1452 
1453  if (id == "total")
1454  {
1455  int nFree = g.attribute("free" , "0" ).toInt();
1456  int nTotal = g.attribute("total", "0" ).toInt();
1457  int nUsed = g.attribute("used" , "0" ).toInt();
1458  int nLiveTV = g.attribute("livetv" , "0" ).toInt();
1459  int nDeleted = g.attribute("deleted", "0" ).toInt();
1460  int nExpirable = g.attribute("expirable" , "0" ).toInt();
1461  QString nDir = g.attribute("dir" , "" );
1462 
1463  nDir.replace(",", ", ");
1464 
1465  os << " Disk Usage Summary:<br />\r\n";
1466  os << " <ul>\r\n";
1467 
1468  os << " <li>Total Disk Space:\r\n"
1469  << " <ul>\r\n";
1470 
1471  os << " <li>Total Space: ";
1472  sRep = QString("%L1").arg(nTotal) + " MB";
1473  os << sRep << "</li>\r\n";
1474 
1475  os << " <li>Space Used: ";
1476  sRep = QString("%L1").arg(nUsed) + " MB";
1477  os << sRep << "</li>\r\n";
1478 
1479  os << " <li>Space Free: ";
1480  sRep = QString("%L1").arg(nFree) + " MB";
1481  os << sRep << "</li>\r\n";
1482 
1483  if ((nLiveTV + nDeleted + nExpirable) > 0)
1484  {
1485  os << " <li>Space Available "
1486  "After Auto-expire: ";
1487  sRep = QString("%L1").arg(nUsed) + " MB";
1488  sRep = QString("%L1").arg(nFree + nLiveTV +
1489  nDeleted + nExpirable) + " MB";
1490  os << sRep << "\r\n";
1491  os << " <ul>\r\n";
1492  os << " <li>Space Used by LiveTV: ";
1493  sRep = QString("%L1").arg(nLiveTV) + " MB";
1494  os << sRep << "</li>\r\n";
1495  os << " <li>Space Used by "
1496  "Deleted Recordings: ";
1497  sRep = QString("%L1").arg(nDeleted) + " MB";
1498  os << sRep << "</li>\r\n";
1499  os << " <li>Space Used by "
1500  "Auto-expirable Recordings: ";
1501  sRep = QString("%L1").arg(nExpirable) + " MB";
1502  os << sRep << "</li>\r\n";
1503  os << " </ul>\r\n";
1504  os << " </li>\r\n";
1505  }
1506 
1507  os << " </ul>\r\n"
1508  << " </li>\r\n";
1509 
1510  os << " </ul>\r\n";
1511  break;
1512  }
1513  }
1514 
1515  node = node.nextSibling();
1516  }
1517 
1518  // Loop again to handle per-filesystem details.
1519  node = storage.firstChild();
1520 
1521  os << " Disk Usage Details:<br />\r\n";
1522  os << " <ul>\r\n";
1523 
1524 
1525  while (!node.isNull())
1526  {
1527  QDomElement g = node.toElement();
1528 
1529  if (!g.isNull() && g.tagName() == "Group")
1530  {
1531  int nFree = g.attribute("free" , "0" ).toInt();
1532  int nTotal = g.attribute("total", "0" ).toInt();
1533  int nUsed = g.attribute("used" , "0" ).toInt();
1534  QString nDir = g.attribute("dir" , "" );
1535  QString id = g.attribute("id" , "" );
1536 
1537  nDir.replace(",", ", ");
1538 
1539 
1540  if (id != "total")
1541  {
1542 
1543  os << " <li>MythTV Drive #" << id << ":"
1544  << "\r\n"
1545  << " <ul>\r\n";
1546 
1547  if (nDir.contains(','))
1548  os << " <li>Directories: ";
1549  else
1550  os << " <li>Directory: ";
1551 
1552  os << nDir << "</li>\r\n";
1553 
1554  os << " <li>Total Space: ";
1555  sRep = QString("%L1").arg(nTotal) + " MB";
1556  os << sRep << "</li>\r\n";
1557 
1558  os << " <li>Space Used: ";
1559  sRep = QString("%L1").arg(nUsed) + " MB";
1560  os << sRep << "</li>\r\n";
1561 
1562  os << " <li>Space Free: ";
1563  sRep = QString("%L1").arg(nFree) + " MB";
1564  os << sRep << "</li>\r\n";
1565 
1566  os << " </ul>\r\n"
1567  << " </li>\r\n";
1568  }
1569 
1570  }
1571 
1572  node = node.nextSibling();
1573  }
1574 
1575  os << " </ul>\r\n";
1576 
1577  // Guide Info ---------------------
1578 
1579  node = info.namedItem( "Guide" );
1580 
1581  if (!node.isNull())
1582  {
1583  QDomElement e = node.toElement();
1584 
1585  if (!e.isNull())
1586  {
1587  int nDays = e.attribute( "guideDays", "0" ).toInt();
1588  QString sStart = e.attribute( "start" , "" );
1589  QString sEnd = e.attribute( "end" , "" );
1590  QString sStatus = e.attribute( "status" , "" );
1591  QDateTime next = MythDate::fromString( e.attribute( "next" , "" ));
1592  QString sNext = next.isNull() ? "" :
1594  QString sMsg = "";
1595 
1596  QDateTime thru = MythDate::fromString( e.attribute( "guideThru", "" ));
1597 
1598  QDomText text = e.firstChild().toText();
1599 
1600  QString mfdblrs =
1601  gCoreContext->GetSetting("mythfilldatabaseLastRunStart");
1602  QDateTime lastrunstart = MythDate::fromString(mfdblrs);
1603 
1604  if (!text.isNull())
1605  sMsg = text.nodeValue();
1606 
1607  os << " Last mythfilldatabase run started on " << sStart
1608  << " and ";
1609 
1610  if (sEnd < sStart)
1611  os << "is ";
1612  else
1613  os << "ended on " << sEnd << ". ";
1614 
1615  os << sStatus << "<br />\r\n";
1616 
1617  if (!next.isNull() && next >= lastrunstart)
1618  {
1619  os << " Suggested next mythfilldatabase run: "
1620  << sNext << ".<br />\r\n";
1621  }
1622 
1623  if (!thru.isNull())
1624  {
1625  os << " There's guide data until "
1627 
1628  if (nDays > 0)
1629  os << " " << QObject::tr("(%n day(s))", "", nDays);
1630 
1631  os << ".";
1632 
1633  if (nDays <= 3)
1634  os << " <strong>WARNING</strong>: is mythfilldatabase running?";
1635  }
1636  else
1637  os << " There's <strong>no guide data</strong> available! "
1638  << "Have you run mythfilldatabase?";
1639  }
1640  }
1641  os << "\r\n </div>\r\n";
1642 
1643  return( 1 );
1644 }
1645 
1646 int V2Status::PrintMiscellaneousInfo( QTextStream &os, const QDomElement& info )
1647 {
1648  if (info.isNull())
1649  return( 0 );
1650 
1651  // Miscellaneous information
1652 
1653  QDomNodeList nodes = info.elementsByTagName("Information");
1654  uint count = nodes.count();
1655  if (count > 0)
1656  {
1657  QString display;
1658  QString linebreak;
1659  //QString name, value;
1660  os << "<div class=\"content\">\r\n"
1661  << " <h2 class=\"status\">Miscellaneous</h2>\r\n";
1662  for (unsigned int i = 0; i < count; i++)
1663  {
1664  QDomNode node = nodes.item(i);
1665  if (node.isNull())
1666  continue;
1667 
1668  QDomElement e = node.toElement();
1669  if (e.isNull())
1670  continue;
1671 
1672  display = e.attribute("display", "");
1673  //name = e.attribute("name", "");
1674  //value = e.attribute("value", "");
1675 
1676  if (display.isEmpty())
1677  continue;
1678 
1679  // Only include HTML line break if display value doesn't already
1680  // contain breaks.
1681  if (display.contains("<p>", Qt::CaseInsensitive) ||
1682  display.contains("<br", Qt::CaseInsensitive))
1683  {
1684  // matches <BR> or <br /
1685  linebreak = "\r\n";
1686  }
1687  else
1688  linebreak = "<br />\r\n";
1689 
1690  os << " " << display << linebreak;
1691  }
1692  os << "</div>\r\n";
1693  }
1694 
1695  return( 1 );
1696 }
1697 
1698 void V2Status::FillProgramInfo(QDomDocument *pDoc,
1699  QDomNode &node,
1700  ProgramInfo *pInfo,
1701  bool bIncChannel /* = true */,
1702  bool bDetails /* = true */)
1703 {
1704  if ((pDoc == nullptr) || (pInfo == nullptr))
1705  return;
1706 
1707  // Build Program Element
1708 
1709  QDomElement program = pDoc->createElement( "Program" );
1710  node.appendChild( program );
1711 
1712  program.setAttribute( "startTime" ,
1714  program.setAttribute( "endTime" , pInfo->GetScheduledEndTime(MythDate::ISODate));
1715  program.setAttribute( "title" , pInfo->GetTitle() );
1716  program.setAttribute( "subTitle" , pInfo->GetSubtitle());
1717  program.setAttribute( "category" , pInfo->GetCategory());
1718  program.setAttribute( "catType" , pInfo->GetCategoryTypeString());
1719  program.setAttribute( "repeat" , static_cast<int>(pInfo->IsRepeat()));
1720 
1721  if (bDetails)
1722  {
1723 
1724  program.setAttribute( "seriesId" , pInfo->GetSeriesID() );
1725  program.setAttribute( "programId" , pInfo->GetProgramID() );
1726  program.setAttribute( "stars" , pInfo->GetStars() );
1727  program.setAttribute( "fileSize" ,
1728  QString::number( pInfo->GetFilesize() ));
1729  program.setAttribute( "lastModified",
1731  program.setAttribute( "programFlags", pInfo->GetProgramFlags() );
1732  program.setAttribute( "hostname" , pInfo->GetHostname() );
1733 
1734  if (pInfo->GetOriginalAirDate().isValid())
1735  program.setAttribute(
1736  "airdate", pInfo->GetOriginalAirDate().toString());
1737 
1738  QDomText textNode = pDoc->createTextNode( pInfo->GetDescription() );
1739  program.appendChild( textNode );
1740 
1741  }
1742 
1743  if ( bIncChannel )
1744  {
1745  // Build Channel Child Element
1746 
1747  QDomElement channel = pDoc->createElement( "Channel" );
1748  program.appendChild( channel );
1749 
1750  FillChannelInfo( channel, pInfo, bDetails );
1751  }
1752 
1753  // Build Recording Child Element
1754 
1755  if ( pInfo->GetRecordingStatus() != RecStatus::Unknown )
1756  {
1757  QDomElement recording = pDoc->createElement( "Recording" );
1758  program.appendChild( recording );
1759 
1760  recording.setAttribute( "recStatus" ,
1761  pInfo->GetRecordingStatus() );
1762  recording.setAttribute( "recPriority" ,
1763  pInfo->GetRecordingPriority() );
1764  recording.setAttribute( "recStartTs" ,
1766  recording.setAttribute( "recEndTs" ,
1768 
1769  if (bDetails)
1770  {
1771  recording.setAttribute( "recordId" ,
1772  pInfo->GetRecordingRuleID() );
1773  recording.setAttribute( "recGroup" ,
1774  pInfo->GetRecordingGroup() );
1775  recording.setAttribute( "playGroup" ,
1776  pInfo->GetPlaybackGroup() );
1777  recording.setAttribute( "recType" ,
1778  pInfo->GetRecordingRuleType() );
1779  recording.setAttribute( "dupInType" ,
1780  pInfo->GetDuplicateCheckSource() );
1781  recording.setAttribute( "dupMethod" ,
1782  pInfo->GetDuplicateCheckMethod() );
1783  recording.setAttribute( "encoderId" ,
1784  pInfo->GetInputID() );
1785  const RecordingInfo ri(*pInfo);
1786  recording.setAttribute( "recProfile" ,
1788  //recording.setAttribute( "preRollSeconds", m_nPreRollSeconds );
1789  }
1790  }
1791 }
1792 
1794 //
1796 
1797 void V2Status::FillChannelInfo( QDomElement &channel,
1798  ProgramInfo *pInfo,
1799  bool bDetails /* = true */ )
1800 {
1801  if (pInfo)
1802  {
1803 /*
1804  QString sHostName = gCoreContext->GetHostName();
1805  QString sPort = gCoreContext->GetSettingOnHost( "BackendStatusPort",
1806  sHostName);
1807  QString sIconURL = QString( "http://%1:%2/getChannelIcon?ChanId=%3" )
1808  .arg( sHostName )
1809  .arg( sPort )
1810  .arg( pInfo->chanid );
1811 */
1812 
1813  channel.setAttribute( "chanId" , pInfo->GetChanID() );
1814  channel.setAttribute( "chanNum" , pInfo->GetChanNum());
1815  channel.setAttribute( "callSign" , pInfo->GetChannelSchedulingID());
1816  //channel.setAttribute( "iconURL" , sIconURL );
1817  channel.setAttribute( "channelName", pInfo->GetChannelName());
1818 
1819  if (bDetails)
1820  {
1821  channel.setAttribute( "chanFilters",
1822  pInfo->GetChannelPlaybackFilters() );
1823  channel.setAttribute( "sourceId" , pInfo->GetSourceID() );
1824  channel.setAttribute( "inputId" , pInfo->GetInputID() );
1825  channel.setAttribute( "commFree" ,
1826  (pInfo->IsCommercialFree()) ? 1 : 0 );
1827  }
1828  }
1829 }
1830 
1831 
1832 
1833 
1834 // vim:set shiftwidth=4 tabstop=4 expandtab:
setting_to_localtime
static QString setting_to_localtime(const char *setting)
Definition: v2status.cpp:129
Scheduler
Definition: scheduler.h:45
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:807
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:128
Scheduler::GetMainServer
MainServer * GetMainServer()
Definition: scheduler.h:104
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:84
tv.h
V2Status::PrintMiscellaneousInfo
static int PrintMiscellaneousInfo(QTextStream &os, const QDomElement &info)
Definition: v2status.cpp:1646
MythCoreContext::GetMasterHostName
QString GetMasterHostName(void)
Definition: mythcorecontext.cpp:805
ProgramInfo::GetFilesize
virtual uint64_t GetFilesize(void) const
Definition: programinfo.cpp:6345
backendcontext.h
CardUtil::GetDeviceLabel
static QString GetDeviceLabel(const QString &inputtype, const QString &videodevice)
Definition: cardutil.cpp:2664
V2FillProgramInfo
void V2FillProgramInfo(V2Program *pProgram, ProgramInfo *pInfo, bool bIncChannel, bool bDetails, bool bIncCast, bool bIncArtwork, bool bIncRecording)
Definition: v2serviceUtil.cpp:32
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
ProgramInfo::GetHostname
QString GetHostname(void) const
Definition: programinfo.h:421
MythCoreContext::GetScheduler
MythScheduler * GetScheduler(void)
Definition: mythcorecontext.cpp:1875
V2Status::m_pSched
Scheduler * m_pSched
Definition: v2status.h:60
MythSystemLegacy
Definition: mythsystemlegacy.h:67
V2Status::PrintJobQueue
static int PrintJobQueue(QTextStream &os, const QDomElement &jobs)
Definition: v2status.cpp:1259
SleepStatus
SleepStatus
SleepStatus is an enumeration of the awake/sleep status of a slave.
Definition: tv.h:97
FillUpcomingList
int FillUpcomingList(QVariantList &list, QObject *parent, int &nStartIndex, int &nCount, bool bShowAll, int nRecordId, int nRecStatus)
Definition: v2serviceUtil.cpp:761
RecordingInfo
Holds information on a TV Program one might wish to record.
Definition: recordinginfo.h:35
V2Status::FillProgramInfo
static void FillProgramInfo(QDomDocument *pDoc, QDomNode &node, ProgramInfo *pInfo, bool bIncChannel=true, bool bDetails=true)
Definition: v2status.cpp:1698
ProgramInfo::GetChannelName
QString GetChannelName(void) const
This is the channel name in the local market, i.e.
Definition: programinfo.h:386
ProgramInfo::GetChanNum
QString GetChanNum(void) const
This is the channel "number", in the form 1, 1_2, 1-2, 1#1, etc.
Definition: programinfo.h:376
MainServer::BackendQueryDiskSpace
void BackendQueryDiskSpace(QStringList &strlist, bool consolidated, bool allHosts)
Definition: mainserver.cpp:5169
getLoadAvgs
loadArray getLoadAvgs(void)
Returns the system load averages.
Definition: mythmiscutil.cpp:176
V2Status::PrintBackends
static int PrintBackends(QTextStream &os, const QDomElement &backends)
Definition: v2status.cpp:1220
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:205
mythdbcon.h
SSDP::Find
static SSDPCacheEntries * Find(const QString &sURI)
Definition: ssdp.h:132
ProgramInfo::GetChannelSchedulingID
QString GetChannelSchedulingID(void) const
This is the unique programming identifier of a channel.
Definition: programinfo.h:383
ProgramInfo::GetCategory
QString GetCategory(void) const
Definition: programinfo.h:369
RecStatus::Unknown
@ Unknown
Definition: recordingstatus.h:32
mythhttpmetaservice.h
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:608
JOB_LIST_NOT_DONE
@ JOB_LIST_NOT_DONE
Definition: jobqueue.h:71
V2Status::FillDriveSpace
void FillDriveSpace(V2MachineInfo *pMachineInfo)
Definition: v2status.cpp:301
ProgramInfo::GetScheduledEndTime
QDateTime GetScheduledEndTime(void) const
The scheduled end time of the program.
Definition: programinfo.h:397
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythSystemLegacy::ReadAll
QByteArray & ReadAll()
Definition: mythsystemlegacy.cpp:402
V2Status::Status
Preformat * Status()
Definition: v2status.cpp:88
V2Status::GetBackendStatus
V2BackendStatus * GetBackendStatus()
Definition: v2status.cpp:144
SSDPCacheEntries::GetEntryMap
void GetEntryMap(EntryMap &map)
Returns a copy of the EntryMap.
Definition: ssdpcache.cpp:93
V2Job::Program
QObject Program
Definition: v2backendStatus.h:122
ProgramInfo::GetRecordingEndTime
QDateTime GetRecordingEndTime(void) const
Approximate time the recording should have ended, did end, or is intended to end.
Definition: programinfo.h:412
GENERIC_EXIT_OK
@ GENERIC_EXIT_OK
Exited with no error.
Definition: exitcodes.h:11
ProgramInfo::GetProgramFlags
uint32_t GetProgramFlags(void) const
Definition: programinfo.h:470
ProgramInfo::GetRecordingGroup
QString GetRecordingGroup(void) const
Definition: programinfo.h:419
ProgramInfo::GetRecordingPriority
int GetRecordingPriority(void) const
Definition: programinfo.h:440
V2Status::m_bIsMaster
bool m_bIsMaster
Definition: v2status.h:63
scheduler.h
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:14
MythCoreContext::GetMasterServerStatusPort
int GetMasterServerStatusPort(void)
Returns the Master Backend status port If no master server status port has been defined in the databa...
Definition: mythcorecontext.cpp:991
ProgramInfo::GetRecordingStartTime
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
Definition: programinfo.h:404
FillFrontendList
void FillFrontendList(QVariantList &list, QObject *parent, bool OnLine)
Definition: v2serviceUtil.cpp:831
MainServer::GetMediaServerByHostname
PlaybackSock * GetMediaServerByHostname(const QString &hostname)
Definition: mainserver.cpp:7992
mythsystemlegacy.h
kState_WatchingRecording
@ kState_WatchingRecording
Watching Recording is the state for when we are watching an in progress recording,...
Definition: tv.h:80
JobQueue::JobText
static QString JobText(int jobType)
Definition: jobqueue.cpp:1111
ProgramInfo::IsRepeat
bool IsRepeat(void) const
Definition: programinfo.h:487
RecStatus::WillRecord
@ WillRecord
Definition: recordingstatus.h:31
RecordingInfo::GetProgramRecordingProfile
QString GetProgramRecordingProfile(void) const
Returns recording profile name that will be, or was used, for this program, creating "record" field i...
Definition: recordinginfo.cpp:492
MythCoreContext::IsMasterBackend
bool IsMasterBackend(void)
is this the actual MBE process
Definition: mythcorecontext.cpp:693
V2MachineInfo
Definition: v2backendStatus.h:68
JobQueue::GetJobsInQueue
static int GetJobsInQueue(QMap< int, JobQueueEntry > &jobs, int findJobs=JOB_LIST_NOT_DONE)
Definition: jobqueue.cpp:1274
mythdate.h
autoexpire.h
upnp.h
V2BackendStatus
Definition: v2backendStatus.h:137
ProgramInfo::GetScheduledStartTime
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
Definition: programinfo.h:390
ProgramInfo::GetRecordingStatus
RecStatus::Type GetRecordingStatus(void) const
Definition: programinfo.h:447
v2serviceUtil.h
hardwareprofile.config.p
p
Definition: config.py:33
MythCoreContext::GetMasterServerIP
QString GetMasterServerIP(void)
Returns the Master Backend IP address If the address is an IPv6 address, the scope Id is removed.
Definition: mythcorecontext.cpp:964
FillEncoderList
void FillEncoderList(QVariantList &list, QObject *parent)
Definition: v2serviceUtil.cpp:698
ProgramInfo::GetTitle
QString GetTitle(void) const
Definition: programinfo.h:361
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:540
ProgramInfo::GetDescription
QString GetDescription(void) const
Definition: programinfo.h:365
compat.h
MythCoreContext::GetBackendServerIP
QString GetBackendServerIP(void)
Returns the IP address of the locally defined backend IP.
Definition: mythcorecontext.cpp:1002
STATUS_HANDLE
#define STATUS_HANDLE
Definition: v2status.h:35
V2MachineInfo::AddNewStorageGroup
V2StorageGroup * AddNewStorageGroup()
Definition: v2backendStatus.h:89
ProgramInfo::GetSourceID
uint GetSourceID(void) const
Definition: programinfo.h:462
EntryMap
QMap< QString, DeviceLocation * > EntryMap
Key == Unique Service Name (USN)
Definition: ssdpcache.h:29
MythSystemLegacy::Wait
uint Wait(std::chrono::seconds timeout=0s)
Definition: mythsystemlegacy.cpp:243
MythDate::kDateShort
@ kDateShort
Default local time.
Definition: mythdate.h:20
V2Status::PrintStatus
static void PrintStatus(QTextStream &os, QDomDocument *pDoc)
Definition: v2status.cpp:818
sStatus_Asleep
@ sStatus_Asleep
A slave is considered asleep when it is not awake and not undefined.
Definition: tv.h:104
loadArray
std::array< double, 3 > loadArray
Definition: mythmiscutil.h:22
ProgramInfo::GetPlaybackGroup
QString GetPlaybackGroup(void) const
Definition: programinfo.h:420
jobqueue.h
ProgramInfo::GetChannelPlaybackFilters
QString GetChannelPlaybackFilters(void) const
Definition: programinfo.h:387
V2Status::GetStatusHTML
Preformat * GetStatusHTML()
Definition: v2status.cpp:116
TVRec::s_inputsLock
static QReadWriteLock s_inputsLock
Definition: tv_rec.h:432
V2Status::m_nPreRollSeconds
int m_nPreRollSeconds
Definition: v2status.h:64
SSDPCacheEntries
Definition: ssdpcache.h:35
uint
unsigned int uint
Definition: compat.h:81
V2Status::GetStatus
Preformat * GetStatus()
Definition: v2status.cpp:100
gTVList
QMap< int, EncoderLink * > gTVList
Definition: backendcontext.cpp:7
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:54
ProgramInfo::GetSeriesID
QString GetSeriesID(void) const
Definition: programinfo.h:435
V2Status::RegisterCustomTypes
static void RegisterCustomTypes()
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:910
MythHTTPService
Definition: mythhttpservice.h:19
V2Status::PrintEncoderStatus
static int PrintEncoderStatus(QTextStream &os, const QDomElement &encoders)
Definition: v2status.cpp:905
PlaybackSock
Definition: playbacksock.h:27
ProgramInfo::GetOriginalAirDate
QDate GetOriginalAirDate(void) const
Definition: programinfo.h:428
V2Status::xml
Preformat * xml()
Definition: v2status.cpp:94
Q_GLOBAL_STATIC_WITH_ARGS
Q_GLOBAL_STATIC_WITH_ARGS(MythHTTPMetaService, s_service,(STATUS_HANDLE, V2Status::staticMetaObject, &V2Status::RegisterCustomTypes)) void V2Status
Definition: v2status.cpp:54
kMSRunShell
@ kMSRunShell
run process through shell
Definition: mythsystem.h:43
V2Status::m_pEncoders
QMap< int, EncoderLink * > * m_pEncoders
Definition: v2status.h:61
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:34
MythDate::kSimplify
@ kSimplify
Do Today/Yesterday/Tomorrow transform.
Definition: mythdate.h:26
MythCoreContext::GetBoolSetting
bool GetBoolSetting(const QString &key, bool defaultval=false)
Definition: mythcorecontext.cpp:904
ProgramInfo::GetDuplicateCheckMethod
RecordingDupMethodType GetDuplicateCheckMethod(void) const
What should be compared to determine if two programs are the same?
Definition: programinfo.h:459
ProgramInfo::GetInputID
uint GetInputID(void) const
Definition: programinfo.h:463
sStatus_Undefined
@ sStatus_Undefined
A slave's sleep status is undefined when it has never connected to the master backend or is not able ...
Definition: tv.h:117
ProgramInfo::GetChanID
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Definition: programinfo.h:372
V2Backend
Definition: v2backendStatus.h:23
ProgramInfo::GetRecordingRuleType
RecordingType GetRecordingRuleType(void) const
Definition: programinfo.h:451
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
setting_to_qdatetime
static QDateTime setting_to_qdatetime(const char *setting)
Definition: v2status.cpp:136
v2backendStatus.h
mythmiscutil.h
TVState
TVState
TVState is an enumeration of the states used by TV and TVRec.
Definition: tv.h:50
MythDate::kAddYear
@ kAddYear
Add year to string if not included.
Definition: mythdate.h:25
ProgramInfo::GetLastModifiedTime
QDateTime GetLastModifiedTime(void) const
Definition: programinfo.h:429
mythcorecontext.h
cardutil.h
ProgramInfo::GetCategoryTypeString
QString GetCategoryTypeString(void) const
Returns catType as a string.
Definition: programinfo.cpp:1887
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:883
MythDate::ISODate
@ ISODate
Default UTC.
Definition: mythdate.h:17
V2Job
Definition: v2backendStatus.h:103
V2Status::FillChannelInfo
static void FillChannelInfo(QDomElement &channel, ProgramInfo *pInfo, bool bDetails=true)
Definition: v2status.cpp:1797
RecList
std::deque< RecordingInfo * > RecList
Definition: mythscheduler.h:12
V2Status::PrintScheduled
static int PrintScheduled(QTextStream &os, const QDomElement &scheduled)
Definition: v2status.cpp:1049
V2Program
Definition: v2programAndChannel.h:105
tv_rec.h
kState_WatchingLiveTV
@ kState_WatchingLiveTV
Watching LiveTV is the state for when we are watching a recording and the user has control over the c...
Definition: tv.h:63
ProgramInfo::GetDuplicateCheckSource
RecordingDupInType GetDuplicateCheckSource(void) const
Where should we check for duplicates?
Definition: programinfo.h:455
mainserver.h
MythDate::kDatabase
@ kDatabase
Default UTC, database format.
Definition: mythdate.h:27
MythDate::kDateFull
@ kDateFull
Default local time.
Definition: mythdate.h:19
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:836
Scheduler::GetAllPending
bool GetAllPending(RecList &retList, int recRuleId=0) const
Definition: scheduler.cpp:1741
JOB_LIST_RECENT
@ JOB_LIST_RECENT
Definition: jobqueue.h:73
Preformat
Definition: preformat.h:19
ProgramInfo::GetProgramID
QString GetProgramID(void) const
Definition: programinfo.h:436
V2Status::PrintFrontends
static int PrintFrontends(QTextStream &os, const QDomElement &frontends)
Definition: v2status.cpp:1182
MythSystemLegacy::Run
void Run(std::chrono::seconds timeout=0s)
Runs a command inside the /bin/sh shell. Returns immediately.
Definition: mythsystemlegacy.cpp:213
MythCoreContext::IsMasterHost
bool IsMasterHost(void)
is this the same host as the master
Definition: mythcorecontext.cpp:657
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
V2Status::m_pMainServer
MainServer * m_pMainServer
Definition: v2status.h:62
MythDate::kDateTimeFull
@ kDateTimeFull
Default local time.
Definition: mythdate.h:23
PlaybackSock::getIP
QString getIP(void) const
Definition: playbacksock.h:60
V2StorageGroup
Definition: v2backendStatus.h:46
MythDate::kTime
@ kTime
Default local time.
Definition: mythdate.h:22
ProgramInfo::GetRecordingRuleID
uint GetRecordingRuleID(void) const
Definition: programinfo.h:449
exitcodes.h
JOB_LIST_ERROR
@ JOB_LIST_ERROR
Definition: jobqueue.h:72
UPnp::g_IPAddrList
static QList< QHostAddress > g_IPAddrList
Definition: upnp.h:110
MainServer::GetActiveBackends
void GetActiveBackends(QStringList &hosts)
Definition: mainserver.cpp:5083
V2Status::FillStatusXML
void FillStatusXML(QDomDocument *pDoc)
Definition: v2status.cpp:369
V2Status::V2Status
V2Status()
Definition: v2status.cpp:77
kMSStdOut
@ kMSStdOut
allow access to stdout
Definition: mythsystem.h:41
output
#define output
Definition: synaesthesia.cpp:220
kState_RecordingOnly
@ kState_RecordingOnly
Recording Only is a TVRec only state for when we are recording a program, but there is no one current...
Definition: tv.h:84
ProgramInfo::IsCommercialFree
bool IsCommercialFree(void) const
Definition: programinfo.h:477
PlaybackSock::setIP
void setIP(const QString &lip)
Definition: playbacksock.h:59
MythHTTPMetaService
Definition: mythhttpmetaservice.h:10
v2status.h
JobQueue::StatusText
static QString StatusText(int status)
Definition: jobqueue.cpp:1133
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:896
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:832
ProgramInfo::GetSubtitle
QString GetSubtitle(void) const
Definition: programinfo.h:363
ProgramInfo::GetStars
float GetStars(void) const
Definition: programinfo.h:442
V2Status::PrintMachineInfo
static int PrintMachineInfo(QTextStream &os, const QDomElement &info)
Definition: v2status.cpp:1402