21 #if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
22 #include <QStringConverter>
24 #include <QTextStream>
29 #include "libmythbase/mythconfig.h"
35 #include "libmythbase/mythversion.h"
87 return QStringList(
"/Status" );
123 LOG(VB_GENERAL, LOG_ERR,
124 "HttpStatus::ProcessRequest() - Unexpected Exception");
136 QDomDocument doc(
"Status" );
139 QDomProcessingInstruction encoding =
140 doc.createProcessingInstruction(
"xml",
141 R
"(version="1.0" encoding="UTF-8")");
142 doc.appendChild(encoding);
147 pRequest->m_mapRespHeaders[ "Cache-Control" ] =
"no-cache=\"Ext\", max-age = 5000";
150 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
151 stream.setCodec(
"UTF-8");
153 stream.setEncoding(QStringConverter::Utf8);
155 stream << doc.toString();
165 pRequest->
m_mapRespHeaders[
"Cache-Control" ] =
"no-cache=\"Ext\", max-age = 5000";
167 QDomDocument doc(
"Status" );
188 QDomElement root = pDoc->createElement(
"Status");
189 pDoc->appendChild(root);
193 root.setAttribute(
"time" ,
195 root.setAttribute(
"ISODate" , qdtNow.toString(
Qt::ISODate) );
196 root.setAttribute(
"version" , MYTH_BINARY_VERSION );
197 root.setAttribute(
"protoVer", MYTH_PROTO_VERSION );
201 QDomElement encoders = pDoc->createElement(
"Encoders");
202 root.appendChild(encoders);
211 if (elink !=
nullptr)
213 TVState state = elink->GetState();
214 isLocal = elink->IsLocal();
216 QDomElement encoder = pDoc->createElement(
"Encoder");
217 encoders.appendChild(encoder);
219 encoder.setAttribute(
"id" , elink->GetInputID() );
220 encoder.setAttribute(
"local" ,
static_cast<int>(isLocal));
221 encoder.setAttribute(
"connected" ,
static_cast<int>(elink->IsConnected()));
222 encoder.setAttribute(
"state" , state );
223 encoder.setAttribute(
"sleepstatus" , elink->GetSleepStatus() );
229 encoder.setAttribute(
"hostname", elink->GetHostName());
231 encoder.setAttribute(
"devlabel",
234 if (elink->IsConnected())
262 encoders.setAttribute(
"count", numencoders);
266 QDomElement scheduled = pDoc->createElement(
"Scheduled");
267 root.appendChild(scheduled);
274 unsigned int iNum = 10;
275 unsigned int iNumRecordings = 0;
277 auto itProg = recordingList.begin();
278 for (; (itProg != recordingList.end()) && iNumRecordings < iNum; ++itProg)
281 ((*itProg)->GetRecordingStartTime() >=
289 while (!recordingList.empty())
293 recordingList.pop_back();
296 scheduled.setAttribute(
"count", iNumRecordings);
300 QDomElement frontends = pDoc->createElement(
"Frontends");
301 root.appendChild(frontends);
304 "urn:schemas-mythtv-org:service:MythFrontend:1");
312 frontends.setAttribute(
"count", map.size() );
313 for (
const auto & entry : std::as_const(map))
315 QDomElement fe = pDoc->createElement(
"Frontend");
316 frontends.appendChild(fe);
317 QUrl url(entry->m_sLocation);
318 fe.setAttribute(
"name", url.host());
319 fe.setAttribute(
"url", url.toString(QUrl::RemovePath));
326 QDomElement backends = pDoc->createElement(
"Backends");
327 root.appendChild(backends);
337 QDomElement mbe = pDoc->createElement(
"Backend");
338 backends.appendChild(mbe);
339 mbe.setAttribute(
"type",
"Master");
340 mbe.setAttribute(
"name", masterhost);
341 mbe.setAttribute(
"url" , masterip +
":" + QString::number(masterport));
345 "urn:schemas-mythtv-org:device:SlaveMediaServer:1");
349 QString ipaddress = QString();
358 for (
const auto & entry : std::as_const(map))
360 QUrl url(entry->m_sLocation);
361 if (url.host() != ipaddress)
364 QDomElement mbe = pDoc->createElement(
"Backend");
365 backends.appendChild(mbe);
366 mbe.setAttribute(
"type",
"Slave");
367 mbe.setAttribute(
"name", url.host());
368 mbe.setAttribute(
"url" , url.toString(QUrl::RemovePath));
374 backends.setAttribute(
"count", numbes);
378 QDomElement
jobqueue = pDoc->createElement(
"JobQueue");
381 QMap<int, JobQueueEntry> jobs;
382 QMap<int, JobQueueEntry>::Iterator it;
388 for (it = jobs.begin(); it != jobs.end(); ++it)
390 ProgramInfo pginfo((*it).chanid, (*it).recstartts);
394 QDomElement job = pDoc->createElement(
"Job");
397 job.setAttribute(
"id" , (*it).id );
398 job.setAttribute(
"chanId" , (*it).chanid );
399 job.setAttribute(
"startTime" ,
401 job.setAttribute(
"startTs" , (*it).startts );
402 job.setAttribute(
"insertTime",
404 job.setAttribute(
"type" , (*it).type );
405 job.setAttribute(
"cmds" , (*it).cmds );
406 job.setAttribute(
"flags" , (*it).flags );
407 job.setAttribute(
"status" , (*it).status );
408 job.setAttribute(
"statusTime",
410 job.setAttribute(
"schedTime" ,
412 job.setAttribute(
"args" , (*it).args );
414 if ((*it).hostname.isEmpty())
415 job.setAttribute(
"hostname", QObject::tr(
"master"));
417 job.setAttribute(
"hostname",(*it).hostname);
419 QDomText textNode = pDoc->createTextNode((*it).comment);
420 job.appendChild(textNode);
425 jobqueue.setAttribute(
"count", jobs.size() );
429 QDomElement mInfo = pDoc->createElement(
"MachineInfo");
430 QDomElement storage = pDoc->createElement(
"Storage" );
431 QDomElement load = pDoc->createElement(
"Load" );
432 QDomElement guide = pDoc->createElement(
"Guide" );
434 root.appendChild (mInfo );
435 mInfo.appendChild(storage);
436 mInfo.appendChild(load );
437 mInfo.appendChild(guide );
454 QList<QDomElement> fsXML;
455 QStringList::const_iterator sit = strlist.cbegin();
456 while (sit != strlist.cend())
459 directory = *(sit++);
460 isLocalstr = *(sit++);
464 long long iTotal = (*(sit++)).toLongLong();
465 long long iUsed = (*(sit++)).toLongLong();;
466 long long iAvail = iTotal - iUsed;
471 QDomElement group = pDoc->createElement(
"Group");
473 group.setAttribute(
"id" , fsID );
474 group.setAttribute(
"total", (
int)(iTotal>>10) );
475 group.setAttribute(
"used" , (
int)(iUsed>>10) );
476 group.setAttribute(
"free" , (
int)(iAvail>>10) );
477 group.setAttribute(
"dir" , directory );
481 long long iLiveTV = -1;
482 long long iDeleted = -1;
483 long long iExpirable = -1;
485 query.
prepare(
"SELECT SUM(filesize) FROM recorded "
486 " WHERE recgroup = :RECGROUP;");
491 iLiveTV = query.
value(0).toLongLong();
496 iDeleted = query.
value(0).toLongLong();
498 query.
prepare(
"SELECT SUM(filesize) FROM recorded "
499 " WHERE autoexpire = 1 "
500 " AND recgroup NOT IN ('LiveTV', 'Deleted');");
503 iExpirable = query.
value(0).toLongLong();
505 group.setAttribute(
"livetv", (
int)(iLiveTV>>20) );
506 group.setAttribute(
"deleted", (
int)(iDeleted>>20) );
507 group.setAttribute(
"expirable", (
int)(iExpirable>>20) );
514 storage.appendChild(total);
515 int num_elements = fsXML.size();
516 for (
int fs_index = 0; fs_index < num_elements; fs_index++)
518 storage.appendChild(fsXML[fs_index]);
524 load.setAttribute(
"avg1", 0);
525 load.setAttribute(
"avg2", 1);
526 load.setAttribute(
"avg3", 2);
529 if (rgdAverages[0] != -1)
531 load.setAttribute(
"avg1", rgdAverages[0]);
532 load.setAttribute(
"avg2", rgdAverages[1]);
533 load.setAttribute(
"avg3", rgdAverages[2]);
539 QDateTime GuideDataThrough;
542 query.
prepare(
"SELECT MAX(endtime) FROM program WHERE manualid = 0;");
549 guide.setAttribute(
"start",
551 guide.setAttribute(
"end",
553 guide.setAttribute(
"status",
557 guide.setAttribute(
"next",
561 if (!GuideDataThrough.isNull())
563 guide.setAttribute(
"guideThru",
565 guide.setAttribute(
"guideDays", qdtNow.daysTo(GuideDataThrough));
571 if ((!info_script.isEmpty()) && (info_script !=
"none"))
573 QDomElement misc = pDoc->createElement(
"Miscellaneous");
574 root.appendChild(misc);
581 LOG(VB_GENERAL, LOG_ERR,
582 QString(
"Error running miscellaneous "
583 "status information script: %1").arg(info_script));
587 QByteArray input = ms.
ReadAll();
589 QStringList
output = QString(input).split(
'\n',
591 for (
const auto & line : std::as_const(
output))
593 QDomElement info = pDoc->createElement(
"Information");
595 QStringList list = line.split(
"[]:[]");
596 unsigned int size = list.size();
597 unsigned int hasAttributes = 0;
599 if ((size > 0) && (!list[0].isEmpty()))
601 info.setAttribute(
"display", list[0]);
604 if ((size > 1) && (!list[1].isEmpty()))
606 info.setAttribute(
"name", list[1]);
609 if ((size > 2) && (!list[2].isEmpty()))
611 info.setAttribute(
"value", list[2]);
615 if (hasAttributes > 0)
616 misc.appendChild(info);
627 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
628 os.setCodec(
"UTF-8");
630 os.setEncoding(QStringConverter::Utf8);
635 QDomElement docElem = pDoc->documentElement();
637 os <<
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
638 <<
"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n"
639 <<
"<html xmlns=\"http://www.w3.org/1999/xhtml\""
640 <<
" xml:lang=\"en\" lang=\"en\">\r\n"
642 <<
" <meta http-equiv=\"Content-Type\""
643 <<
"content=\"text/html; charset=UTF-8\" />\r\n"
644 <<
" <link rel=\"stylesheet\" href=\"/css/Status.css\" type=\"text/css\">\r\n"
645 <<
" <title>MythTV Status - "
649 << docElem.attribute(
"version", MYTH_BINARY_VERSION ) <<
"</title>\r\n"
651 <<
"<body bgcolor=\"#fff\">\r\n"
652 <<
"<div class=\"status\">\r\n"
653 <<
" <h1 class=\"status\">MythTV Status</h1>\r\n";
657 QDomNode node = docElem.namedItem(
"Encoders" );
664 node = docElem.namedItem(
"Scheduled" );
671 node = docElem.namedItem(
"Frontends" );
678 node = docElem.namedItem(
"Backends" );
685 node = docElem.namedItem(
"JobQueue" );
692 node = docElem.namedItem(
"MachineInfo" );
699 node = docElem.namedItem(
"Miscellaneous" );
704 os <<
"\r\n</div>\r\n</body>\r\n</html>\r\n";
714 int nNumEncoders = 0;
716 if (encoders.isNull())
719 os <<
" <div class=\"content\">\r\n"
720 <<
" <h2 class=\"status\">Encoder Status</h2>\r\n";
722 QDomNode node = encoders.firstChild();
724 while (!node.isNull())
726 QDomElement e = node.toElement();
730 if (e.tagName() ==
"Encoder")
732 QString sIsLocal = (e.attribute(
"local" ,
"remote" )==
"1")
733 ?
"local" :
"remote";
734 QString sCardId = e.attribute(
"id" ,
"0" );
735 QString sHostName = e.attribute(
"hostname" ,
"Unknown");
736 bool bConnected=
static_cast<bool>(e.attribute(
"connected",
"0" ).toInt());
738 bool bIsLowOnFreeSpace=
static_cast<bool>(e.attribute(
"lowOnFreeSpace",
"0").toInt());
740 QString sDevlabel = e.attribute(
"devlabel",
"[ UNKNOWN ]");
742 os <<
" Encoder " << sCardId <<
" " << sDevlabel
743 <<
" is " << sIsLocal <<
" on " << sHostName;
745 if ((sIsLocal ==
"remote") && !bConnected)
752 os <<
" (currently asleep).<br />";
754 os <<
" (currently not connected).<br />";
756 node = node.nextSibling();
767 os <<
" and is watching Live TV";
772 os <<
" and is recording";
776 os <<
" and is not recording.";
782 QDomNode tmpNode = e.namedItem(
"Program" );
784 if (!tmpNode.isNull())
786 QDomElement program = tmpNode.toElement();
788 if (!program.isNull())
790 os <<
" '" << program.attribute(
"title",
"Unknown" ) <<
"'";
794 tmpNode = program.namedItem(
"Channel" );
796 if (!tmpNode.isNull())
798 QDomElement channel = tmpNode.toElement();
800 if (!channel.isNull())
802 << channel.attribute(
"callSign",
"unknown" );
807 tmpNode = program.namedItem(
"Recording" );
809 if (!tmpNode.isNull())
811 QDomElement recording = tmpNode.toElement();
813 if (!recording.isNull())
816 recording.attribute(
"recEndTs",
"" ));
818 os <<
". This recording ";
824 os <<
"scheduled to end at "
834 if (bIsLowOnFreeSpace)
836 os <<
" <strong>WARNING</strong>:"
837 <<
" This backend is low on free disk space!";
844 node = node.nextSibling();
847 os <<
" </div>\r\n\r\n";
849 return( nNumEncoders );
860 if (scheduled.isNull())
863 int nNumRecordings= scheduled.attribute(
"count",
"0" ).toInt();
865 os <<
" <div class=\"content\">\r\n"
866 <<
" <h2 class=\"status\">Schedule</h2>\r\n";
868 if (nNumRecordings == 0)
870 os <<
" There are no shows scheduled for recording.\r\n"
875 os <<
" The next " << nNumRecordings <<
" show" << (nNumRecordings == 1 ?
"" :
"s" )
876 <<
" that " << (nNumRecordings == 1 ?
"is" :
"are")
877 <<
" scheduled for recording:\r\n";
879 os <<
" <div class=\"schedule\">\r\n";
883 QDomNode node = scheduled.firstChild();
885 while (!node.isNull())
887 QDomElement e = node.toElement();
891 QDomNode recNode = e.namedItem(
"Recording" );
892 QDomNode chanNode = e.namedItem(
"Channel" );
894 if ((e.tagName() ==
"Program") && !recNode.isNull() &&
897 QDomElement r = recNode.toElement();
898 QDomElement c = chanNode.toElement();
900 QString sTitle = e.attribute(
"title" ,
"" );
901 QString sSubTitle = e.attribute(
"subTitle",
"" );
907 int nPreRollSecs = r.attribute(
"preRollSeconds",
"0" ).toInt();
908 int nEncoderId = r.attribute(
"encoderId" ,
"0" ).toInt();
909 QString sProfile = r.attribute(
"recProfile" ,
"" );
910 QString sChanName = c.attribute(
"channelName" ,
"" );
913 QDomText text = e.firstChild().toText();
915 sDesc = text.nodeValue();
919 int nTotalSecs = qdtNow.secsTo( recStartTs ) - nPreRollSecs;
925 int nTotalDays = nTotalSecs / 86400;
926 int nTotalHours = (nTotalSecs / 3600)
928 int nTotalMins = (nTotalSecs / 60) % 60;
930 QString sTimeToStart =
"in";
932 sTimeToStart += QObject::tr(
" %n day(s),",
"", nTotalDays );
933 sTimeToStart += QObject::tr(
" %n hour(s) and",
"", nTotalHours);
934 sTimeToStart += QObject::tr(
" %n minute(s)",
"", nTotalMins);
936 if ( nTotalHours == 0 && nTotalMins == 0)
937 sTimeToStart = QObject::tr(
"within one minute",
"Recording starting");
940 sTimeToStart = QObject::tr(
"soon",
"Recording starting");
944 os <<
" <a href=\"#\">";
952 os <<
"Encoder " << nEncoderId <<
" - ";
954 os << sChanName <<
" - " << sTitle <<
"<br />"
955 <<
"<span><strong>" << sTitle <<
"</strong> ("
959 if ( !sSubTitle.isEmpty())
960 os <<
"<em>" << sSubTitle <<
"</em><br /><br />";
962 if ( airDate.isValid())
964 os <<
"Orig. Airdate: "
970 os << sDesc <<
"<br /><br />"
971 <<
"This recording will start " << sTimeToStart
972 <<
" using encoder " << nEncoderId <<
" with the '"
973 << sProfile <<
"' profile.</span></a><hr />\r\n";
977 node = node.nextSibling();
980 os <<
" </div>\r\n\r\n";
982 return( nNumRecordings );
991 if (frontends.isNull())
994 int nNumFES= frontends.attribute(
"count",
"0" ).toInt();
1000 os <<
" <div class=\"content\">\r\n"
1001 <<
" <h2 class=\"status\">Frontends</h2>\r\n";
1003 QDomNode node = frontends.firstChild();
1004 while (!node.isNull())
1006 QDomElement e = node.toElement();
1010 QString name = e.attribute(
"name" ,
"" );
1011 QString url = e.attribute(
"url" ,
"" );
1012 os << name <<
" (<a href=\"" << url <<
"\">Status page</a>)<br />";
1015 node = node.nextSibling();
1018 os <<
" </div>\r\n\r\n";
1029 if (backends.isNull())
1032 int nNumBES= backends.attribute(
"count",
"0" ).toInt();
1038 os <<
" <div class=\"content\">\r\n"
1039 <<
" <h2 class=\"status\">Other Backends</h2>\r\n";
1041 QDomNode node = backends.firstChild();
1042 while (!node.isNull())
1044 QDomElement e = node.toElement();
1048 QString
type = e.attribute(
"type",
"" );
1049 QString name = e.attribute(
"name" ,
"" );
1050 QString url = e.attribute(
"url" ,
"" );
1051 os <<
type <<
": " << name <<
" (<a href=\"" << url <<
"\">Status page</a>)<br />";
1054 node = node.nextSibling();
1057 os <<
" </div>\r\n\r\n";
1071 int nNumJobs= jobs.attribute(
"count",
"0" ).toInt();
1073 os <<
" <div class=\"content\">\r\n"
1074 <<
" <h2 class=\"status\">Job Queue</h2>\r\n";
1078 QString statusColor;
1081 os <<
" Jobs currently in Queue or recently ended:\r\n<br />"
1082 <<
" <div class=\"schedule\">\r\n";
1085 QDomNode node = jobs.firstChild();
1087 while (!node.isNull())
1089 QDomElement e = node.toElement();
1093 QDomNode progNode = e.namedItem(
"Program" );
1095 if ((e.tagName() ==
"Job") && !progNode.isNull() )
1097 QDomElement
p = progNode.toElement();
1099 QDomNode recNode =
p.namedItem(
"Recording" );
1100 QDomNode chanNode =
p.namedItem(
"Channel" );
1102 QDomElement r = recNode.toElement();
1103 QDomElement c = chanNode.toElement();
1105 int nType = e.attribute(
"type" ,
"0" ).toInt();
1106 int nStatus = e.attribute(
"status",
"0" ).toInt();
1111 statusColor =
" class=\"jobaborted\"";
1116 statusColor =
" class=\"joberrored\"";
1117 jobColor =
" class=\"joberrored\"";
1121 statusColor =
" class=\"jobfinished\"";
1122 jobColor =
" class=\"jobfinished\"";
1126 statusColor =
" class=\"jobrunning\"";
1127 jobColor =
" class=\"jobrunning\"";
1131 statusColor =
" class=\"jobqueued\"";
1132 jobColor =
" class=\"jobqueued\"";
1136 QString sTitle =
p.attribute(
"title" ,
"" );
1137 QString sSubTitle =
p.attribute(
"subTitle",
"" );
1143 QString sHostname = e.attribute(
"hostname",
"master" );
1144 QString sComment =
"";
1146 QDomText text = e.firstChild().toText();
1148 sComment = text.nodeValue();
1150 os <<
"<a href=\"javascript:void(0)\">"
1154 << sTitle <<
" - <font" << jobColor <<
">"
1156 <<
"<span><strong>" << sTitle <<
"</strong> ("
1160 if (!sSubTitle.isEmpty())
1161 os <<
"<em>" << sSubTitle <<
"</em><br /><br />";
1167 os <<
"Scheduled Run Time: "
1174 os <<
"Status: <font" << statusColor <<
">"
1182 if ( nStatus != JOB_QUEUED)
1183 os <<
"Host: " << sHostname <<
"<br />";
1185 if (!sComment.isEmpty())
1186 os <<
"<br />Comments:<br />" << sComment <<
"<br />";
1188 os <<
"</span></a><hr />\r\n";
1192 node = node.nextSibling();
1194 os <<
" </div>\r\n";
1197 os <<
" Job Queue is currently empty.\r\n\r\n";
1199 os <<
" </div>\r\n\r\n ";
1216 os <<
"<div class=\"content\">\r\n"
1217 <<
" <h2 class=\"status\">Machine Information</h2>\r\n";
1221 QDomNode node = info.namedItem(
"Load" );
1225 QDomElement e = node.toElement();
1229 double dAvg1 = e.attribute(
"avg1" ,
"0" ).toDouble();
1230 double dAvg2 = e.attribute(
"avg2" ,
"0" ).toDouble();
1231 double dAvg3 = e.attribute(
"avg3" ,
"0" ).toDouble();
1233 os <<
" <div class=\"loadstatus\">\r\n"
1234 <<
" This machine's load average:"
1235 <<
"\r\n <ul>\r\n <li>"
1236 <<
"1 Minute: " << dAvg1 <<
"</li>\r\n"
1237 <<
" <li>5 Minutes: " << dAvg2 <<
"</li>\r\n"
1238 <<
" <li>15 Minutes: " << dAvg3
1239 <<
"</li>\r\n </ul>\r\n"
1245 node = info.namedItem(
"Storage" );
1246 QDomElement storage = node.toElement();
1247 node = storage.firstChild();
1252 while (!node.isNull())
1254 QDomElement g = node.toElement();
1256 if (!g.isNull() && g.tagName() ==
"Group")
1258 QString
id = g.attribute(
"id",
"" );
1262 int nFree = g.attribute(
"free" ,
"0" ).toInt();
1263 int nTotal = g.attribute(
"total",
"0" ).toInt();
1264 int nUsed = g.attribute(
"used" ,
"0" ).toInt();
1265 int nLiveTV = g.attribute(
"livetv" ,
"0" ).toInt();
1266 int nDeleted = g.attribute(
"deleted",
"0" ).toInt();
1267 int nExpirable = g.attribute(
"expirable" ,
"0" ).toInt();
1268 QString nDir = g.attribute(
"dir" ,
"" );
1270 nDir.replace(
",",
", ");
1272 os <<
" Disk Usage Summary:<br />\r\n";
1275 os <<
" <li>Total Disk Space:\r\n"
1278 os <<
" <li>Total Space: ";
1279 sRep = QString(
"%L1").arg(nTotal) +
" MB";
1280 os << sRep <<
"</li>\r\n";
1282 os <<
" <li>Space Used: ";
1283 sRep = QString(
"%L1").arg(nUsed) +
" MB";
1284 os << sRep <<
"</li>\r\n";
1286 os <<
" <li>Space Free: ";
1287 sRep = QString(
"%L1").arg(nFree) +
" MB";
1288 os << sRep <<
"</li>\r\n";
1290 if ((nLiveTV + nDeleted + nExpirable) > 0)
1292 os <<
" <li>Space Available "
1293 "After Auto-expire: ";
1294 sRep = QString(
"%L1").arg(nUsed) +
" MB";
1295 sRep = QString(
"%L1").arg(nFree + nLiveTV +
1296 nDeleted + nExpirable) +
" MB";
1297 os << sRep <<
"\r\n";
1299 os <<
" <li>Space Used by LiveTV: ";
1300 sRep = QString(
"%L1").arg(nLiveTV) +
" MB";
1301 os << sRep <<
"</li>\r\n";
1302 os <<
" <li>Space Used by "
1303 "Deleted Recordings: ";
1304 sRep = QString(
"%L1").arg(nDeleted) +
" MB";
1305 os << sRep <<
"</li>\r\n";
1306 os <<
" <li>Space Used by "
1307 "Auto-expirable Recordings: ";
1308 sRep = QString(
"%L1").arg(nExpirable) +
" MB";
1309 os << sRep <<
"</li>\r\n";
1322 node = node.nextSibling();
1326 node = storage.firstChild();
1328 os <<
" Disk Usage Details:<br />\r\n";
1332 while (!node.isNull())
1334 QDomElement g = node.toElement();
1336 if (!g.isNull() && g.tagName() ==
"Group")
1338 int nFree = g.attribute(
"free" ,
"0" ).toInt();
1339 int nTotal = g.attribute(
"total",
"0" ).toInt();
1340 int nUsed = g.attribute(
"used" ,
"0" ).toInt();
1341 QString nDir = g.attribute(
"dir" ,
"" );
1342 QString
id = g.attribute(
"id" ,
"" );
1344 nDir.replace(
",",
", ");
1350 os <<
" <li>MythTV Drive #" <<
id <<
":"
1354 if (nDir.contains(
','))
1355 os <<
" <li>Directories: ";
1357 os <<
" <li>Directory: ";
1359 os << nDir <<
"</li>\r\n";
1361 os <<
" <li>Total Space: ";
1362 sRep = QString(
"%L1").arg(nTotal) +
" MB";
1363 os << sRep <<
"</li>\r\n";
1365 os <<
" <li>Space Used: ";
1366 sRep = QString(
"%L1").arg(nUsed) +
" MB";
1367 os << sRep <<
"</li>\r\n";
1369 os <<
" <li>Space Free: ";
1370 sRep = QString(
"%L1").arg(nFree) +
" MB";
1371 os << sRep <<
"</li>\r\n";
1379 node = node.nextSibling();
1386 node = info.namedItem(
"Guide" );
1390 QDomElement e = node.toElement();
1394 int nDays = e.attribute(
"guideDays",
"0" ).toInt();
1395 QString sStart = e.attribute(
"start" ,
"" );
1396 QString sEnd = e.attribute(
"end" ,
"" );
1397 QString sStatus = e.attribute(
"status" ,
"" );
1399 QString sNext = next.isNull() ?
"" :
1405 QDomText text = e.firstChild().toText();
1412 sMsg = text.nodeValue();
1414 os <<
" Last mythfilldatabase run started on " << sStart
1420 os <<
"ended on " << sEnd <<
". ";
1422 os << sStatus <<
"<br />\r\n";
1424 if (!next.isNull() && next >= lastrunstart)
1426 os <<
" Suggested next mythfilldatabase run: "
1427 << sNext <<
".<br />\r\n";
1432 os <<
" There's guide data until "
1436 os <<
" " << QObject::tr(
"(%n day(s))",
"", nDays);
1441 os <<
" <strong>WARNING</strong>: is mythfilldatabase running?";
1444 os <<
" There's <strong>no guide data</strong> available! "
1445 <<
"Have you run mythfilldatabase?";
1448 os <<
"\r\n </div>\r\n";
1460 QDomNodeList nodes = info.elementsByTagName(
"Information");
1461 uint count = nodes.count();
1467 os <<
"<div class=\"content\">\r\n"
1468 <<
" <h2 class=\"status\">Miscellaneous</h2>\r\n";
1469 for (
unsigned int i = 0; i < count; i++)
1471 QDomNode node = nodes.item(i);
1475 QDomElement e = node.toElement();
1479 display = e.attribute(
"display",
"");
1483 if (display.isEmpty())
1488 if (display.contains(
"<p>", Qt::CaseInsensitive) ||
1489 display.contains(
"<br", Qt::CaseInsensitive))
1495 linebreak =
"<br />\r\n";
1497 os <<
" " << display << linebreak;
1511 if ((pDoc ==
nullptr) || (pInfo ==
nullptr))
1516 QDomElement program = pDoc->createElement(
"Program" );
1517 node.appendChild( program );
1519 program.setAttribute(
"startTime" ,
1522 program.setAttribute(
"title" , pInfo->
GetTitle() );
1523 program.setAttribute(
"subTitle" , pInfo->
GetSubtitle());
1524 program.setAttribute(
"category" , pInfo->
GetCategory());
1526 program.setAttribute(
"repeat" ,
static_cast<int>(pInfo->
IsRepeat()));
1531 program.setAttribute(
"seriesId" , pInfo->
GetSeriesID() );
1532 program.setAttribute(
"programId" , pInfo->
GetProgramID() );
1533 program.setAttribute(
"stars" , pInfo->
GetStars() );
1534 program.setAttribute(
"fileSize" ,
1536 program.setAttribute(
"lastModified",
1539 program.setAttribute(
"hostname" , pInfo->
GetHostname() );
1542 program.setAttribute(
1545 QDomText textNode = pDoc->createTextNode( pInfo->
GetDescription() );
1546 program.appendChild( textNode );
1554 QDomElement channel = pDoc->createElement(
"Channel" );
1555 program.appendChild( channel );
1564 QDomElement recording = pDoc->createElement(
"Recording" );
1565 program.appendChild( recording );
1567 recording.setAttribute(
"recStatus" ,
1569 recording.setAttribute(
"recPriority" ,
1571 recording.setAttribute(
"recStartTs" ,
1573 recording.setAttribute(
"recEndTs" ,
1578 recording.setAttribute(
"recordId" ,
1580 recording.setAttribute(
"recGroup" ,
1582 recording.setAttribute(
"playGroup" ,
1584 recording.setAttribute(
"recType" ,
1586 recording.setAttribute(
"dupInType" ,
1588 recording.setAttribute(
"dupMethod" ,
1590 recording.setAttribute(
"encoderId" ,
1593 recording.setAttribute(
"recProfile" ,
1620 channel.setAttribute(
"chanId" , pInfo->
GetChanID() );
1621 channel.setAttribute(
"chanNum" , pInfo->
GetChanNum());
1628 channel.setAttribute(
"chanFilters",
1630 channel.setAttribute(
"sourceId" , pInfo->
GetSourceID() );
1631 channel.setAttribute(
"inputId" , pInfo->
GetInputID() );
1632 channel.setAttribute(
"commFree" ,