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"
58 m_bIsMaster(bIsMaster)
83 return QStringList(
"/Status" );
119 LOG(VB_GENERAL, LOG_ERR,
120 "HttpStatus::ProcessRequest() - Unexpected Exception");
132 QDomDocument doc(
"Status" );
135 QDomProcessingInstruction encoding =
136 doc.createProcessingInstruction(
"xml",
137 R
"(version="1.0" encoding="UTF-8")");
138 doc.appendChild(encoding);
143 pRequest->m_mapRespHeaders[ "Cache-Control" ] =
"no-cache=\"Ext\", max-age = 5000";
146 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
147 stream.setCodec(
"UTF-8");
149 stream.setEncoding(QStringConverter::Utf8);
151 stream << doc.toString();
161 pRequest->
m_mapRespHeaders[
"Cache-Control" ] =
"no-cache=\"Ext\", max-age = 5000";
163 QDomDocument doc(
"Status" );
184 QDomElement root = pDoc->createElement(
"Status");
185 pDoc->appendChild(root);
189 root.setAttribute(
"time" ,
191 root.setAttribute(
"ISODate" , qdtNow.toString(
Qt::ISODate) );
192 root.setAttribute(
"version" , MYTH_BINARY_VERSION );
193 root.setAttribute(
"protoVer", MYTH_PROTO_VERSION );
197 QDomElement encoders = pDoc->createElement(
"Encoders");
198 root.appendChild(encoders);
207 if (elink !=
nullptr)
209 TVState state = elink->GetState();
210 isLocal = elink->IsLocal();
212 QDomElement encoder = pDoc->createElement(
"Encoder");
213 encoders.appendChild(encoder);
215 encoder.setAttribute(
"id" , elink->GetInputID() );
216 encoder.setAttribute(
"local" ,
static_cast<int>(isLocal));
217 encoder.setAttribute(
"connected" ,
static_cast<int>(elink->IsConnected()));
218 encoder.setAttribute(
"state" , state );
219 encoder.setAttribute(
"sleepstatus" , elink->GetSleepStatus() );
225 encoder.setAttribute(
"hostname", elink->GetHostName());
227 encoder.setAttribute(
"devlabel",
230 if (elink->IsConnected())
258 encoders.setAttribute(
"count", numencoders);
262 QDomElement scheduled = pDoc->createElement(
"Scheduled");
263 root.appendChild(scheduled);
270 unsigned int iNum = 10;
271 unsigned int iNumRecordings = 0;
273 auto itProg = recordingList.begin();
274 for (; (itProg != recordingList.end()) && iNumRecordings < iNum; ++itProg)
277 ((*itProg)->GetRecordingStartTime() >=
285 while (!recordingList.empty())
289 recordingList.pop_back();
292 scheduled.setAttribute(
"count", iNumRecordings);
296 QDomElement frontends = pDoc->createElement(
"Frontends");
297 root.appendChild(frontends);
300 "urn:schemas-mythtv-org:service:MythFrontend:1");
308 frontends.setAttribute(
"count", map.size() );
309 for (
const auto & entry : std::as_const(map))
311 QDomElement fe = pDoc->createElement(
"Frontend");
312 frontends.appendChild(fe);
313 QUrl url(entry->m_sLocation);
314 fe.setAttribute(
"name", url.host());
315 fe.setAttribute(
"url", url.toString(QUrl::RemovePath));
322 QDomElement backends = pDoc->createElement(
"Backends");
323 root.appendChild(backends);
333 QDomElement mbe = pDoc->createElement(
"Backend");
334 backends.appendChild(mbe);
335 mbe.setAttribute(
"type",
"Master");
336 mbe.setAttribute(
"name", masterhost);
337 mbe.setAttribute(
"url" , masterip +
":" + QString::number(masterport));
341 "urn:schemas-mythtv-org:device:SlaveMediaServer:1");
345 QString ipaddress = QString();
354 for (
const auto & entry : std::as_const(map))
356 QUrl url(entry->m_sLocation);
357 if (url.host() != ipaddress)
360 QDomElement mbe = pDoc->createElement(
"Backend");
361 backends.appendChild(mbe);
362 mbe.setAttribute(
"type",
"Slave");
363 mbe.setAttribute(
"name", url.host());
364 mbe.setAttribute(
"url" , url.toString(QUrl::RemovePath));
370 backends.setAttribute(
"count", numbes);
374 QDomElement
jobqueue = pDoc->createElement(
"JobQueue");
377 QMap<int, JobQueueEntry> jobs;
378 QMap<int, JobQueueEntry>::Iterator it;
384 for (it = jobs.begin(); it != jobs.end(); ++it)
386 ProgramInfo pginfo((*it).chanid, (*it).recstartts);
390 QDomElement job = pDoc->createElement(
"Job");
393 job.setAttribute(
"id" , (*it).id );
394 job.setAttribute(
"chanId" , (*it).chanid );
395 job.setAttribute(
"startTime" ,
397 job.setAttribute(
"startTs" , (*it).startts );
398 job.setAttribute(
"insertTime",
400 job.setAttribute(
"type" , (*it).type );
401 job.setAttribute(
"cmds" , (*it).cmds );
402 job.setAttribute(
"flags" , (*it).flags );
403 job.setAttribute(
"status" , (*it).status );
404 job.setAttribute(
"statusTime",
406 job.setAttribute(
"schedTime" ,
408 job.setAttribute(
"args" , (*it).args );
410 if ((*it).hostname.isEmpty())
411 job.setAttribute(
"hostname", QObject::tr(
"master"));
413 job.setAttribute(
"hostname",(*it).hostname);
415 QDomText textNode = pDoc->createTextNode((*it).comment);
416 job.appendChild(textNode);
421 jobqueue.setAttribute(
"count", jobs.size() );
425 QDomElement mInfo = pDoc->createElement(
"MachineInfo");
426 QDomElement storage = pDoc->createElement(
"Storage" );
427 QDomElement load = pDoc->createElement(
"Load" );
428 QDomElement guide = pDoc->createElement(
"Guide" );
430 root.appendChild (mInfo );
431 mInfo.appendChild(storage);
432 mInfo.appendChild(load );
433 mInfo.appendChild(guide );
450 QList<QDomElement> fsXML;
451 QStringList::const_iterator sit = strlist.cbegin();
452 while (sit != strlist.cend())
455 directory = *(sit++);
456 isLocalstr = *(sit++);
460 long long iTotal = (*(sit++)).toLongLong();
461 long long iUsed = (*(sit++)).toLongLong();;
462 long long iAvail = iTotal - iUsed;
467 QDomElement group = pDoc->createElement(
"Group");
469 group.setAttribute(
"id" , fsID );
470 group.setAttribute(
"total", (
int)(iTotal>>10) );
471 group.setAttribute(
"used" , (
int)(iUsed>>10) );
472 group.setAttribute(
"free" , (
int)(iAvail>>10) );
473 group.setAttribute(
"dir" , directory );
477 long long iLiveTV = -1;
478 long long iDeleted = -1;
479 long long iExpirable = -1;
481 query.
prepare(
"SELECT SUM(filesize) FROM recorded "
482 " WHERE recgroup = :RECGROUP;");
487 iLiveTV = query.
value(0).toLongLong();
492 iDeleted = query.
value(0).toLongLong();
494 query.
prepare(
"SELECT SUM(filesize) FROM recorded "
495 " WHERE autoexpire = 1 "
496 " AND recgroup NOT IN ('LiveTV', 'Deleted');");
499 iExpirable = query.
value(0).toLongLong();
501 group.setAttribute(
"livetv", (
int)(iLiveTV>>20) );
502 group.setAttribute(
"deleted", (
int)(iDeleted>>20) );
503 group.setAttribute(
"expirable", (
int)(iExpirable>>20) );
512 storage.appendChild(total);
513 int num_elements = fsXML.size();
514 for (
int fs_index = 0; fs_index < num_elements; fs_index++)
516 storage.appendChild(fsXML[fs_index]);
522 load.setAttribute(
"avg1", 0);
523 load.setAttribute(
"avg2", 1);
524 load.setAttribute(
"avg3", 2);
527 if (rgdAverages[0] != -1)
529 load.setAttribute(
"avg1", rgdAverages[0]);
530 load.setAttribute(
"avg2", rgdAverages[1]);
531 load.setAttribute(
"avg3", rgdAverages[2]);
537 QDateTime GuideDataThrough;
540 query.
prepare(
"SELECT MAX(endtime) FROM program WHERE manualid = 0;");
547 guide.setAttribute(
"start",
549 guide.setAttribute(
"end",
551 guide.setAttribute(
"status",
555 guide.setAttribute(
"next",
559 if (!GuideDataThrough.isNull())
561 guide.setAttribute(
"guideThru",
563 guide.setAttribute(
"guideDays", qdtNow.daysTo(GuideDataThrough));
569 if ((!info_script.isEmpty()) && (info_script !=
"none"))
571 QDomElement misc = pDoc->createElement(
"Miscellaneous");
572 root.appendChild(misc);
579 LOG(VB_GENERAL, LOG_ERR,
580 QString(
"Error running miscellaneous "
581 "status information script: %1").arg(info_script));
585 QByteArray input = ms.
ReadAll();
587 QStringList
output = QString(input).split(
'\n',
589 for (
const auto & line : std::as_const(
output))
591 QDomElement
info = pDoc->createElement(
"Information");
593 QStringList list = line.split(
"[]:[]");
594 unsigned int size = list.size();
595 unsigned int hasAttributes = 0;
597 if ((size > 0) && (!list[0].isEmpty()))
599 info.setAttribute(
"display", list[0]);
602 if ((size > 1) && (!list[1].isEmpty()))
604 info.setAttribute(
"name", list[1]);
607 if ((size > 2) && (!list[2].isEmpty()))
609 info.setAttribute(
"value", list[2]);
613 if (hasAttributes > 0)
614 misc.appendChild(
info);
625 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
626 os.setCodec(
"UTF-8");
628 os.setEncoding(QStringConverter::Utf8);
633 QDomElement docElem = pDoc->documentElement();
635 os <<
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
636 <<
"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n"
637 <<
"<html xmlns=\"http://www.w3.org/1999/xhtml\""
638 <<
" xml:lang=\"en\" lang=\"en\">\r\n"
640 <<
" <meta http-equiv=\"Content-Type\""
641 <<
"content=\"text/html; charset=UTF-8\" />\r\n"
642 <<
" <link rel=\"stylesheet\" href=\"/css/Status.css\" type=\"text/css\">\r\n"
643 <<
" <title>MythTV Status - "
647 << docElem.attribute(
"version", MYTH_BINARY_VERSION ) <<
"</title>\r\n"
649 <<
"<body bgcolor=\"#fff\">\r\n"
650 <<
"<div class=\"status\">\r\n"
651 <<
" <h1 class=\"status\">MythTV Status</h1>\r\n";
655 QDomNode node = docElem.namedItem(
"Encoders" );
662 node = docElem.namedItem(
"Scheduled" );
669 node = docElem.namedItem(
"Frontends" );
676 node = docElem.namedItem(
"Backends" );
683 node = docElem.namedItem(
"JobQueue" );
690 node = docElem.namedItem(
"MachineInfo" );
697 node = docElem.namedItem(
"Miscellaneous" );
702 os <<
"\r\n</div>\r\n</body>\r\n</html>\r\n";
712 int nNumEncoders = 0;
714 if (encoders.isNull())
717 os <<
" <div class=\"content\">\r\n"
718 <<
" <h2 class=\"status\">Encoder Status</h2>\r\n";
720 QDomNode node = encoders.firstChild();
722 while (!node.isNull())
724 QDomElement e = node.toElement();
728 if (e.tagName() ==
"Encoder")
730 QString sIsLocal = (e.attribute(
"local" ,
"remote" )==
"1")
731 ?
"local" :
"remote";
732 QString sCardId = e.attribute(
"id" ,
"0" );
733 QString sHostName = e.attribute(
"hostname" ,
"Unknown");
734 bool bConnected=
static_cast<bool>(e.attribute(
"connected",
"0" ).toInt());
736 bool bIsLowOnFreeSpace=
static_cast<bool>(e.attribute(
"lowOnFreeSpace",
"0").toInt());
738 QString sDevlabel = e.attribute(
"devlabel",
"[ UNKNOWN ]");
740 os <<
" Encoder " << sCardId <<
" " << sDevlabel
741 <<
" is " << sIsLocal <<
" on " << sHostName;
743 if ((sIsLocal ==
"remote") && !bConnected)
750 os <<
" (currently asleep).<br />";
752 os <<
" (currently not connected).<br />";
754 node = node.nextSibling();
765 os <<
" and is watching Live TV";
770 os <<
" and is recording";
774 os <<
" and is not recording.";
780 QDomNode tmpNode = e.namedItem(
"Program" );
782 if (!tmpNode.isNull())
784 QDomElement program = tmpNode.toElement();
786 if (!program.isNull())
788 os <<
" '" << program.attribute(
"title",
"Unknown" ) <<
"'";
792 tmpNode = program.namedItem(
"Channel" );
794 if (!tmpNode.isNull())
796 QDomElement channel = tmpNode.toElement();
798 if (!channel.isNull())
800 << channel.attribute(
"callSign",
"unknown" );
805 tmpNode = program.namedItem(
"Recording" );
807 if (!tmpNode.isNull())
809 QDomElement recording = tmpNode.toElement();
811 if (!recording.isNull())
814 recording.attribute(
"recEndTs",
"" ));
816 os <<
". This recording ";
822 os <<
"scheduled to end at "
832 if (bIsLowOnFreeSpace)
834 os <<
" <strong>WARNING</strong>:"
835 <<
" This backend is low on free disk space!";
842 node = node.nextSibling();
845 os <<
" </div>\r\n\r\n";
847 return( nNumEncoders );
858 if (scheduled.isNull())
861 int nNumRecordings= scheduled.attribute(
"count",
"0" ).toInt();
863 os <<
" <div class=\"content\">\r\n"
864 <<
" <h2 class=\"status\">Schedule</h2>\r\n";
866 if (nNumRecordings == 0)
868 os <<
" There are no shows scheduled for recording.\r\n"
873 os <<
" The next " << nNumRecordings <<
" show" << (nNumRecordings == 1 ?
"" :
"s" )
874 <<
" that " << (nNumRecordings == 1 ?
"is" :
"are")
875 <<
" scheduled for recording:\r\n";
877 os <<
" <div class=\"schedule\">\r\n";
881 QDomNode node = scheduled.firstChild();
883 while (!node.isNull())
885 QDomElement e = node.toElement();
889 QDomNode recNode = e.namedItem(
"Recording" );
890 QDomNode chanNode = e.namedItem(
"Channel" );
892 if ((e.tagName() ==
"Program") && !recNode.isNull() &&
895 QDomElement r = recNode.toElement();
896 QDomElement c = chanNode.toElement();
898 QString sTitle = e.attribute(
"title" ,
"" );
899 QString sSubTitle = e.attribute(
"subTitle",
"" );
905 int nPreRollSecs = r.attribute(
"preRollSeconds",
"0" ).toInt();
906 int nEncoderId = r.attribute(
"encoderId" ,
"0" ).toInt();
907 QString sProfile = r.attribute(
"recProfile" ,
"" );
908 QString sChanName = c.attribute(
"channelName" ,
"" );
911 QDomText text = e.firstChild().toText();
913 sDesc = text.nodeValue();
917 int nTotalSecs = qdtNow.secsTo( recStartTs ) - nPreRollSecs;
923 int nTotalDays = nTotalSecs / 86400;
924 int nTotalHours = (nTotalSecs / 3600)
926 int nTotalMins = (nTotalSecs / 60) % 60;
928 QString sTimeToStart =
"in";
930 sTimeToStart += QObject::tr(
" %n day(s),",
"", nTotalDays );
931 sTimeToStart += QObject::tr(
" %n hour(s) and",
"", nTotalHours);
932 sTimeToStart += QObject::tr(
" %n minute(s)",
"", nTotalMins);
934 if ( nTotalHours == 0 && nTotalMins == 0)
935 sTimeToStart = QObject::tr(
"within one minute",
"Recording starting");
938 sTimeToStart = QObject::tr(
"soon",
"Recording starting");
942 os <<
" <a href=\"#\">";
950 os <<
"Encoder " << nEncoderId <<
" - ";
952 os << sChanName <<
" - " << sTitle <<
"<br />"
953 <<
"<span><strong>" << sTitle <<
"</strong> ("
957 if ( !sSubTitle.isEmpty())
958 os <<
"<em>" << sSubTitle <<
"</em><br /><br />";
960 if ( airDate.isValid())
962 os <<
"Orig. Airdate: "
968 os << sDesc <<
"<br /><br />"
969 <<
"This recording will start " << sTimeToStart
970 <<
" using encoder " << nEncoderId <<
" with the '"
971 << sProfile <<
"' profile.</span></a><hr />\r\n";
975 node = node.nextSibling();
978 os <<
" </div>\r\n\r\n";
980 return( nNumRecordings );
989 if (frontends.isNull())
992 int nNumFES= frontends.attribute(
"count",
"0" ).toInt();
998 os <<
" <div class=\"content\">\r\n"
999 <<
" <h2 class=\"status\">Frontends</h2>\r\n";
1001 QDomNode node = frontends.firstChild();
1002 while (!node.isNull())
1004 QDomElement e = node.toElement();
1008 QString name = e.attribute(
"name" ,
"" );
1009 QString url = e.attribute(
"url" ,
"" );
1010 os << name <<
" (<a href=\"" << url <<
"\">Status page</a>)<br />";
1013 node = node.nextSibling();
1016 os <<
" </div>\r\n\r\n";
1027 if (backends.isNull())
1030 int nNumBES= backends.attribute(
"count",
"0" ).toInt();
1036 os <<
" <div class=\"content\">\r\n"
1037 <<
" <h2 class=\"status\">Other Backends</h2>\r\n";
1039 QDomNode node = backends.firstChild();
1040 while (!node.isNull())
1042 QDomElement e = node.toElement();
1046 QString
type = e.attribute(
"type",
"" );
1047 QString name = e.attribute(
"name" ,
"" );
1048 QString url = e.attribute(
"url" ,
"" );
1049 os <<
type <<
": " << name <<
" (<a href=\"" << url <<
"\">Status page</a>)<br />";
1052 node = node.nextSibling();
1055 os <<
" </div>\r\n\r\n";
1069 int nNumJobs= jobs.attribute(
"count",
"0" ).toInt();
1071 os <<
" <div class=\"content\">\r\n"
1072 <<
" <h2 class=\"status\">Job Queue</h2>\r\n";
1076 QString statusColor;
1079 os <<
" Jobs currently in Queue or recently ended:\r\n<br />"
1080 <<
" <div class=\"schedule\">\r\n";
1083 QDomNode node = jobs.firstChild();
1085 while (!node.isNull())
1087 QDomElement e = node.toElement();
1091 QDomNode progNode = e.namedItem(
"Program" );
1093 if ((e.tagName() ==
"Job") && !progNode.isNull() )
1095 QDomElement
p = progNode.toElement();
1097 QDomNode recNode =
p.namedItem(
"Recording" );
1098 QDomNode chanNode =
p.namedItem(
"Channel" );
1100 QDomElement r = recNode.toElement();
1101 QDomElement c = chanNode.toElement();
1103 int nType = e.attribute(
"type" ,
"0" ).toInt();
1104 int nStatus = e.attribute(
"status",
"0" ).toInt();
1109 statusColor =
" class=\"jobaborted\"";
1114 statusColor =
" class=\"joberrored\"";
1115 jobColor =
" class=\"joberrored\"";
1119 statusColor =
" class=\"jobfinished\"";
1120 jobColor =
" class=\"jobfinished\"";
1124 statusColor =
" class=\"jobrunning\"";
1125 jobColor =
" class=\"jobrunning\"";
1129 statusColor =
" class=\"jobqueued\"";
1130 jobColor =
" class=\"jobqueued\"";
1134 QString sTitle =
p.attribute(
"title" ,
"" );
1135 QString sSubTitle =
p.attribute(
"subTitle",
"" );
1141 QString sHostname = e.attribute(
"hostname",
"master" );
1142 QString sComment =
"";
1144 QDomText text = e.firstChild().toText();
1146 sComment = text.nodeValue();
1148 os <<
"<a href=\"javascript:void(0)\">"
1152 << sTitle <<
" - <font" << jobColor <<
">"
1154 <<
"<span><strong>" << sTitle <<
"</strong> ("
1158 if (!sSubTitle.isEmpty())
1159 os <<
"<em>" << sSubTitle <<
"</em><br /><br />";
1165 os <<
"Scheduled Run Time: "
1172 os <<
"Status: <font" << statusColor <<
">"
1180 if ( nStatus != JOB_QUEUED)
1181 os <<
"Host: " << sHostname <<
"<br />";
1183 if (!sComment.isEmpty())
1184 os <<
"<br />Comments:<br />" << sComment <<
"<br />";
1186 os <<
"</span></a><hr />\r\n";
1190 node = node.nextSibling();
1192 os <<
" </div>\r\n";
1196 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?";
1445 os <<
" There's <strong>no guide data</strong> available! "
1446 <<
"Have you run mythfilldatabase?";
1450 os <<
"\r\n </div>\r\n";
1462 QDomNodeList nodes =
info.elementsByTagName(
"Information");
1463 uint count = nodes.count();
1469 os <<
"<div class=\"content\">\r\n"
1470 <<
" <h2 class=\"status\">Miscellaneous</h2>\r\n";
1471 for (
unsigned int i = 0; i < count; i++)
1473 QDomNode node = nodes.item(i);
1477 QDomElement e = node.toElement();
1481 display = e.attribute(
"display",
"");
1485 if (display.isEmpty())
1490 if (display.contains(
"<p>", Qt::CaseInsensitive) ||
1491 display.contains(
"<br", Qt::CaseInsensitive))
1498 linebreak =
"<br />\r\n";
1501 os <<
" " << display << linebreak;
1515 if ((pDoc ==
nullptr) || (pInfo ==
nullptr))
1520 QDomElement program = pDoc->createElement(
"Program" );
1521 node.appendChild( program );
1523 program.setAttribute(
"startTime" ,
1526 program.setAttribute(
"title" , pInfo->
GetTitle() );
1527 program.setAttribute(
"subTitle" , pInfo->
GetSubtitle());
1528 program.setAttribute(
"category" , pInfo->
GetCategory());
1530 program.setAttribute(
"repeat" ,
static_cast<int>(pInfo->
IsRepeat()));
1535 program.setAttribute(
"seriesId" , pInfo->
GetSeriesID() );
1536 program.setAttribute(
"programId" , pInfo->
GetProgramID() );
1537 program.setAttribute(
"stars" , pInfo->
GetStars() );
1538 program.setAttribute(
"fileSize" ,
1540 program.setAttribute(
"lastModified",
1543 program.setAttribute(
"hostname" , pInfo->
GetHostname() );
1546 program.setAttribute(
1549 QDomText textNode = pDoc->createTextNode( pInfo->
GetDescription() );
1550 program.appendChild( textNode );
1558 QDomElement channel = pDoc->createElement(
"Channel" );
1559 program.appendChild( channel );
1568 QDomElement recording = pDoc->createElement(
"Recording" );
1569 program.appendChild( recording );
1571 recording.setAttribute(
"recStatus" ,
1573 recording.setAttribute(
"recPriority" ,
1575 recording.setAttribute(
"recStartTs" ,
1577 recording.setAttribute(
"recEndTs" ,
1582 recording.setAttribute(
"recordId" ,
1584 recording.setAttribute(
"recGroup" ,
1586 recording.setAttribute(
"playGroup" ,
1588 recording.setAttribute(
"recType" ,
1590 recording.setAttribute(
"dupInType" ,
1592 recording.setAttribute(
"dupMethod" ,
1594 recording.setAttribute(
"encoderId" ,
1597 recording.setAttribute(
"recProfile" ,
1624 channel.setAttribute(
"chanId" , pInfo->
GetChanID() );
1625 channel.setAttribute(
"chanNum" , pInfo->
GetChanNum());
1632 channel.setAttribute(
"chanFilters",
1634 channel.setAttribute(
"sourceId" , pInfo->
GetSourceID() );
1635 channel.setAttribute(
"inputId" , pInfo->
GetInputID() );
1636 channel.setAttribute(
"commFree" ,