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  m_pSched(dynamic_cast<Scheduler*>(gCoreContext->GetScheduler())),
79  m_pEncoders(&gTVList) // extern
80 {
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 : std::as_const(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->setLocalizedJobName( JobQueue::JobText((*it).type) );
228  pJob->setCmds( (*it).cmds );
229  pJob->setFlags( (*it).flags );
230  pJob->setStatus( (*it).status );
231  pJob->setLocalizedStatus( JobQueue::StatusText((*it).status) );
232  pJob->setStatusTime( (*it).statustime);
233  pJob->setSchedRunTime( (*it).schedruntime);
234  pJob->setArgs( (*it).args );
235  if ((*it).hostname.isEmpty())
236  pJob->setHostName( QObject::tr("master"));
237  else
238  pJob->setHostName((*it).hostname);
239  pJob->setComment((*it).comment);
240  V2Program *pProgram = pJob->Program();
241  V2FillProgramInfo( pProgram, &pginfo, true, false, false);
242  }
243 
244  // Machine Info
245  V2MachineInfo *pMachineInfo = pStatus->MachineInfo();
246  FillDriveSpace(pMachineInfo);
247  // load average
248  loadArray rgdAverages = getLoadAvgs();
249  if (rgdAverages[0] != -1)
250  {
251  pMachineInfo->setLoadAvg1(rgdAverages[0]);
252  pMachineInfo->setLoadAvg2(rgdAverages[1]);
253  pMachineInfo->setLoadAvg3(rgdAverages[2]);
254  }
255 
256  // Guide Data
257  QDateTime GuideDataThrough;
258  MSqlQuery query(MSqlQuery::InitCon());
259  query.prepare("SELECT MAX(endtime) FROM program WHERE manualid = 0;");
260  if (query.exec() && query.next())
261  {
262  GuideDataThrough = MythDate::fromString(query.value(0).toString());
263  }
264  pMachineInfo->setGuideStart
265  (setting_to_qdatetime("mythfilldatabaseLastRunStart"));
266  pMachineInfo->setGuideEnd(
267  setting_to_qdatetime("mythfilldatabaseLastRunEnd"));
268  pMachineInfo->setGuideStatus(
269  gCoreContext->GetSetting("mythfilldatabaseLastRunStatus"));
270  if (gCoreContext->GetBoolSetting("MythFillGrabberSuggestsTime", false))
271  {
272  pMachineInfo->setGuideNext(
273  gCoreContext->GetSetting("MythFillSuggestedRunTime"));
274  }
275 
276  if (!GuideDataThrough.isNull())
277  {
278  QDateTime qdtNow = MythDate::current();
279  pMachineInfo->setGuideThru(GuideDataThrough);
280  pMachineInfo->setGuideDays(qdtNow.daysTo(GuideDataThrough));
281  }
282 
283  // Add Miscellaneous information
284  QString info_script = gCoreContext->GetSetting("MiscStatusScript");
285  if ((!info_script.isEmpty()) && (info_script != "none"))
286  {
287  uint flags = kMSRunShell | kMSStdOut;
288  MythSystemLegacy ms(info_script, flags);
289  ms.Run(10s);
290  if (ms.Wait() != GENERIC_EXIT_OK)
291  {
292  LOG(VB_GENERAL, LOG_ERR,
293  QString("Error running miscellaneous "
294  "status information script: %1").arg(info_script));
295  }
296 
297  QByteArray input = ms.ReadAll();
298  pStatus->setMiscellaneous(QString(input));
299  }
300  return pStatus;
301 }
302 
304 {
305  QStringList strlist;
306  QString hostname;
307  QString directory;
308  QString isLocalstr;
309  QString fsID;
310 
311  if (m_pMainServer)
313 
314  QStringList::const_iterator sit = strlist.cbegin();
315  while (sit != strlist.cend())
316  {
317  hostname = *(sit++);
318  directory = *(sit++);
319  isLocalstr = *(sit++);
320  fsID = *(sit++);
321  ++sit; // ignore dirID
322  ++sit; // ignore blocksize
323  long long iTotal = (*(sit++)).toLongLong();
324  long long iUsed = (*(sit++)).toLongLong();;
325  long long iAvail = iTotal - iUsed;
326 
327  if (fsID == "-2")
328  fsID = "total";
329 
330  V2StorageGroup* group = pMachineInfo->AddNewStorageGroup();
331  group->setId(QString(fsID));
332  group->setTotal((int)(iTotal>>10));
333  group->setUsed((int)(iUsed>>10));
334  group->setFree((int)(iAvail>>10));
335  group->setDirectory(directory);
336 
337  if (fsID == "total")
338  {
339  long long iLiveTV = -1;
340  long long iDeleted = -1;
341  long long iExpirable = -1;
342  MSqlQuery query(MSqlQuery::InitCon());
343  query.prepare("SELECT SUM(filesize) FROM recorded "
344  " WHERE recgroup = :RECGROUP;");
345 
346  query.bindValue(":RECGROUP", "LiveTV");
347  if (query.exec() && query.next())
348  {
349  iLiveTV = query.value(0).toLongLong();
350  }
351  query.bindValue(":RECGROUP", "Deleted");
352  if (query.exec() && query.next())
353  {
354  iDeleted = query.value(0).toLongLong();
355  }
356  query.prepare("SELECT SUM(filesize) FROM recorded "
357  " WHERE autoexpire = 1 "
358  " AND recgroup NOT IN ('LiveTV', 'Deleted');");
359  if (query.exec() && query.next())
360  {
361  iExpirable = query.value(0).toLongLong();
362  }
363  group->setLiveTV( (int)(iLiveTV>>20) );
364  group->setDeleted( (int)(iDeleted>>20) );
365  group->setExpirable ( (int)(iExpirable>>20) );
366  }
367  }
368 
369 }
370 
371 void V2Status::FillStatusXML( QDomDocument *pDoc )
372 {
373  QDateTime qdtNow = MythDate::current();
374 
375  // Add Root Node.
376 
377  QDomElement root = pDoc->createElement("Status");
378  pDoc->appendChild(root);
379 
380  root.setAttribute("date" , MythDate::toString(
382  root.setAttribute("time" ,
384  root.setAttribute("ISODate" , qdtNow.toString(Qt::ISODate) );
385  root.setAttribute("version" , MYTH_BINARY_VERSION );
386  root.setAttribute("protoVer", MYTH_PROTO_VERSION );
387 
388  // Add all encoders, if any
389 
390  QDomElement encoders = pDoc->createElement("Encoders");
391  root.appendChild(encoders);
392 
393  int numencoders = 0;
394  bool isLocal = true;
395 
396  TVRec::s_inputsLock.lockForRead();
397 
398  for (auto * elink : std::as_const(*m_pEncoders))
399  {
400  if (elink != nullptr)
401  {
402  TVState state = elink->GetState();
403  isLocal = elink->IsLocal();
404 
405  QDomElement encoder = pDoc->createElement("Encoder");
406  encoders.appendChild(encoder);
407 
408  encoder.setAttribute("id" , elink->GetInputID() );
409  encoder.setAttribute("local" , static_cast<int>(isLocal));
410  encoder.setAttribute("connected" , static_cast<int>(elink->IsConnected()));
411  encoder.setAttribute("state" , state );
412  encoder.setAttribute("sleepstatus" , elink->GetSleepStatus() );
413  //encoder.setAttribute("lowOnFreeSpace", elink->isLowOnFreeSpace());
414 
415  if (isLocal)
416  encoder.setAttribute("hostname", gCoreContext->GetHostName());
417  else
418  encoder.setAttribute("hostname", elink->GetHostName());
419 
420  encoder.setAttribute("devlabel",
421  CardUtil::GetDeviceLabel(elink->GetInputID()) );
422 
423  if (elink->IsConnected())
424  numencoders++;
425 
426  switch (state)
427  {
431  {
432  ProgramInfo *pInfo = elink->GetRecording();
433 
434  if (pInfo)
435  {
436  FillProgramInfo(pDoc, encoder, pInfo);
437  delete pInfo;
438  }
439 
440  break;
441  }
442 
443  default:
444  break;
445  }
446  }
447  }
448 
449  TVRec::s_inputsLock.unlock();
450 
451  encoders.setAttribute("count", numencoders);
452 
453  // Add upcoming shows
454 
455  QDomElement scheduled = pDoc->createElement("Scheduled");
456  root.appendChild(scheduled);
457 
458  RecList recordingList;
459 
460  if (m_pSched)
461  m_pSched->GetAllPending(recordingList);
462 
463  unsigned int iNum = 10;
464  unsigned int iNumRecordings = 0;
465 
466  auto itProg = recordingList.begin();
467  for (; (itProg != recordingList.end()) && iNumRecordings < iNum; ++itProg)
468  {
469  if (((*itProg)->GetRecordingStatus() <= RecStatus::WillRecord) &&
470  ((*itProg)->GetRecordingStartTime() >=
472  {
473  iNumRecordings++;
474  FillProgramInfo(pDoc, scheduled, *itProg);
475  }
476  }
477 
478  while (!recordingList.empty())
479  {
480  ProgramInfo *pginfo = recordingList.back();
481  delete pginfo;
482  recordingList.pop_back();
483  }
484 
485  scheduled.setAttribute("count", iNumRecordings);
486 
487  // Add known frontends
488 
489  QDomElement frontends = pDoc->createElement("Frontends");
490  root.appendChild(frontends);
491 
493  "urn:schemas-mythtv-org:service:MythFrontend:1");
494  if (fes)
495  {
496  EntryMap map;
497  fes->GetEntryMap(map);
498  fes->DecrRef();
499  fes = nullptr;
500 
501  frontends.setAttribute( "count", map.size() );
502  for (const auto & entry : std::as_const(map))
503  {
504  QDomElement fe = pDoc->createElement("Frontend");
505  frontends.appendChild(fe);
506  QUrl url(entry->m_sLocation);
507  fe.setAttribute("name", url.host());
508  fe.setAttribute("url", url.toString(QUrl::RemovePath));
509  entry->DecrRef();
510  }
511  }
512 
513  // Other backends
514 
515  QDomElement backends = pDoc->createElement("Backends");
516  root.appendChild(backends);
517 
518  int numbes = 0;
520  {
521  numbes++;
522  QString masterhost = gCoreContext->GetMasterHostName();
523  QString masterip = gCoreContext->GetMasterServerIP();
524  int masterport = gCoreContext->GetMasterServerStatusPort();
525 
526  QDomElement mbe = pDoc->createElement("Backend");
527  backends.appendChild(mbe);
528  mbe.setAttribute("type", "Master");
529  mbe.setAttribute("name", masterhost);
530  mbe.setAttribute("url" , masterip + ":" + QString::number(masterport));
531  }
532 
534  "urn:schemas-mythtv-org:device:SlaveMediaServer:1");
535  if (sbes)
536  {
537 
538  QString ipaddress = QString();
539  if (!UPnp::g_IPAddrList.isEmpty())
540  ipaddress = UPnp::g_IPAddrList.at(0).toString();
541 
542  EntryMap map;
543  sbes->GetEntryMap(map);
544  sbes->DecrRef();
545  sbes = nullptr;
546 
547  for (const auto & entry : std::as_const(map))
548  {
549  QUrl url(entry->m_sLocation);
550  if (url.host() != ipaddress)
551  {
552  numbes++;
553  QDomElement mbe = pDoc->createElement("Backend");
554  backends.appendChild(mbe);
555  mbe.setAttribute("type", "Slave");
556  mbe.setAttribute("name", url.host());
557  mbe.setAttribute("url" , url.toString(QUrl::RemovePath));
558  }
559  entry->DecrRef();
560  }
561  }
562 
563  backends.setAttribute("count", numbes);
564 
565  // Add Job Queue Entries
566 
567  QDomElement queue = pDoc->createElement("JobQueue");
568  root.appendChild(queue);
569 
570  QMap<int, JobQueueEntry> jobs;
571  QMap<int, JobQueueEntry>::Iterator it;
572 
576 
577  for (it = jobs.begin(); it != jobs.end(); ++it)
578  {
579  ProgramInfo pginfo((*it).chanid, (*it).recstartts);
580  if (!pginfo.GetChanID())
581  continue;
582 
583  QDomElement job = pDoc->createElement("Job");
584  queue.appendChild(job);
585 
586  job.setAttribute("id" , (*it).id );
587  job.setAttribute("chanId" , (*it).chanid );
588  job.setAttribute("startTime" ,
589  (*it).recstartts.toString(Qt::ISODate));
590  job.setAttribute("startTs" , (*it).startts );
591  job.setAttribute("insertTime",
592  (*it).inserttime.toString(Qt::ISODate));
593  job.setAttribute("type" , (*it).type );
594  job.setAttribute("cmds" , (*it).cmds );
595  job.setAttribute("flags" , (*it).flags );
596  job.setAttribute("status" , (*it).status );
597  job.setAttribute("statusTime",
598  (*it).statustime.toString(Qt::ISODate));
599  job.setAttribute("schedTime" ,
600  (*it).schedruntime.toString(Qt::ISODate));
601  job.setAttribute("args" , (*it).args );
602 
603  if ((*it).hostname.isEmpty())
604  job.setAttribute("hostname", QObject::tr("master"));
605  else
606  job.setAttribute("hostname",(*it).hostname);
607 
608  QDomText textNode = pDoc->createTextNode((*it).comment);
609  job.appendChild(textNode);
610 
611  FillProgramInfo(pDoc, job, &pginfo);
612  }
613 
614  queue.setAttribute( "count", jobs.size() );
615 
616  // Add Machine information
617 
618  QDomElement mInfo = pDoc->createElement("MachineInfo");
619  QDomElement storage = pDoc->createElement("Storage" );
620  QDomElement load = pDoc->createElement("Load" );
621  QDomElement guide = pDoc->createElement("Guide" );
622 
623  root.appendChild (mInfo );
624  mInfo.appendChild(storage);
625  mInfo.appendChild(load );
626  mInfo.appendChild(guide );
627 
628  // drive space ---------------------
629 
630  QStringList strlist;
631  QString hostname;
632  QString directory;
633  QString isLocalstr;
634  QString fsID;
635 
636  if (m_pMainServer)
638 
639  QDomElement total;
640 
641  // Make a temporary list to hold the per-filesystem elements so that the
642  // total is always the first element.
643  QList<QDomElement> fsXML;
644  QStringList::const_iterator sit = strlist.cbegin();
645  while (sit != strlist.cend())
646  {
647  hostname = *(sit++);
648  directory = *(sit++);
649  isLocalstr = *(sit++);
650  fsID = *(sit++);
651  ++sit; // ignore dirID
652  ++sit; // ignore blocksize
653  long long iTotal = (*(sit++)).toLongLong();
654  long long iUsed = (*(sit++)).toLongLong();;
655  long long iAvail = iTotal - iUsed;
656 
657  if (fsID == "-2")
658  fsID = "total";
659 
660  QDomElement group = pDoc->createElement("Group");
661 
662  group.setAttribute("id" , fsID );
663  group.setAttribute("total", (int)(iTotal>>10) );
664  group.setAttribute("used" , (int)(iUsed>>10) );
665  group.setAttribute("free" , (int)(iAvail>>10) );
666  group.setAttribute("dir" , directory );
667 
668  if (fsID == "total")
669  {
670  long long iLiveTV = -1;
671  long long iDeleted = -1;
672  long long iExpirable = -1;
673  MSqlQuery query(MSqlQuery::InitCon());
674  query.prepare("SELECT SUM(filesize) FROM recorded "
675  " WHERE recgroup = :RECGROUP;");
676 
677  query.bindValue(":RECGROUP", "LiveTV");
678  if (query.exec() && query.next())
679  {
680  iLiveTV = query.value(0).toLongLong();
681  }
682  query.bindValue(":RECGROUP", "Deleted");
683  if (query.exec() && query.next())
684  {
685  iDeleted = query.value(0).toLongLong();
686  }
687  query.prepare("SELECT SUM(filesize) FROM recorded "
688  " WHERE autoexpire = 1 "
689  " AND recgroup NOT IN ('LiveTV', 'Deleted');");
690  if (query.exec() && query.next())
691  {
692  iExpirable = query.value(0).toLongLong();
693  }
694  group.setAttribute("livetv", (int)(iLiveTV>>20) );
695  group.setAttribute("deleted", (int)(iDeleted>>20) );
696  group.setAttribute("expirable", (int)(iExpirable>>20) );
697  total = group;
698  }
699  else
700  {
701  fsXML << group;
702  }
703  }
704 
705  storage.appendChild(total);
706  int num_elements = fsXML.size();
707  for (int fs_index = 0; fs_index < num_elements; fs_index++)
708  {
709  storage.appendChild(fsXML[fs_index]);
710  }
711 
712  // load average ---------------------
713 
714 #ifdef Q_OS_ANDROID
715  load.setAttribute("avg1", 0);
716  load.setAttribute("avg2", 1);
717  load.setAttribute("avg3", 2);
718 #else
719  loadArray rgdAverages = getLoadAvgs();
720  if (rgdAverages[0] != -1)
721  {
722  load.setAttribute("avg1", rgdAverages[0]);
723  load.setAttribute("avg2", rgdAverages[1]);
724  load.setAttribute("avg3", rgdAverages[2]);
725  }
726 #endif
727 
728  // Guide Data ---------------------
729 
730  QDateTime GuideDataThrough;
731 
732  MSqlQuery query(MSqlQuery::InitCon());
733  query.prepare("SELECT MAX(endtime) FROM program WHERE manualid = 0;");
734 
735  if (query.exec() && query.next())
736  {
737  GuideDataThrough = MythDate::fromString(query.value(0).toString());
738  }
739 
740  guide.setAttribute("start",
741  setting_to_localtime("mythfilldatabaseLastRunStart"));
742  guide.setAttribute("end",
743  setting_to_localtime("mythfilldatabaseLastRunEnd"));
744  guide.setAttribute("status",
745  gCoreContext->GetSetting("mythfilldatabaseLastRunStatus"));
746  if (gCoreContext->GetBoolSetting("MythFillGrabberSuggestsTime", false))
747  {
748  guide.setAttribute("next",
749  gCoreContext->GetSetting("MythFillSuggestedRunTime"));
750  }
751 
752  if (!GuideDataThrough.isNull())
753  {
754  guide.setAttribute("guideThru",
755  GuideDataThrough.toString(Qt::ISODate));
756  guide.setAttribute("guideDays", qdtNow.daysTo(GuideDataThrough));
757  }
758 
759  // Add Miscellaneous information
760 
761  QString info_script = gCoreContext->GetSetting("MiscStatusScript");
762  if ((!info_script.isEmpty()) && (info_script != "none"))
763  {
764  QDomElement misc = pDoc->createElement("Miscellaneous");
765  root.appendChild(misc);
766 
767  uint flags = kMSRunShell | kMSStdOut;
768  MythSystemLegacy ms(info_script, flags);
769  ms.Run(10s);
770  if (ms.Wait() != GENERIC_EXIT_OK)
771  {
772  LOG(VB_GENERAL, LOG_ERR,
773  QString("Error running miscellaneous "
774  "status information script: %1").arg(info_script));
775  return;
776  }
777 
778  QByteArray input = ms.ReadAll();
779 
780  QStringList output = QString(input).split('\n',
781  Qt::SkipEmptyParts);
782  for (const auto & line : std::as_const(output))
783  {
784  QDomElement info = pDoc->createElement("Information");
785 
786  QStringList list = line.split("[]:[]");
787  unsigned int size = list.size();
788  unsigned int hasAttributes = 0;
789 
790  if ((size > 0) && (!list[0].isEmpty()))
791  {
792  info.setAttribute("display", list[0]);
793  hasAttributes++;
794  }
795  if ((size > 1) && (!list[1].isEmpty()))
796  {
797  info.setAttribute("name", list[1]);
798  hasAttributes++;
799  }
800  if ((size > 2) && (!list[2].isEmpty()))
801  {
802  info.setAttribute("value", list[2]);
803  hasAttributes++;
804  }
805 
806  if (hasAttributes > 0)
807  misc.appendChild(info);
808  }
809  }
810 }
811 
813 //
815 
816 void V2Status::PrintStatus( QTextStream &os, QDomDocument *pDoc )
817 {
818 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
819  os.setCodec("UTF-8");
820 #else
821  os.setEncoding(QStringConverter::Utf8);
822 #endif
823 
824  QDateTime qdtNow = MythDate::current();
825 
826  QDomElement docElem = pDoc->documentElement();
827 
828  os << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
829  << "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n"
830  << "<html xmlns=\"http://www.w3.org/1999/xhtml\""
831  << " xml:lang=\"en\" lang=\"en\">\r\n"
832  << "<head>\r\n"
833  << " <meta http-equiv=\"Content-Type\""
834  << "content=\"text/html; charset=UTF-8\" />\r\n"
835  << " <link rel=\"stylesheet\" href=\"/css/Status.css\" type=\"text/css\">\r\n"
836  << " <title>MythTV Status - "
837  << docElem.attribute( "date", MythDate::toString(qdtNow, MythDate::kDateShort) )
838  << " "
839  << docElem.attribute( "time", MythDate::toString(qdtNow, MythDate::kTime) ) << " - "
840  << docElem.attribute( "version", MYTH_BINARY_VERSION ) << "</title>\r\n"
841  << "</head>\r\n"
842  << "<body bgcolor=\"#fff\">\r\n"
843  << "<div class=\"status\">\r\n"
844  << " <h1 class=\"status\">MythTV Status</h1>\r\n";
845 
846  // encoder information ---------------------
847 
848  QDomNode node = docElem.namedItem( "Encoders" );
849 
850  if (!node.isNull())
851  PrintEncoderStatus( os, node.toElement() );
852 
853  // upcoming shows --------------------------
854 
855  node = docElem.namedItem( "Scheduled" );
856 
857  if (!node.isNull())
858  PrintScheduled( os, node.toElement());
859 
860  // Frontends
861 
862  node = docElem.namedItem( "Frontends" );
863 
864  if (!node.isNull())
865  PrintFrontends (os, node.toElement());
866 
867  // Backends
868 
869  node = docElem.namedItem( "Backends" );
870 
871  if (!node.isNull())
872  PrintBackends (os, node.toElement());
873 
874  // Job Queue Entries -----------------------
875 
876  node = docElem.namedItem( "JobQueue" );
877 
878  if (!node.isNull())
879  PrintJobQueue( os, node.toElement());
880 
881  // Machine information ---------------------
882 
883  node = docElem.namedItem( "MachineInfo" );
884 
885  if (!node.isNull())
886  PrintMachineInfo( os, node.toElement());
887 
888  // Miscellaneous information ---------------
889 
890  node = docElem.namedItem( "Miscellaneous" );
891 
892  if (!node.isNull())
893  PrintMiscellaneousInfo( os, node.toElement());
894 
895  os << "\r\n</div>\r\n</body>\r\n</html>\r\n";
896 
897 }
898 
900 //
902 
903 int V2Status::PrintEncoderStatus( QTextStream &os, const QDomElement& encoders )
904 {
905  int nNumEncoders = 0;
906 
907  if (encoders.isNull())
908  return 0;
909 
910  os << " <div class=\"content\">\r\n"
911  << " <h2 class=\"status\">Encoder Status</h2>\r\n";
912 
913  QDomNode node = encoders.firstChild();
914 
915  while (!node.isNull())
916  {
917  QDomElement e = node.toElement();
918 
919  if (!e.isNull())
920  {
921  if (e.tagName() == "Encoder")
922  {
923  QString sIsLocal = (e.attribute( "local" , "remote" )== "1")
924  ? "local" : "remote";
925  QString sCardId = e.attribute( "id" , "0" );
926  QString sHostName = e.attribute( "hostname" , "Unknown");
927  bool bConnected= static_cast<bool>(e.attribute( "connected", "0" ).toInt());
928 
929  bool bIsLowOnFreeSpace=static_cast<bool>(e.attribute( "lowOnFreeSpace", "0").toInt());
930 
931  QString sDevlabel = e.attribute( "devlabel", "[ UNKNOWN ]");
932 
933  os << " Encoder " << sCardId << " " << sDevlabel
934  << " is " << sIsLocal << " on " << sHostName;
935 
936  if ((sIsLocal == "remote") && !bConnected)
937  {
938  SleepStatus sleepStatus =
939  (SleepStatus) e.attribute("sleepstatus",
940  QString::number(sStatus_Undefined)).toInt();
941 
942  if (sleepStatus == sStatus_Asleep)
943  os << " (currently asleep).<br />";
944  else
945  os << " (currently not connected).<br />";
946 
947  node = node.nextSibling();
948  continue;
949  }
950 
951  nNumEncoders++;
952 
953  TVState encState = (TVState) e.attribute( "state", "0").toInt();
954 
955  switch( encState )
956  {
958  os << " and is watching Live TV";
959  break;
960 
963  os << " and is recording";
964  break;
965 
966  default:
967  os << " and is not recording.";
968  break;
969  }
970 
971  // Display first Program Element listed under the encoder
972 
973  QDomNode tmpNode = e.namedItem( "Program" );
974 
975  if (!tmpNode.isNull())
976  {
977  QDomElement program = tmpNode.toElement();
978 
979  if (!program.isNull())
980  {
981  os << " '" << program.attribute( "title", "Unknown" ) << "'";
982 
983  // Get Channel information
984 
985  tmpNode = program.namedItem( "Channel" );
986 
987  if (!tmpNode.isNull())
988  {
989  QDomElement channel = tmpNode.toElement();
990 
991  if (!channel.isNull())
992  os << " on "
993  << channel.attribute( "callSign", "unknown" );
994  }
995 
996  // Get Recording Information (if any)
997 
998  tmpNode = program.namedItem( "Recording" );
999 
1000  if (!tmpNode.isNull())
1001  {
1002  QDomElement recording = tmpNode.toElement();
1003 
1004  if (!recording.isNull())
1005  {
1006  QDateTime endTs = MythDate::fromString(
1007  recording.attribute( "recEndTs", "" ));
1008 
1009  os << ". This recording ";
1010  if (endTs < MythDate::current())
1011  os << "was ";
1012  else
1013  os << "is ";
1014 
1015  os << "scheduled to end at "
1016  << MythDate::toString(endTs,
1017  MythDate::kTime);
1018  }
1019  }
1020  }
1021 
1022  os << ".";
1023  }
1024 
1025  if (bIsLowOnFreeSpace)
1026  {
1027  os << " <strong>WARNING</strong>:"
1028  << " This backend is low on free disk space!";
1029  }
1030 
1031  os << "<br />\r\n";
1032  }
1033  }
1034 
1035  node = node.nextSibling();
1036  }
1037 
1038  os << " </div>\r\n\r\n";
1039 
1040  return( nNumEncoders );
1041 }
1042 
1044 //
1046 
1047 int V2Status::PrintScheduled( QTextStream &os, const QDomElement& scheduled )
1048 {
1049  QDateTime qdtNow = MythDate::current();
1050 
1051  if (scheduled.isNull())
1052  return( 0 );
1053 
1054  int nNumRecordings= scheduled.attribute( "count", "0" ).toInt();
1055 
1056  os << " <div class=\"content\">\r\n"
1057  << " <h2 class=\"status\">Schedule</h2>\r\n";
1058 
1059  if (nNumRecordings == 0)
1060  {
1061  os << " There are no shows scheduled for recording.\r\n"
1062  << " </div>\r\n";
1063  return( 0 );
1064  }
1065 
1066  os << " The next " << nNumRecordings << " show" << (nNumRecordings == 1 ? "" : "s" )
1067  << " that " << (nNumRecordings == 1 ? "is" : "are")
1068  << " scheduled for recording:\r\n";
1069 
1070  os << " <div class=\"schedule\">\r\n";
1071 
1072  // Iterate through all scheduled programs
1073 
1074  QDomNode node = scheduled.firstChild();
1075 
1076  while (!node.isNull())
1077  {
1078  QDomElement e = node.toElement();
1079 
1080  if (!e.isNull())
1081  {
1082  QDomNode recNode = e.namedItem( "Recording" );
1083  QDomNode chanNode = e.namedItem( "Channel" );
1084 
1085  if ((e.tagName() == "Program") && !recNode.isNull() &&
1086  !chanNode.isNull())
1087  {
1088  QDomElement r = recNode.toElement();
1089  QDomElement c = chanNode.toElement();
1090 
1091  QString sTitle = e.attribute( "title" , "" );
1092  QString sSubTitle = e.attribute( "subTitle", "" );
1093  QDateTime airDate = MythDate::fromString( e.attribute( "airdate" ,"" ));
1094  QDateTime startTs = MythDate::fromString( e.attribute( "startTime" ,"" ));
1095  QDateTime endTs = MythDate::fromString( e.attribute( "endTime" ,"" ));
1096  QDateTime recStartTs = MythDate::fromString( r.attribute( "recStartTs","" ));
1097 // QDateTime recEndTs = MythDate::fromString( r.attribute( "recEndTs" ,"" ));
1098  int nPreRollSecs = r.attribute( "preRollSeconds", "0" ).toInt();
1099  int nEncoderId = r.attribute( "encoderId" , "0" ).toInt();
1100  QString sProfile = r.attribute( "recProfile" , "" );
1101  QString sChanName = c.attribute( "channelName" , "" );
1102  QString sDesc = "";
1103 
1104  QDomText text = e.firstChild().toText();
1105  if (!text.isNull())
1106  sDesc = text.nodeValue();
1107 
1108  // Build Time to recording start.
1109 
1110  int nTotalSecs = qdtNow.secsTo( recStartTs ) - nPreRollSecs;
1111 
1112  //since we're not displaying seconds
1113 
1114  nTotalSecs -= 60;
1115 
1116  int nTotalDays = nTotalSecs / 86400;
1117  int nTotalHours = (nTotalSecs / 3600)
1118  - (nTotalDays * 24);
1119  int nTotalMins = (nTotalSecs / 60) % 60;
1120 
1121  QString sTimeToStart = "in";
1122 
1123  sTimeToStart += QObject::tr(" %n day(s),", "", nTotalDays );
1124  sTimeToStart += QObject::tr(" %n hour(s) and", "", nTotalHours);
1125  sTimeToStart += QObject::tr(" %n minute(s)", "", nTotalMins);
1126 
1127  if ( nTotalHours == 0 && nTotalMins == 0)
1128  sTimeToStart = QObject::tr("within one minute", "Recording starting");
1129 
1130  if ( nTotalSecs < 0)
1131  sTimeToStart = QObject::tr("soon", "Recording starting");
1132 
1133  // Output HTML
1134 
1135  os << " <a href=\"#\">";
1136  os << MythDate::toString(recStartTs.addSecs(-nPreRollSecs),
1138  MythDate::kSimplify) << " "
1139  << MythDate::toString(recStartTs.addSecs(-nPreRollSecs),
1140  MythDate::kTime) << " - ";
1141 
1142  if (nEncoderId > 0)
1143  os << "Encoder " << nEncoderId << " - ";
1144 
1145  os << sChanName << " - " << sTitle << "<br />"
1146  << "<span><strong>" << sTitle << "</strong> ("
1147  << MythDate::toString(startTs, MythDate::kTime) << "-"
1148  << MythDate::toString(endTs, MythDate::kTime) << ")<br />";
1149 
1150  if ( !sSubTitle.isEmpty())
1151  os << "<em>" << sSubTitle << "</em><br /><br />";
1152 
1153  if ( airDate.isValid())
1154  {
1155  os << "Orig. Airdate: "
1158  << "<br /><br />";
1159  }
1160 
1161  os << sDesc << "<br /><br />"
1162  << "This recording will start " << sTimeToStart
1163  << " using encoder " << nEncoderId << " with the '"
1164  << sProfile << "' profile.</span></a><hr />\r\n";
1165  }
1166  }
1167 
1168  node = node.nextSibling();
1169  }
1170  os << " </div>\r\n";
1171  os << " </div>\r\n\r\n";
1172 
1173  return( nNumRecordings );
1174 }
1175 
1177 //
1179 
1180 int V2Status::PrintFrontends( QTextStream &os, const QDomElement& frontends )
1181 {
1182  if (frontends.isNull())
1183  return( 0 );
1184 
1185  int nNumFES= frontends.attribute( "count", "0" ).toInt();
1186 
1187  if (nNumFES < 1)
1188  return( 0 );
1189 
1190 
1191  os << " <div class=\"content\">\r\n"
1192  << " <h2 class=\"status\">Frontends</h2>\r\n";
1193 
1194  QDomNode node = frontends.firstChild();
1195  while (!node.isNull())
1196  {
1197  QDomElement e = node.toElement();
1198 
1199  if (!e.isNull())
1200  {
1201  QString name = e.attribute( "name" , "" );
1202  QString url = e.attribute( "url" , "" );
1203  os << name << "&nbsp(<a href=\"" << url << "\">Status page</a>)<br />";
1204  }
1205 
1206  node = node.nextSibling();
1207  }
1208 
1209  os << " </div>\r\n\r\n";
1210 
1211  return nNumFES;
1212 }
1213 
1215 //
1217 
1218 int V2Status::PrintBackends( QTextStream &os, const QDomElement& backends )
1219 {
1220  if (backends.isNull())
1221  return( 0 );
1222 
1223  int nNumBES= backends.attribute( "count", "0" ).toInt();
1224 
1225  if (nNumBES < 1)
1226  return( 0 );
1227 
1228 
1229  os << " <div class=\"content\">\r\n"
1230  << " <h2 class=\"status\">Other Backends</h2>\r\n";
1231 
1232  QDomNode node = backends.firstChild();
1233  while (!node.isNull())
1234  {
1235  QDomElement e = node.toElement();
1236 
1237  if (!e.isNull())
1238  {
1239  QString type = e.attribute( "type", "" );
1240  QString name = e.attribute( "name" , "" );
1241  QString url = e.attribute( "url" , "" );
1242  os << type << ": " << name << "&nbsp(<a href=\"" << url << "\">Status page</a>)<br />";
1243  }
1244 
1245  node = node.nextSibling();
1246  }
1247 
1248  os << " </div>\r\n\r\n";
1249 
1250  return nNumBES;
1251 }
1252 
1254 //
1256 
1257 int V2Status::PrintJobQueue( QTextStream &os, const QDomElement& jobs )
1258 {
1259  if (jobs.isNull())
1260  return( 0 );
1261 
1262  int nNumJobs= jobs.attribute( "count", "0" ).toInt();
1263 
1264  os << " <div class=\"content\">\r\n"
1265  << " <h2 class=\"status\">Job Queue</h2>\r\n";
1266 
1267  if (nNumJobs != 0)
1268  {
1269  QString statusColor;
1270  QString jobColor;
1271 
1272  os << " Jobs currently in Queue or recently ended:\r\n<br />"
1273  << " <div class=\"schedule\">\r\n";
1274 
1275 
1276  QDomNode node = jobs.firstChild();
1277 
1278  while (!node.isNull())
1279  {
1280  QDomElement e = node.toElement();
1281 
1282  if (!e.isNull())
1283  {
1284  QDomNode progNode = e.namedItem( "Program" );
1285 
1286  if ((e.tagName() == "Job") && !progNode.isNull() )
1287  {
1288  QDomElement p = progNode.toElement();
1289 
1290  QDomNode recNode = p.namedItem( "Recording" );
1291  QDomNode chanNode = p.namedItem( "Channel" );
1292 
1293  QDomElement r = recNode.toElement();
1294  QDomElement c = chanNode.toElement();
1295 
1296  int nType = e.attribute( "type" , "0" ).toInt();
1297  int nStatus = e.attribute( "status", "0" ).toInt();
1298 
1299  switch( nStatus )
1300  {
1301  case JOB_ABORTED:
1302  statusColor = " class=\"jobaborted\"";
1303  jobColor = "";
1304  break;
1305 
1306  case JOB_ERRORED:
1307  statusColor = " class=\"joberrored\"";
1308  jobColor = " class=\"joberrored\"";
1309  break;
1310 
1311  case JOB_FINISHED:
1312  statusColor = " class=\"jobfinished\"";
1313  jobColor = " class=\"jobfinished\"";
1314  break;
1315 
1316  case JOB_RUNNING:
1317  statusColor = " class=\"jobrunning\"";
1318  jobColor = " class=\"jobrunning\"";
1319  break;
1320 
1321  default:
1322  statusColor = " class=\"jobqueued\"";
1323  jobColor = " class=\"jobqueued\"";
1324  break;
1325  }
1326 
1327  QString sTitle = p.attribute( "title" , "" ); //.replace("\"", "&quot;");
1328  QString sSubTitle = p.attribute( "subTitle", "" );
1329  QDateTime startTs = MythDate::fromString( p.attribute( "startTime" ,"" ));
1330  QDateTime endTs = MythDate::fromString( p.attribute( "endTime" ,"" ));
1331  QDateTime recStartTs = MythDate::fromString( r.attribute( "recStartTs","" ));
1332  QDateTime statusTime = MythDate::fromString( e.attribute( "statusTime","" ));
1333  QDateTime schedRunTime = MythDate::fromString( e.attribute( "schedTime","" ));
1334  QString sHostname = e.attribute( "hostname", "master" );
1335  QString sComment = "";
1336 
1337  QDomText text = e.firstChild().toText();
1338  if (!text.isNull())
1339  sComment = text.nodeValue();
1340 
1341  os << "<a href=\"javascript:void(0)\">"
1342  << MythDate::toString(recStartTs, MythDate::kDateFull |
1344  << " - "
1345  << sTitle << " - <font" << jobColor << ">"
1346  << JobQueue::JobText( nType ) << "</font><br />"
1347  << "<span><strong>" << sTitle << "</strong> ("
1348  << MythDate::toString(startTs, MythDate::kTime) << "-"
1349  << MythDate::toString(endTs, MythDate::kTime) << ")<br />";
1350 
1351  if (!sSubTitle.isEmpty())
1352  os << "<em>" << sSubTitle << "</em><br /><br />";
1353 
1354  os << "Job: " << JobQueue::JobText( nType ) << "<br />";
1355 
1356  if (schedRunTime > MythDate::current())
1357  {
1358  os << "Scheduled Run Time: "
1359  << MythDate::toString(schedRunTime,
1362  << "<br />";
1363  }
1364 
1365  os << "Status: <font" << statusColor << ">"
1366  << JobQueue::StatusText( nStatus )
1367  << "</font><br />"
1368  << "Status Time: "
1369  << MythDate::toString(statusTime, MythDate::kDateFull |
1371  << "<br />";
1372 
1373  if ( nStatus != JOB_QUEUED)
1374  os << "Host: " << sHostname << "<br />";
1375 
1376  if (!sComment.isEmpty())
1377  os << "<br />Comments:<br />" << sComment << "<br />";
1378 
1379  os << "</span></a><hr />\r\n";
1380  }
1381  }
1382 
1383  node = node.nextSibling();
1384  }
1385  os << " </div>\r\n";
1386  }
1387  else
1388  {
1389  os << " Job Queue is currently empty.\r\n\r\n";
1390  }
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  {
1638  os << " There's <strong>no guide data</strong> available! "
1639  << "Have you run mythfilldatabase?";
1640  }
1641  }
1642  }
1643  os << "\r\n </div>\r\n";
1644 
1645  return( 1 );
1646 }
1647 
1648 int V2Status::PrintMiscellaneousInfo( QTextStream &os, const QDomElement& info )
1649 {
1650  if (info.isNull())
1651  return( 0 );
1652 
1653  // Miscellaneous information
1654 
1655  QDomNodeList nodes = info.elementsByTagName("Information");
1656  uint count = nodes.count();
1657  if (count > 0)
1658  {
1659  QString display;
1660  QString linebreak;
1661  //QString name, value;
1662  os << "<div class=\"content\">\r\n"
1663  << " <h2 class=\"status\">Miscellaneous</h2>\r\n";
1664  for (unsigned int i = 0; i < count; i++)
1665  {
1666  QDomNode node = nodes.item(i);
1667  if (node.isNull())
1668  continue;
1669 
1670  QDomElement e = node.toElement();
1671  if (e.isNull())
1672  continue;
1673 
1674  display = e.attribute("display", "");
1675  //name = e.attribute("name", "");
1676  //value = e.attribute("value", "");
1677 
1678  if (display.isEmpty())
1679  continue;
1680 
1681  // Only include HTML line break if display value doesn't already
1682  // contain breaks.
1683  if (display.contains("<p>", Qt::CaseInsensitive) ||
1684  display.contains("<br", Qt::CaseInsensitive))
1685  {
1686  // matches <BR> or <br /
1687  linebreak = "\r\n";
1688  }
1689  else
1690  {
1691  linebreak = "<br />\r\n";
1692  }
1693 
1694  os << " " << display << linebreak;
1695  }
1696  os << "</div>\r\n";
1697  }
1698 
1699  return( 1 );
1700 }
1701 
1702 void V2Status::FillProgramInfo(QDomDocument *pDoc,
1703  QDomNode &node,
1704  ProgramInfo *pInfo,
1705  bool bIncChannel /* = true */,
1706  bool bDetails /* = true */)
1707 {
1708  if ((pDoc == nullptr) || (pInfo == nullptr))
1709  return;
1710 
1711  // Build Program Element
1712 
1713  QDomElement program = pDoc->createElement( "Program" );
1714  node.appendChild( program );
1715 
1716  program.setAttribute( "startTime" ,
1718  program.setAttribute( "endTime" , pInfo->GetScheduledEndTime(MythDate::ISODate));
1719  program.setAttribute( "title" , pInfo->GetTitle() );
1720  program.setAttribute( "subTitle" , pInfo->GetSubtitle());
1721  program.setAttribute( "category" , pInfo->GetCategory());
1722  program.setAttribute( "catType" , pInfo->GetCategoryTypeString());
1723  program.setAttribute( "repeat" , static_cast<int>(pInfo->IsRepeat()));
1724 
1725  if (bDetails)
1726  {
1727 
1728  program.setAttribute( "seriesId" , pInfo->GetSeriesID() );
1729  program.setAttribute( "programId" , pInfo->GetProgramID() );
1730  program.setAttribute( "stars" , pInfo->GetStars() );
1731  program.setAttribute( "fileSize" ,
1732  QString::number( pInfo->GetFilesize() ));
1733  program.setAttribute( "lastModified",
1735  program.setAttribute( "programFlags", pInfo->GetProgramFlags() );
1736  program.setAttribute( "hostname" , pInfo->GetHostname() );
1737 
1738  if (pInfo->GetOriginalAirDate().isValid())
1739  program.setAttribute(
1740  "airdate", pInfo->GetOriginalAirDate().toString());
1741 
1742  QDomText textNode = pDoc->createTextNode( pInfo->GetDescription() );
1743  program.appendChild( textNode );
1744 
1745  }
1746 
1747  if ( bIncChannel )
1748  {
1749  // Build Channel Child Element
1750 
1751  QDomElement channel = pDoc->createElement( "Channel" );
1752  program.appendChild( channel );
1753 
1754  FillChannelInfo( channel, pInfo, bDetails );
1755  }
1756 
1757  // Build Recording Child Element
1758 
1759  if ( pInfo->GetRecordingStatus() != RecStatus::Unknown )
1760  {
1761  QDomElement recording = pDoc->createElement( "Recording" );
1762  program.appendChild( recording );
1763 
1764  recording.setAttribute( "recStatus" ,
1765  pInfo->GetRecordingStatus() );
1766  recording.setAttribute( "recPriority" ,
1767  pInfo->GetRecordingPriority() );
1768  recording.setAttribute( "recStartTs" ,
1770  recording.setAttribute( "recEndTs" ,
1772 
1773  if (bDetails)
1774  {
1775  recording.setAttribute( "recordId" ,
1776  pInfo->GetRecordingRuleID() );
1777  recording.setAttribute( "recGroup" ,
1778  pInfo->GetRecordingGroup() );
1779  recording.setAttribute( "playGroup" ,
1780  pInfo->GetPlaybackGroup() );
1781  recording.setAttribute( "recType" ,
1782  pInfo->GetRecordingRuleType() );
1783  recording.setAttribute( "dupInType" ,
1784  pInfo->GetDuplicateCheckSource() );
1785  recording.setAttribute( "dupMethod" ,
1786  pInfo->GetDuplicateCheckMethod() );
1787  recording.setAttribute( "encoderId" ,
1788  pInfo->GetInputID() );
1789  const RecordingInfo ri(*pInfo);
1790  recording.setAttribute( "recProfile" ,
1792  //recording.setAttribute( "preRollSeconds", m_nPreRollSeconds );
1793  }
1794  }
1795 }
1796 
1798 //
1800 
1801 void V2Status::FillChannelInfo( QDomElement &channel,
1802  ProgramInfo *pInfo,
1803  bool bDetails /* = true */ )
1804 {
1805  if (pInfo)
1806  {
1807 /*
1808  QString sHostName = gCoreContext->GetHostName();
1809  QString sPort = gCoreContext->GetSettingOnHost( "BackendStatusPort",
1810  sHostName);
1811  QString sIconURL = QString( "http://%1:%2/getChannelIcon?ChanId=%3" )
1812  .arg( sHostName )
1813  .arg( sPort )
1814  .arg( pInfo->chanid );
1815 */
1816 
1817  channel.setAttribute( "chanId" , pInfo->GetChanID() );
1818  channel.setAttribute( "chanNum" , pInfo->GetChanNum());
1819  channel.setAttribute( "callSign" , pInfo->GetChannelSchedulingID());
1820  //channel.setAttribute( "iconURL" , sIconURL );
1821  channel.setAttribute( "channelName", pInfo->GetChannelName());
1822 
1823  if (bDetails)
1824  {
1825  channel.setAttribute( "chanFilters",
1826  pInfo->GetChannelPlaybackFilters() );
1827  channel.setAttribute( "sourceId" , pInfo->GetSourceID() );
1828  channel.setAttribute( "inputId" , pInfo->GetInputID() );
1829  channel.setAttribute( "commFree" ,
1830  (pInfo->IsCommercialFree()) ? 1 : 0 );
1831  }
1832  }
1833 }
1834 
1835 
1836 
1837 
1838 // 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:812
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:127
Scheduler::GetMainServer
MainServer * GetMainServer()
Definition: scheduler.h:105
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:93
tv.h
V2Status::PrintMiscellaneousInfo
static int PrintMiscellaneousInfo(QTextStream &os, const QDomElement &info)
Definition: v2status.cpp:1648
MythCoreContext::GetMasterHostName
QString GetMasterHostName(void)
Definition: mythcorecontext.cpp:811
ProgramInfo::GetFilesize
virtual uint64_t GetFilesize(void) const
Definition: programinfo.cpp:6446
backendcontext.h
CardUtil::GetDeviceLabel
static QString GetDeviceLabel(const QString &inputtype, const QString &videodevice)
Definition: cardutil.cpp:2636
V2FillProgramInfo
void V2FillProgramInfo(V2Program *pProgram, ProgramInfo *pInfo, bool bIncChannel, bool bDetails, bool bIncCast, bool bIncArtwork, bool bIncRecording)
Definition: v2serviceUtil.cpp:40
JOB_LIST_NOT_DONE
@ JOB_LIST_NOT_DONE
Definition: jobqueue.h:69
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:422
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:1257
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:120
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:1702
ProgramInfo::GetChannelName
QString GetChannelName(void) const
This is the channel name in the local market, i.e.
Definition: programinfo.h:387
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:377
MainServer::BackendQueryDiskSpace
void BackendQueryDiskSpace(QStringList &strlist, bool consolidated, bool allHosts)
Definition: mainserver.cpp:5151
getLoadAvgs
loadArray getLoadAvgs(void)
Returns the system load averages.
Definition: mythmiscutil.cpp:175
SleepStatus
SleepStatus
SleepStatus is an enumeration of the awake/sleep status of a slave.
Definition: tv.h:100
V2Status::PrintBackends
static int PrintBackends(QTextStream &os, const QDomElement &backends)
Definition: v2status.cpp:1218
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:204
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:384
ProgramInfo::GetCategory
QString GetCategory(void) const
Definition: programinfo.h:370
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:618
V2Status::FillDriveSpace
void FillDriveSpace(V2MachineInfo *pMachineInfo)
Definition: v2status.cpp:303
ProgramInfo::GetScheduledEndTime
QDateTime GetScheduledEndTime(void) const
The scheduled end time of the program.
Definition: programinfo.h:398
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:85
V2Job::Program
QObject Program
Definition: v2backendStatus.h:124
ProgramInfo::GetRecordingEndTime
QDateTime GetRecordingEndTime(void) const
Approximate time the recording should have ended, did end, or is intended to end.
Definition: programinfo.h:413
ProgramInfo::GetProgramFlags
uint32_t GetProgramFlags(void) const
Definition: programinfo.h:474
ProgramInfo::GetRecordingGroup
QString GetRecordingGroup(void) const
Definition: programinfo.h:420
ProgramInfo::GetRecordingPriority
int GetRecordingPriority(void) const
Definition: programinfo.h:444
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:15
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:997
ProgramInfo::GetRecordingStartTime
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
Definition: programinfo.h:405
FillFrontendList
void FillFrontendList(QVariantList &list, QObject *parent, bool OnLine)
Definition: v2serviceUtil.cpp:943
MainServer::GetMediaServerByHostname
PlaybackSock * GetMediaServerByHostname(const QString &hostname)
Definition: mainserver.cpp:8000
mythsystemlegacy.h
JobQueue::JobText
static QString JobText(int jobType)
Definition: jobqueue.cpp:1111
ProgramInfo::IsRepeat
bool IsRepeat(void) const
Definition: programinfo.h:491
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:496
MythCoreContext::IsMasterBackend
bool IsMasterBackend(void)
is this the actual MBE process
Definition: mythcorecontext.cpp:699
V2MachineInfo
Definition: v2backendStatus.h:68
JobQueue::GetJobsInQueue
static int GetJobsInQueue(QMap< int, JobQueueEntry > &jobs, int findJobs=JOB_LIST_NOT_DONE)
Definition: jobqueue.cpp:1281
mythdate.h
autoexpire.h
upnp.h
V2BackendStatus
Definition: v2backendStatus.h:139
ProgramInfo::GetScheduledStartTime
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
Definition: programinfo.h:391
ProgramInfo::GetRecordingStatus
RecStatus::Type GetRecordingStatus(void) const
Definition: programinfo.h:451
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:970
FillEncoderList
void FillEncoderList(QVariantList &list, QObject *parent)
Definition: v2serviceUtil.cpp:767
GENERIC_EXIT_OK
@ GENERIC_EXIT_OK
Exited with no error.
Definition: exitcodes.h:13
ProgramInfo::GetTitle
QString GetTitle(void) const
Definition: programinfo.h:362
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:550
ProgramInfo::GetDescription
QString GetDescription(void) const
Definition: programinfo.h:366
compat.h
MythCoreContext::GetBackendServerIP
QString GetBackendServerIP(void)
Returns the IP address of the locally defined backend IP.
Definition: mythcorecontext.cpp:1008
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:466
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:816
sStatus_Asleep
@ sStatus_Asleep
A slave is considered asleep when it is not awake and not undefined.
Definition: tv.h:107
loadArray
std::array< double, 3 > loadArray
Definition: mythmiscutil.h:22
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:66
ProgramInfo::GetPlaybackGroup
QString GetPlaybackGroup(void) const
Definition: programinfo.h:421
jobqueue.h
ProgramInfo::GetChannelPlaybackFilters
QString GetChannelPlaybackFilters(void) const
Definition: programinfo.h:388
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
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:55
ProgramInfo::GetSeriesID
QString GetSeriesID(void) const
Definition: programinfo.h:439
V2Status::RegisterCustomTypes
static void RegisterCustomTypes()
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:916
MythHTTPService
Definition: mythhttpservice.h:19
V2Status::PrintEncoderStatus
static int PrintEncoderStatus(QTextStream &os, const QDomElement &encoders)
Definition: v2status.cpp:903
PlaybackSock
Definition: playbacksock.h:27
ProgramInfo::GetOriginalAirDate
QDate GetOriginalAirDate(void) const
Definition: programinfo.h:432
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
kState_WatchingRecording
@ kState_WatchingRecording
Watching Recording is the state for when we are watching an in progress recording,...
Definition: tv.h:83
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:39
JOB_LIST_RECENT
@ JOB_LIST_RECENT
Definition: jobqueue.h:71
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:910
ProgramInfo::GetDuplicateCheckMethod
RecordingDupMethodType GetDuplicateCheckMethod(void) const
What should be compared to determine if two programs are the same?
Definition: programinfo.h:463
ProgramInfo::GetInputID
uint GetInputID(void) const
Definition: programinfo.h:467
ProgramInfo::GetChanID
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
Definition: programinfo.h:373
V2Backend
Definition: v2backendStatus.h:23
ProgramInfo::GetRecordingRuleType
RecordingType GetRecordingRuleType(void) const
Definition: programinfo.h:455
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
MythDate::kAddYear
@ kAddYear
Add year to string if not included.
Definition: mythdate.h:25
ProgramInfo::GetLastModifiedTime
QDateTime GetLastModifiedTime(void) const
Definition: programinfo.h:433
mythcorecontext.h
cardutil.h
ProgramInfo::GetCategoryTypeString
QString GetCategoryTypeString(void) const
Returns catType as a string.
Definition: programinfo.cpp:1898
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:888
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:1801
RecList
std::deque< RecordingInfo * > RecList
Definition: mythscheduler.h:12
TVState
TVState
TVState is an enumeration of the states used by TV and TVRec.
Definition: tv.h:53
V2Status::PrintScheduled
static int PrintScheduled(QTextStream &os, const QDomElement &scheduled)
Definition: v2status.cpp:1047
V2Program
Definition: v2programAndChannel.h:107
tv_rec.h
ProgramInfo::GetDuplicateCheckSource
RecordingDupInType GetDuplicateCheckSource(void) const
Where should we check for duplicates?
Definition: programinfo.h:459
mainserver.h
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:87
MythDate::kDatabase
@ kDatabase
Default UTC, database format.
Definition: mythdate.h:27
MythDate::kDateFull
@ kDateFull
Default local time.
Definition: mythdate.h:19
JOB_LIST_ERROR
@ JOB_LIST_ERROR
Definition: jobqueue.h:70
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:842
Scheduler::GetAllPending
bool GetAllPending(RecList &retList, int recRuleId=0) const
Definition: scheduler.cpp:1745
Preformat
Definition: preformat.h:19
ProgramInfo::GetProgramID
QString GetProgramID(void) const
Definition: programinfo.h:440
azlyrics.info
dictionary info
Definition: azlyrics.py:7
V2Status::PrintFrontends
static int PrintFrontends(QTextStream &os, const QDomElement &frontends)
Definition: v2status.cpp:1180
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:663
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:453
exitcodes.h
UPnp::g_IPAddrList
static QList< QHostAddress > g_IPAddrList
Definition: upnp.h:110
MainServer::GetActiveBackends
void GetActiveBackends(QStringList &hosts)
Definition: mainserver.cpp:5061
V2Status::FillStatusXML
void FillStatusXML(QDomDocument *pDoc)
Definition: v2status.cpp:371
V2Status::V2Status
V2Status()
Definition: v2status.cpp:77
kMSStdOut
@ kMSStdOut
allow access to stdout
Definition: mythsystem.h:41
output
#define output
Definition: synaesthesia.cpp:223
ProgramInfo::IsCommercialFree
bool IsCommercialFree(void) const
Definition: programinfo.h:481
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:1134
uint
unsigned int uint
Definition: freesurround.h:24
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:902
FillUpcomingList
int FillUpcomingList(QVariantList &list, QObject *parent, int &nStartIndex, int &nCount, bool bShowAll, int nRecordId, int nRecStatus, const QString &Sort)
Definition: v2serviceUtil.cpp:830
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:837
ProgramInfo::GetSubtitle
QString GetSubtitle(void) const
Definition: programinfo.h:364
ProgramInfo::GetStars
float GetStars(void) const
Definition: programinfo.h:446
V2Status::PrintMachineInfo
static int PrintMachineInfo(QTextStream &os, const QDomElement &info)
Definition: v2status.cpp:1402