MythTV  master
myth.cpp
Go to the documentation of this file.
1 // Program Name: myth.cpp
3 // Created : Jan. 19, 2010
4 //
5 // Copyright (c) 2010 David Blain <dblain@mythtv.org>
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //
25 
26 #include "myth.h"
27 #include <backendcontext.h>
28 
29 #include <QDir>
30 #include <QFileInfo>
31 #include <QCryptographicHash>
32 #include <QHostAddress>
33 #include <QUdpSocket>
34 
35 #include "config.h"
36 #include "version.h"
37 #include "mythversion.h"
38 #include "mythcorecontext.h"
39 #include "mythcoreutil.h"
40 #include "mythdbcon.h"
41 #include "mythlogging.h"
42 #include "storagegroup.h"
43 #include "dbutil.h"
44 #include "hardwareprofile.h"
45 #include "mythtimezone.h"
46 #include "mythdate.h"
47 #include "mythversion.h"
48 #include "serviceUtil.h"
49 #include "scheduler.h"
50 
51 #if QT_VERSION < QT_VERSION_CHECK(5,10,0)
52 #define qEnvironmentVariable getenv
53 #endif
54 
56 //
58 
60 {
61  QString sSecurityPin = gCoreContext->GetSetting( "SecurityPin", "");
62 
63  if ( sSecurityPin.isEmpty() )
64  throw( QString( "No Security Pin assigned. Run mythtv-setup to set one." ));
65  //SB: UPnPResult_HumanInterventionRequired,
66 
67  if ((sSecurityPin != "0000" ) && ( sPin != sSecurityPin ))
68  throw( QString( "Not Authorized" ));
69  //SB: UPnPResult_ActionNotAuthorized );
70 
72 
73  // ----------------------------------------------------------------------
74  // Check for DBHostName of "localhost" and change to public name or IP
75  // ----------------------------------------------------------------------
76 
77  QString sServerIP = gCoreContext->GetBackendServerIP();
78  //QString sPeerIP = pRequest->GetPeerAddress();
79 
80  if ((params.m_dbHostName.compare("localhost",Qt::CaseInsensitive)==0
81  || params.m_dbHostName == "127.0.0.1"
82  || params.m_dbHostName == "::1")
83  && !sServerIP.isEmpty()) // &&
84  //(sServerIP != sPeerIP ))
85  {
86  params.m_dbHostName = sServerIP;
87  }
88 
89  // If dbHostName is an IPV6 address with scope,
90  // remove the scope. Unescaped % signs are an
91  // xml violation
92  QString dbHostName(params.m_dbHostName);
93  QHostAddress addr;
94  if (addr.setAddress(dbHostName))
95  {
96  addr.setScopeId(QString());
97  dbHostName = addr.toString();
98  }
99  // ----------------------------------------------------------------------
100  // Create and populate a ConnectionInfo object
101  // ----------------------------------------------------------------------
102 
103  auto *pInfo = new DTC::ConnectionInfo();
104  DTC::DatabaseInfo *pDatabase = pInfo->Database();
105  DTC::WOLInfo *pWOL = pInfo->WOL();
106  DTC::VersionInfo *pVersion = pInfo->Version();
107 
108  pDatabase->setHost ( dbHostName );
109  pDatabase->setPing ( params.m_dbHostPing );
110  pDatabase->setPort ( params.m_dbPort );
111  pDatabase->setUserName ( params.m_dbUserName );
112  pDatabase->setPassword ( params.m_dbPassword );
113  pDatabase->setName ( params.m_dbName );
114  pDatabase->setType ( params.m_dbType );
115  pDatabase->setLocalEnabled ( params.m_localEnabled );
116  pDatabase->setLocalHostName( params.m_localHostName );
117 
118  pWOL->setEnabled ( params.m_wolEnabled );
119  pWOL->setReconnect ( params.m_wolReconnect );
120  pWOL->setRetry ( params.m_wolRetry );
121  pWOL->setCommand ( params.m_wolCommand );
122 
123  pVersion->setVersion ( MYTH_SOURCE_VERSION );
124  pVersion->setBranch ( MYTH_SOURCE_PATH );
125  pVersion->setProtocol ( MYTH_PROTO_VERSION );
126  pVersion->setBinary ( MYTH_BINARY_VERSION );
127  pVersion->setSchema ( MYTH_DATABASE_VERSION );
128 
129  // ----------------------------------------------------------------------
130  // Return the pointer... caller is responsible to delete it!!!
131  // ----------------------------------------------------------------------
132 
133  return pInfo;
134 }
135 
137 //
139 
141 {
142  if (!gCoreContext)
143  throw( QString( "No MythCoreContext in GetHostName." ));
144 
145  return gCoreContext->GetHostName();
146 }
148 //
150 
151 QStringList Myth::GetHosts( )
152 {
154 
155  if (!query.isConnected())
156  throw( QString( "Database not open while trying to load list of hosts" ));
157 
158  query.prepare(
159  "SELECT DISTINCTROW hostname "
160  "FROM settings "
161  "WHERE (not isNull( hostname ))");
162 
163  if (!query.exec())
164  {
165  MythDB::DBError("MythAPI::GetHosts()", query);
166 
167  throw( QString( "Database Error executing query." ));
168  }
169 
170  // ----------------------------------------------------------------------
171  // return the results of the query
172  // ----------------------------------------------------------------------
173 
174  QStringList oList;
175 
176  while (query.next())
177  oList.append( query.value(0).toString() );
178 
179  return oList;
180 }
181 
183 //
185 
186 QStringList Myth::GetKeys()
187 {
189 
190  if (!query.isConnected())
191  throw( QString("Database not open while trying to load settings"));
192 
193  query.prepare("SELECT DISTINCTROW value FROM settings;" );
194 
195  if (!query.exec())
196  {
197  MythDB::DBError("MythAPI::GetKeys()", query);
198 
199  throw( QString( "Database Error executing query." ));
200  }
201 
202  // ----------------------------------------------------------------------
203  // return the results of the query
204  // ----------------------------------------------------------------------
205 
206  QStringList oResults;
207 
208  //pResults->setObjectName( "KeyList" );
209 
210  while (query.next())
211  oResults.append( query.value(0).toString() );
212 
213  return oResults;
214 }
215 
217 //
219 
221  const QString &sHostName )
222 {
224 
225  if (!query.isConnected())
226  throw( QString("Database not open while trying to list "
227  "Storage Group Dirs"));
228 
229  if (!sGroupName.isEmpty() && !sHostName.isEmpty())
230  {
231  query.prepare("SELECT id, groupname, hostname, dirname "
232  "FROM storagegroup "
233  "WHERE groupname = :GROUP AND hostname = :HOST "
234  "ORDER BY groupname, hostname, dirname" );
235  query.bindValue(":HOST", sHostName);
236  query.bindValue(":GROUP", sGroupName);
237  }
238  else if (!sHostName.isEmpty())
239  {
240  query.prepare("SELECT id, groupname, hostname, dirname "
241  "FROM storagegroup "
242  "WHERE hostname = :HOST "
243  "ORDER BY groupname, hostname, dirname" );
244  query.bindValue(":HOST", sHostName);
245  }
246  else if (!sGroupName.isEmpty())
247  {
248  query.prepare("SELECT id, groupname, hostname, dirname "
249  "FROM storagegroup "
250  "WHERE groupname = :GROUP "
251  "ORDER BY groupname, hostname, dirname" );
252  query.bindValue(":GROUP", sGroupName);
253  }
254  else
255  {
256  query.prepare("SELECT id, groupname, hostname, dirname "
257  "FROM storagegroup "
258  "ORDER BY groupname, hostname, dirname" );
259  }
260 
261  if (!query.exec())
262  {
263  MythDB::DBError("MythAPI::GetStorageGroupDirs()", query);
264 
265  throw( QString( "Database Error executing query." ));
266  }
267 
268  // ----------------------------------------------------------------------
269  // return the results of the query plus R/W and size information
270  // ----------------------------------------------------------------------
271 
272  auto* pList = new DTC::StorageGroupDirList();
273 
274  while (query.next())
275  {
276  DTC::StorageGroupDir *pStorageGroupDir = pList->AddNewStorageGroupDir();
277  QFileInfo fi(query.value(3).toString());
278  int64_t free = 0;
279  int64_t total = 0;
280  int64_t used = 0;
281 
282  free = getDiskSpace(query.value(3).toString(), total, used);
283 
284  pStorageGroupDir->setId ( query.value(0).toInt() );
285  pStorageGroupDir->setGroupName ( query.value(1).toString() );
286  pStorageGroupDir->setHostName ( query.value(2).toString() );
287  pStorageGroupDir->setDirName ( query.value(3).toString() );
288  pStorageGroupDir->setDirRead ( fi.isReadable() );
289  pStorageGroupDir->setDirWrite ( fi.isWritable() );
290  pStorageGroupDir->setKiBFree ( free );
291  }
292 
293  return pList;
294 }
295 
297 //
299 
300 bool Myth::AddStorageGroupDir( const QString &sGroupName,
301  const QString &sDirName,
302  const QString &sHostName )
303 {
305 
306  if (!query.isConnected())
307  throw( QString("Database not open while trying to add Storage Group "
308  "dir"));
309 
310  if (sGroupName.isEmpty())
311  throw ( QString( "Storage Group Required" ));
312 
313  if (sDirName.isEmpty())
314  throw ( QString( "Directory Name Required" ));
315 
316  if (sHostName.isEmpty())
317  throw ( QString( "HostName Required" ));
318 
319  query.prepare("SELECT COUNT(*) "
320  "FROM storagegroup "
321  "WHERE groupname = :GROUPNAME "
322  "AND dirname = :DIRNAME "
323  "AND hostname = :HOSTNAME;");
324  query.bindValue(":GROUPNAME", sGroupName );
325  query.bindValue(":DIRNAME" , sDirName );
326  query.bindValue(":HOSTNAME" , sHostName );
327  if (!query.exec())
328  {
329  MythDB::DBError("MythAPI::AddStorageGroupDir()", query);
330 
331  throw( QString( "Database Error executing query." ));
332  }
333 
334  if (query.next())
335  {
336  if (query.value(0).toInt() > 0)
337  return false;
338  }
339 
340  query.prepare("INSERT storagegroup "
341  "( groupname, dirname, hostname ) "
342  "VALUES "
343  "( :GROUPNAME, :DIRNAME, :HOSTNAME );");
344  query.bindValue(":GROUPNAME", sGroupName );
345  query.bindValue(":DIRNAME" , sDirName );
346  query.bindValue(":HOSTNAME" , sHostName );
347 
348  if (!query.exec())
349  {
350  MythDB::DBError("MythAPI::AddStorageGroupDir()", query);
351 
352  throw( QString( "Database Error executing query." ));
353  }
354 
355  return true;
356 }
357 
359 //
361 
362 bool Myth::RemoveStorageGroupDir( const QString &sGroupName,
363  const QString &sDirName,
364  const QString &sHostName )
365 {
367 
368  if (!query.isConnected())
369  throw( QString("Database not open while trying to remove Storage "
370  "Group dir"));
371 
372  if (sGroupName.isEmpty())
373  throw ( QString( "Storage Group Required" ));
374 
375  if (sDirName.isEmpty())
376  throw ( QString( "Directory Name Required" ));
377 
378  if (sHostName.isEmpty())
379  throw ( QString( "HostName Required" ));
380 
381  query.prepare("DELETE "
382  "FROM storagegroup "
383  "WHERE groupname = :GROUPNAME "
384  "AND dirname = :DIRNAME "
385  "AND hostname = :HOSTNAME;");
386  query.bindValue(":GROUPNAME", sGroupName );
387  query.bindValue(":DIRNAME" , sDirName );
388  query.bindValue(":HOSTNAME" , sHostName );
389  if (!query.exec())
390  {
391  MythDB::DBError("MythAPI::AddStorageGroupDir()", query);
392 
393  throw( QString( "Database Error executing query." ));
394  }
395 
396  return true;
397 }
398 
400 //
402 
404 {
405  auto *pResults = new DTC::TimeZoneInfo();
406 
407  pResults->setTimeZoneID( MythTZ::getTimeZoneID() );
408  pResults->setUTCOffset( MythTZ::calc_utc_offset() );
409  pResults->setCurrentDateTime( MythDate::current(true) );
410 
411  return pResults;
412 }
413 
415 //
417 
418 QString Myth::GetFormatDate(const QDateTime &Date, bool ShortDate)
419 {
421  if (ShortDate)
423 
424  return MythDate::toString(Date, dateFormat);
425 }
426 
428 //
430 
431 QString Myth::GetFormatDateTime(const QDateTime &DateTime, bool ShortDate)
432 {
434  if (ShortDate)
436 
437  return MythDate::toString(DateTime, dateFormat);
438 }
439 
441 //
443 
444 QString Myth::GetFormatTime(const QDateTime &Time)
445 {
446  return MythDate::toString(Time, MythDate::kTime);
447 }
448 
450 //
452 
453 QDateTime Myth::ParseISODateString(const QString& DateTimeString)
454 {
455  QDateTime dateTime = QDateTime::fromString(DateTimeString, Qt::ISODate);
456 
457  if (!dateTime.isValid())
458  throw QString( "Unable to parse DateTimeString" );
459 
460  return dateTime;
461 }
462 
464 //
466 
467 DTC::LogMessageList *Myth::GetLogs( const QString &HostName,
468  const QString &Application,
469  int PID,
470  int TID,
471  const QString &Thread,
472  const QString &Filename,
473  int Line,
474  const QString &Function,
475  const QDateTime &FromTime,
476  const QDateTime &ToTime,
477  const QString &Level,
478  const QString &MsgContains )
479 {
480  auto *pList = new DTC::LogMessageList();
481 
483 
484  // Get host name list
485  QString sql = "SELECT DISTINCT host FROM logging ORDER BY host ASC";
486  if (!query.exec(sql))
487  {
488  MythDB::DBError("Retrieving log host names", query);
489  delete pList;
490  throw( QString( "Database Error executing query." ));
491  }
492  while (query.next())
493  {
494  DTC::LabelValue *pLabelValue = pList->AddNewHostName();
495  QString availableHostName = query.value(0).toString();
496  pLabelValue->setValue ( availableHostName );
497  pLabelValue->setActive ( availableHostName == HostName );
498  pLabelValue->setSelected( availableHostName == HostName );
499  }
500  // Get application list
501  sql = "SELECT DISTINCT application FROM logging ORDER BY application ASC";
502  if (!query.exec(sql))
503  {
504  MythDB::DBError("Retrieving log applications", query);
505  delete pList;
506  throw( QString( "Database Error executing query." ));
507  }
508  while (query.next())
509  {
510  DTC::LabelValue *pLabelValue = pList->AddNewApplication();
511  QString availableApplication = query.value(0).toString();
512  pLabelValue->setValue ( availableApplication );
513  pLabelValue->setActive ( availableApplication == Application );
514  pLabelValue->setSelected( availableApplication == Application );
515  }
516 
517  if (!HostName.isEmpty() && !Application.isEmpty())
518  {
519  // Get log messages
520  sql = "SELECT host, application, pid, tid, thread, filename, "
521  " line, function, msgtime, level, message "
522  " FROM logging "
523  " WHERE host = COALESCE(:HOSTNAME, host) "
524  " AND application = COALESCE(:APPLICATION, application) "
525  " AND pid = COALESCE(:PID, pid) "
526  " AND tid = COALESCE(:TID, tid) "
527  " AND thread = COALESCE(:THREAD, thread) "
528  " AND filename = COALESCE(:FILENAME, filename) "
529  " AND line = COALESCE(:LINE, line) "
530  " AND function = COALESCE(:FUNCTION, function) "
531  " AND msgtime >= COALESCE(:FROMTIME, msgtime) "
532  " AND msgtime <= COALESCE(:TOTIME, msgtime) "
533  " AND level <= COALESCE(:LEVEL, level) "
534  ;
535  if (!MsgContains.isEmpty())
536  {
537  sql.append(" AND message LIKE :MSGCONTAINS ");
538  }
539  sql.append(" ORDER BY msgtime ASC;");
540 
541  query.prepare(sql);
542 
543  query.bindValue(":HOSTNAME", (HostName.isEmpty()) ? QString() : HostName);
544  query.bindValue(":APPLICATION", (Application.isEmpty()) ? QString() :
545  Application);
546  query.bindValue(":PID", ( PID == 0 ) ? QVariant(QVariant::ULongLong) :
547  (qint64)PID);
548  query.bindValue(":TID", ( TID == 0 ) ? QVariant(QVariant::ULongLong) :
549  (qint64)TID);
550  query.bindValue(":THREAD", (Thread.isEmpty()) ? QString() : Thread);
551  query.bindValue(":FILENAME", (Filename.isEmpty()) ? QString() : Filename);
552  query.bindValue(":LINE", ( Line == 0 ) ? QVariant(QVariant::ULongLong) :
553  (qint64)Line);
554  query.bindValue(":FUNCTION", (Function.isEmpty()) ? QString() : Function);
555  query.bindValue(":FROMTIME", (FromTime.isValid()) ? FromTime : QDateTime());
556  query.bindValue(":TOTIME", (ToTime.isValid()) ? ToTime : QDateTime());
557  query.bindValue(":LEVEL", (Level.isEmpty()) ?
558  QVariant(QVariant::ULongLong) :
559  (qint64)logLevelGet(Level));
560 
561  if (!MsgContains.isEmpty())
562  {
563  query.bindValue(":MSGCONTAINS", "%" + MsgContains + "%" );
564  }
565 
566  if (!query.exec())
567  {
568  MythDB::DBError("Retrieving log messages", query);
569  delete pList;
570  throw( QString( "Database Error executing query." ));
571  }
572 
573  while (query.next())
574  {
575  DTC::LogMessage *pLogMessage = pList->AddNewLogMessage();
576 
577  pLogMessage->setHostName( query.value(0).toString() );
578  pLogMessage->setApplication( query.value(1).toString() );
579  pLogMessage->setPID( query.value(2).toInt() );
580  pLogMessage->setTID( query.value(3).toInt() );
581  pLogMessage->setThread( query.value(4).toString() );
582  pLogMessage->setFilename( query.value(5).toString() );
583  pLogMessage->setLine( query.value(6).toInt() );
584  pLogMessage->setFunction( query.value(7).toString() );
585  pLogMessage->setTime(MythDate::as_utc(query.value(8).toDateTime()));
586  pLogMessage->setLevel( logLevelGetName(
587  (LogLevel_t)query.value(9).toInt()) );
588  pLogMessage->setMessage( query.value(10).toString() );
589  }
590  }
591 
592  return pList;
593 }
594 
596 //
598 
600 {
601  auto *pList = new DTC::FrontendList();
602  QMap<QString, Frontend*> frontends;
603  if (OnLine)
604  frontends = gBackendContext->GetConnectedFrontends();
605  else
606  frontends = gBackendContext->GetFrontends();
607 
608  for (auto * fe : qAsConst(frontends))
609  {
610  DTC::Frontend *pFrontend = pList->AddNewFrontend();
611  pFrontend->setName(fe->m_name);
612  pFrontend->setIP(fe->m_ip.toString());
613  int port = gCoreContext->GetNumSettingOnHost("FrontendStatusPort",
614  fe->m_name, 6547);
615  pFrontend->setPort(port);
616  pFrontend->setOnLine(fe->m_connectionCount > 0);
617  }
618 
619  return pList;
620 }
621 
623 //
625 
626 QString Myth::GetSetting( const QString &sHostName,
627  const QString &sKey,
628  const QString &sDefault )
629 {
630  if (sKey.isEmpty())
631  throw( QString("Missing or empty Key (settings.value)") );
632 
633  if (sHostName == "_GLOBAL_")
634  {
636 
637  query.prepare("SELECT data FROM settings "
638  "WHERE value = :VALUE "
639  "AND (hostname IS NULL)" );
640 
641  query.bindValue(":VALUE", sKey );
642 
643  if (!query.exec())
644  {
645  MythDB::DBError("API Myth/GetSetting ", query);
646  throw( QString( "Database Error executing query." ));
647  }
648 
649  return query.next() ? query.value(0).toString() : sDefault;
650  }
651 
652  QString hostname = sHostName;
653 
654  if (sHostName.isEmpty())
656 
657  return gCoreContext->GetSettingOnHost(sKey, hostname, sDefault);
658 }
659 
661 //
663 
664 DTC::SettingList *Myth::GetSettingList(const QString &sHostName)
665 {
666 
668 
669  if (!query.isConnected())
670  {
671  throw( QString("Database not open while trying to load settings for host: %1")
672  .arg( sHostName ));
673  }
674 
675  auto *pList = new DTC::SettingList();
676 
677  //pList->setObjectName( "Settings" );
678  pList->setHostName ( sHostName );
679 
680  // ------------------------------------------------------------------
681  // Looking to return all Setting for supplied hostname
682  // ------------------------------------------------------------------
683 
684  if (sHostName.isEmpty())
685  {
686  query.prepare("SELECT value, data FROM settings "
687  "WHERE (hostname IS NULL)" );
688  }
689  else
690  {
691  query.prepare("SELECT value, data FROM settings "
692  "WHERE (hostname = :HOSTNAME)" );
693 
694  query.bindValue(":HOSTNAME", sHostName );
695  }
696 
697  if (!query.exec())
698  {
699  // clean up unused object we created.
700 
701  delete pList;
702 
703  MythDB::DBError("MythAPI::GetSetting() w/o key ", query);
704  throw( QString( "Database Error executing query." ));
705  }
706 
707  while (query.next())
708  pList->Settings().insert( query.value(0).toString(), query.value(1) );
709 
710  return pList;
711 }
712 
714 //
716 
717 bool Myth::PutSetting( const QString &sHostName,
718  const QString &sKey,
719  const QString &sValue )
720 {
721  if (!sKey.isEmpty())
722  {
723  return gCoreContext->SaveSettingOnHost( sKey, sValue, sHostName );
724  }
725 
726  throw ( QString( "Key Required" ));
727 }
728 
730 //
732 
733 bool Myth::ChangePassword( const QString &sUserName,
734  const QString &sOldPassword,
735  const QString &sNewPassword )
736 {
737  LOG(VB_GENERAL, LOG_NOTICE, "ChangePassword is deprecated, use "
738  "ManageDigestUser.");
739 
740  return ( ManageDigestUser("ChangePassword", sUserName, sOldPassword,
741  sNewPassword, "") );
742 }
743 
745 //
747 
748 bool Myth::TestDBSettings( const QString &sHostName,
749  const QString &sUserName,
750  const QString &sPassword,
751  const QString &sDBName,
752  int dbPort)
753 {
754  bool bResult = false;
755 
756  QString db("mythconverg");
757  int port = 3306;
758 
759  if (!sDBName.isEmpty())
760  db = sDBName;
761 
762  if (dbPort != 0)
763  port = dbPort;
764 
765  bResult = TestDatabase(sHostName, sUserName, sPassword, db, port);
766 
767  return bResult;
768 }
769 
771 //
773 
774 bool Myth::SendMessage( const QString &sMessage,
775  const QString &sAddress,
776  int udpPort,
777  int Timeout)
778 {
779  bool bResult = false;
780 
781  if (sMessage.isEmpty())
782  return bResult;
783 
784  if (Timeout < 0 || Timeout > 999)
785  Timeout = 0;
786 
787  QString xmlMessage =
788  "<mythmessage version=\"1\">\n"
789  " <text>" + sMessage + "</text>\n"
790  " <timeout>" + QString::number(Timeout) + "</timeout>\n"
791  "</mythmessage>";
792 
793  QHostAddress address = QHostAddress::Broadcast;
794  unsigned short port = 6948;
795 
796  if (!sAddress.isEmpty())
797  address.setAddress(sAddress);
798 
799  if (udpPort != 0)
800  port = udpPort;
801 
802  auto *sock = new QUdpSocket();
803  QByteArray utf8 = xmlMessage.toUtf8();
804  int size = utf8.length();
805 
806  if (sock->writeDatagram(utf8.constData(), size, address, port) < 0)
807  {
808  LOG(VB_GENERAL, LOG_ERR,
809  QString("Failed to send UDP/XML packet (Message: %1 "
810  "Address: %2 Port: %3")
811  .arg(sMessage).arg(sAddress).arg(port));
812  }
813  else
814  {
815  LOG(VB_GENERAL, LOG_DEBUG,
816  QString("UDP/XML packet sent! (Message: %1 Address: %2 Port: %3")
817  .arg(sMessage)
818  .arg(address.toString().toLocal8Bit().constData()).arg(port));
819  bResult = true;
820  }
821 
822  sock->deleteLater();
823 
824  return bResult;
825 }
826 
827 bool Myth::SendNotification( bool bError,
828  const QString &Type,
829  const QString &sMessage,
830  const QString &sOrigin,
831  const QString &sDescription,
832  const QString &sImage,
833  const QString &sExtra,
834  const QString &sProgressText,
835  float fProgress,
836  int Duration,
837  bool bFullscreen,
838  uint Visibility,
839  uint Priority,
840  const QString &sAddress,
841  int udpPort )
842 {
843  bool bResult = false;
844 
845  if (sMessage.isEmpty())
846  return bResult;
847 
848  if (Duration < 0 || Duration > 999)
849  Duration = -1;
850 
851  QString xmlMessage =
852  "<mythnotification version=\"1\">\n"
853  " <text>" + sMessage + "</text>\n"
854  " <origin>" + (sOrigin.isNull() ? tr("MythServices") : sOrigin) + "</origin>\n"
855  " <description>" + sDescription + "</description>\n"
856  " <timeout>" + QString::number(Duration) + "</timeout>\n"
857  " <image>" + sImage + "</image>\n"
858  " <extra>" + sExtra + "</extra>\n"
859  " <progress_text>" + sProgressText + "</progress_text>\n"
860  " <progress>" + QString::number(fProgress) + "</progress>\n"
861  " <fullscreen>" + (bFullscreen ? "true" : "false") + "</fullscreen>\n"
862  " <visibility>" + QString::number(Visibility) + "</visibility>\n"
863  " <priority>" + QString::number(Priority) + "</priority>\n"
864  " <type>" + (bError ? "error" : Type) + "</type>\n"
865  "</mythnotification>";
866 
867  QHostAddress address = QHostAddress::Broadcast;
868  unsigned short port = 6948;
869 
870  if (!sAddress.isEmpty())
871  address.setAddress(sAddress);
872 
873  if (udpPort != 0)
874  port = udpPort;
875 
876  auto *sock = new QUdpSocket();
877  QByteArray utf8 = xmlMessage.toUtf8();
878  int size = utf8.length();
879 
880  if (sock->writeDatagram(utf8.constData(), size, address, port) < 0)
881  {
882  LOG(VB_GENERAL, LOG_ERR,
883  QString("Failed to send UDP/XML packet (Notification: %1 "
884  "Address: %2 Port: %3")
885  .arg(sMessage).arg(sAddress).arg(port));
886  }
887  else
888  {
889  LOG(VB_GENERAL, LOG_DEBUG,
890  QString("UDP/XML packet sent! (Notification: %1 Address: %2 Port: %3")
891  .arg(sMessage)
892  .arg(address.toString().toLocal8Bit().constData()).arg(port));
893  bResult = true;
894  }
895 
896  sock->deleteLater();
897 
898  return bResult;
899 }
900 
902 //
904 
906 {
907  bool bResult = false;
908 
909  DBUtil dbutil;
911  QString filename;
912 
913  LOG(VB_GENERAL, LOG_NOTICE, "Performing API invoked DB Backup.");
914 
915  status = DBUtil::BackupDB(filename);
916 
917  if (status == kDB_Backup_Completed)
918  {
919  LOG(VB_GENERAL, LOG_NOTICE, "Database backup succeeded.");
920  bResult = true;
921  }
922  else
923  LOG(VB_GENERAL, LOG_ERR, "Database backup failed.");
924 
925  return bResult;
926 }
927 
929 //
931 
932 bool Myth::CheckDatabase( bool repair )
933 {
934  LOG(VB_GENERAL, LOG_NOTICE, "Performing API invoked DB Check.");
935 
936  bool bResult = DBUtil::CheckTables(repair);
937 
938  if (bResult)
939  LOG(VB_GENERAL, LOG_NOTICE, "Database check complete.");
940  else
941  LOG(VB_GENERAL, LOG_ERR, "Database check failed.");
942 
943  return bResult;
944 }
945 
947 {
948  auto *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
949  scheduler->DelayShutdown();
950  LOG(VB_GENERAL, LOG_NOTICE, "Shutdown delayed 5 minutes for external application.");
951  return true;
952 }
953 
955 //
957 
959 {
961  LOG(VB_GENERAL, LOG_NOTICE, "Profile Submission...");
962  profile.GenerateUUIDs();
963  bool bResult = profile.SubmitProfile();
964  if (bResult)
965  LOG(VB_GENERAL, LOG_NOTICE, "Profile Submitted.");
966 
967  return bResult;
968 }
969 
971 //
973 
975 {
977  LOG(VB_GENERAL, LOG_NOTICE, "Profile Deletion...");
978  profile.GenerateUUIDs();
979  bool bResult = profile.DeleteProfile();
980  if (bResult)
981  LOG(VB_GENERAL, LOG_NOTICE, "Profile Deleted.");
982 
983  return bResult;
984 }
985 
987 //
989 
991 {
992  QString sProfileURL;
993 
995  profile.GenerateUUIDs();
996  sProfileURL = profile.GetProfileURL();
997  LOG(VB_GENERAL, LOG_NOTICE, QString("ProfileURL: %1").arg(sProfileURL));
998 
999  return sProfileURL;
1000 }
1001 
1003 //
1005 
1007 {
1008  QString sProfileUpdate;
1009 
1011  profile.GenerateUUIDs();
1012  QDateTime tUpdated;
1013  tUpdated = profile.GetLastUpdate();
1014  sProfileUpdate = tUpdated.toString(
1015  gCoreContext->GetSetting( "DateFormat", "MM.dd.yyyy"));
1016 
1017  return sProfileUpdate;
1018 }
1019 
1021 //
1023 
1025 {
1026  QString sProfileText;
1027 
1029  sProfileText = HardwareProfile::GetHardwareProfile();
1030 
1031  return sProfileText;
1032 }
1033 
1035 //
1037 
1039 {
1040 
1041  // ----------------------------------------------------------------------
1042  // Create and populate a Configuration object
1043  // ----------------------------------------------------------------------
1044 
1045  auto *pInfo = new DTC::BackendInfo();
1046  DTC::BuildInfo *pBuild = pInfo->Build();
1047  DTC::EnvInfo *pEnv = pInfo->Env();
1048  DTC::LogInfo *pLog = pInfo->Log();
1049 
1050  pBuild->setVersion ( MYTH_SOURCE_VERSION );
1051  pBuild->setLibX264 ( CONFIG_LIBX264 );
1052  pBuild->setLibDNS_SD ( CONFIG_LIBDNS_SD );
1053  pEnv->setLANG ( qEnvironmentVariable("LANG") );
1054  pEnv->setLCALL ( qEnvironmentVariable("LC_ALL") );
1055  pEnv->setLCCTYPE ( qEnvironmentVariable("LC_CTYPE") );
1056  pEnv->setHOME ( qEnvironmentVariable("HOME") );
1057  pEnv->setMYTHCONFDIR ( qEnvironmentVariable("MYTHCONFDIR") );
1058  pLog->setLogArgs ( logPropagateArgs );
1059 
1060  // ----------------------------------------------------------------------
1061  // Return the pointer... caller is responsible to delete it!!!
1062  // ----------------------------------------------------------------------
1063 
1064  return pInfo;
1065 
1066 }
1067 
1069 //
1071 
1072 bool Myth::ManageDigestUser( const QString &sAction,
1073  const QString &sUserName,
1074  const QString &sPassword,
1075  const QString &sNewPassword,
1076  const QString &sAdminPassword )
1077 {
1078 
1079  DigestUserActions sessionAction = DIGEST_USER_ADD;
1080 
1081  if (sAction == "Add")
1082  sessionAction = DIGEST_USER_ADD;
1083  else if (sAction == "Remove")
1084  sessionAction = DIGEST_USER_REMOVE;
1085  else if (sAction == "ChangePassword")
1086  sessionAction = DIGEST_USER_CHANGE_PW;
1087  else
1088  {
1089  LOG(VB_GENERAL, LOG_ERR, QString("Action must be Add, Remove or "
1090  "ChangePassword, not '%1'")
1091  .arg(sAction));
1092  return false;
1093  }
1094 
1095  return MythSessionManager::ManageDigestUser(sessionAction, sUserName,
1096  sPassword, sNewPassword,
1097  sAdminPassword);
1098 }
1099 
1101 //
1103 
1104 bool Myth::ManageUrlProtection( const QString &sServices,
1105  const QString &sAdminPassword )
1106 {
1107  if (!MythSessionManager::IsValidUser("admin"))
1108  {
1109  LOG(VB_GENERAL, LOG_ERR, QString("Backend has no '%1' user!")
1110  .arg("admin"));
1111  return false;
1112  }
1113 
1114  if (MythSessionManager::CreateDigest("admin", sAdminPassword) !=
1116  {
1117  LOG(VB_GENERAL, LOG_ERR, QString("Incorrect password for user: %1")
1118  .arg("admin"));
1119  return false;
1120  }
1121 
1122  QStringList serviceList = sServices.split(",");
1123 
1124  serviceList.removeDuplicates();
1125 
1126  QStringList protectedURLs;
1127 
1128  if (serviceList.size() == 1 && serviceList.first() == "All")
1129  {
1130  for (const QString& service : KnownServices)
1131  protectedURLs << '/' + service;
1132  }
1133  else if (serviceList.size() == 1 && serviceList.first() == "None")
1134  {
1135  protectedURLs << "Unprotected";
1136  }
1137  else
1138  {
1139  for (const QString& service : serviceList)
1140  {
1141  if (KnownServices.contains(service))
1142  protectedURLs << '/' + service;
1143  else
1144  LOG(VB_GENERAL, LOG_ERR, QString("Invalid service name: '%1'")
1145  .arg(service));
1146  }
1147  }
1148 
1149  if (protectedURLs.isEmpty())
1150  {
1151  LOG(VB_GENERAL, LOG_ERR, "No valid Services were found");
1152  return false;
1153  }
1154 
1155  return gCoreContext->SaveSettingOnHost("HTTP/Protected/Urls",
1156  protectedURLs.join(';'), "");
1157 }
serviceUtil.h
Myth::GetBackendInfo
DTC::BackendInfo * GetBackendInfo(void) override
Definition: myth.cpp:1038
Scheduler
Definition: scheduler.h:45
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:783
MythSessionManager::IsValidUser
static bool IsValidUser(const QString &username)
Check if the given user exists but not whether there is a valid session open for them!
Definition: mythsession.cpp:151
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:125
hardwareprofile.h
MythSessionManager::GetPasswordDigest
static QString GetPasswordDigest(const QString &username)
Load the password digest for comparison in the HTTP Auth code.
Definition: mythsession.cpp:224
KnownServices
const QStringList KnownServices
Definition: serviceUtil.h:56
Myth::BackupDatabase
bool BackupDatabase(void) override
Definition: myth.cpp:905
DTC::BuildInfo
Definition: buildInfo.h:22
Myth::DelayShutdown
bool DelayShutdown(void) override
Definition: myth.cpp:946
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:80
MusicMetadata::Filename
QString Filename(bool find=true)
Definition: musicmetadata.cpp:966
DatabaseParams::m_dbHostName
QString m_dbHostName
database server
Definition: mythdbparams.h:21
DTC::SettingList
Definition: settingList.h:23
Myth::GetStorageGroupDirs
DTC::StorageGroupDirList * GetStorageGroupDirs(const QString &GroupName, const QString &HostName) override
Definition: myth.cpp:220
dbutil.h
backendcontext.h
DTC::FrontendList
Definition: frontendList.h:24
Myth::RemoveStorageGroupDir
bool RemoveStorageGroupDir(const QString &GroupName, const QString &DirName, const QString &HostName) override
Definition: myth.cpp:362
DIGEST_USER_CHANGE_PW
@ DIGEST_USER_CHANGE_PW
Definition: mythsession.h:13
Myth::GetSetting
QString GetSetting(const QString &HostName, const QString &Key, const QString &Default) override
Definition: myth.cpp:626
Myth::ProfileSubmit
bool ProfileSubmit(void) override
Definition: myth.cpp:958
MythCoreContext::GetScheduler
MythScheduler * GetScheduler(void)
Definition: mythcorecontext.cpp:1886
Myth::AddStorageGroupDir
bool AddStorageGroupDir(const QString &GroupName, const QString &DirName, const QString &HostName) override
Definition: myth.cpp:300
LogMessageList
QList< LogMessage * > LogMessageList
Definition: loggingserver.h:129
getDiskSpace
int64_t getDiskSpace(const QString &file_on_disk, int64_t &total, int64_t &used)
Definition: mythcoreutil.cpp:43
MythDate::as_utc
QDateTime as_utc(const QDateTime &old_dt)
Returns copy of QDateTime with TimeSpec set to UTC.
Definition: mythdate.cpp:23
DTC::TimeZoneInfo
Definition: timeZoneInfo.h:20
MythTZ::getTimeZoneID
QString getTimeZoneID(void)
Returns the zoneinfo time zone ID or as much time zone information as possible.
Definition: mythtimezone.cpp:56
DatabaseParams
Structure containing the basic Database parameters.
Definition: mythdbparams.h:9
DTC::ConnectionInfo
Definition: connectionInfo.h:24
Myth::GetHostName
QString GetHostName() override
Definition: myth.cpp:140
DTC::VersionInfo
Definition: versionInfo.h:22
Scheduler::DelayShutdown
void DelayShutdown()
Definition: scheduler.cpp:3041
mythcoreutil.h
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:198
arg
arg(title).arg(filename).arg(doDelete))
mythdbcon.h
TestDatabase
bool TestDatabase(const QString &dbHostName, const QString &dbUserName, QString dbPassword, QString dbName, int dbPort)
Definition: mythdbcon.cpp:37
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:603
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythSessionManager::CreateDigest
static QByteArray CreateDigest(const QString &username, const QString &password)
Generate a digest string.
Definition: mythsession.cpp:536
Myth::SendMessage
bool SendMessage(const QString &Message, const QString &Address, int udpPort, int Timeout) override
Definition: myth.cpp:774
DBUtil::CheckTables
static bool CheckTables(bool repair=false, const QString &options="QUICK")
Checks database tables.
Definition: dbutil.cpp:273
DatabaseParams::m_dbType
QString m_dbType
database type (MySQL, Postgres, etc.)
Definition: mythdbparams.h:27
MythCoreContext::GetDatabaseParams
DatabaseParams GetDatabaseParams(void)
Definition: mythcorecontext.h:148
Myth::GetFormatDate
QString GetFormatDate(const QDateTime &Date, bool ShortDate) override
Definition: myth.cpp:418
gBackendContext
BackendContext * gBackendContext
Definition: backendcontext.cpp:12
myth.h
DTC::LogInfo
Definition: logInfo.h:22
MythDate::kDateTimeShort
@ kDateTimeShort
Default local time.
Definition: mythdate.h:21
scheduler.h
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
mythversion.h
Myth::TestDBSettings
bool TestDBSettings(const QString &HostName, const QString &UserName, const QString &Password, const QString &DBName, int dbPort) override
Definition: myth.cpp:748
Myth::GetConnectionInfo
DTC::ConnectionInfo * GetConnectionInfo(const QString &Pin) override
Definition: myth.cpp:59
Myth::GetTimeZone
DTC::TimeZoneInfo * GetTimeZone() override
Definition: myth.cpp:403
DTC::LogMessageList
Definition: logMessageList.h:15
DatabaseParams::m_wolReconnect
int m_wolReconnect
seconds to wait for reconnect
Definition: mythdbparams.h:34
DatabaseParams::m_dbPort
int m_dbPort
database port
Definition: mythdbparams.h:23
mythdate.h
DTC::WOLInfo
Definition: wolInfo.h:22
mythlogging.h
logLevelGetName
QString logLevelGetName(LogLevel_t level)
Map a log level enumerated value back to the name.
Definition: logging.cpp:837
DTC::LogMessage
Definition: logMessage.h:20
MythSessionManager::ManageDigestUser
static bool ManageDigestUser(DigestUserActions action, const QString &username, const QString &password, const QString &newPassword, const QString &adminPassword)
Manage digest user entries.
Definition: mythsession.cpp:550
hardwareprofile.scan.profile
profile
Definition: scan.py:99
DTC::VersionInfo::Version
QString Version
Definition: versionInfo.h:29
DatabaseParams::m_dbHostPing
bool m_dbHostPing
Can we test connectivity using ping?
Definition: mythdbparams.h:22
DTC::StorageGroupDir
Definition: storageGroupDir.h:14
DTC::StorageGroupDirList
Definition: storageGroupDirList.h:14
HardwareProfile
Definition: hardwareprofile.h:16
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:535
MythCoreContext::GetBackendServerIP
QString GetBackendServerIP(void)
Returns the IP address of the locally defined backend IP.
Definition: mythcorecontext.cpp:1025
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:178
BackendContext::GetFrontends
QMap< QString, Frontend * > GetFrontends() const
Definition: backendcontext.h:52
Myth::GetFormatDateTime
QString GetFormatDateTime(const QDateTime &DateTime, bool ShortDate) override
Definition: myth.cpp:431
logLevelGet
LogLevel_t logLevelGet(const QString &level)
Map a log level name back to the enumerated value.
Definition: logging.cpp:815
Myth::ProfileUpdated
QString ProfileUpdated(void) override
Definition: myth.cpp:1006
kDB_Backup_Completed
@ kDB_Backup_Completed
Definition: dbutil.h:13
HardwareProfile::GetHardwareProfile
static QString GetHardwareProfile(void)
Definition: hardwareprofile.cpp:263
Myth::ProfileDelete
bool ProfileDelete(void) override
Definition: myth.cpp:974
MythDate::kAutoYear
@ kAutoYear
Add year only if different from current year.
Definition: mythdate.h:25
DigestUserActions
DigestUserActions
Definition: mythsession.h:10
MythDate::kDateShort
@ kDateShort
Default local time.
Definition: mythdate.h:17
DBUtil
Aggregates database and DBMS utility functions.
Definition: dbutil.h:30
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:637
MythCoreContext::GetNumSettingOnHost
int GetNumSettingOnHost(const QString &key, const QString &host, int defaultval=0)
Definition: mythcorecontext.cpp:964
DBUtil::BackupDB
static MythDBBackupStatus BackupDB(QString &filename, bool disableRotation=false)
Requests a backup of the database.
Definition: dbutil.cpp:185
Myth::PutSetting
bool PutSetting(const QString &HostName, const QString &Key, const QString &Value) override
Definition: myth.cpp:717
storagegroup.h
DatabaseParams::m_dbPassword
QString m_dbPassword
DB password.
Definition: mythdbparams.h:25
PID
Contains Packet Identifier numeric values.
Definition: mpegtables.h:206
Myth::SendNotification
bool SendNotification(bool Error, const QString &Type, const QString &Message, const QString &Origin, const QString &Description, const QString &Image, const QString &Extra, const QString &ProgressText, float Progress, int Duration, bool Fullscreen, uint Visibility, uint Priority, const QString &Address, int udpPort) override
Definition: myth.cpp:827
DatabaseParams::m_wolRetry
int m_wolRetry
times to retry to reconnect
Definition: mythdbparams.h:35
DatabaseParams::m_dbName
QString m_dbName
database name
Definition: mythdbparams.h:26
MSqlQuery::isConnected
bool isConnected(void) const
Only updated once during object creation.
Definition: mythdbcon.h:135
uint
unsigned int uint
Definition: compat.h:141
MythDBBackupStatus
MythDBBackupStatus
Definition: dbutil.h:9
DIGEST_USER_REMOVE
@ DIGEST_USER_REMOVE
Definition: mythsession.h:12
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:60
DTC::EnvInfo
Definition: envInfo.h:22
Myth::GetKeys
QStringList GetKeys() override
Definition: myth.cpp:186
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:30
MythDate::kSimplify
@ kSimplify
Do Today/Yesterday/Tomorrow transform.
Definition: mythdate.h:23
BackendContext::GetConnectedFrontends
QMap< QString, Frontend * > GetConnectedFrontends() const
Definition: backendcontext.h:51
MYTH_BINARY_VERSION
#define MYTH_BINARY_VERSION
Update this whenever the plug-in ABI changes.
Definition: mythversion.h:15
MYTH_PROTO_VERSION
#define MYTH_PROTO_VERSION
Increment this whenever the MythTV network protocol changes.
Definition: mythversion.h:47
MythTZ::calc_utc_offset
int calc_utc_offset(void)
Definition: mythtimezone.cpp:24
Myth::CheckDatabase
bool CheckDatabase(bool Repair) override
Definition: myth.cpp:932
Myth::ManageDigestUser
bool ManageDigestUser(const QString &Action, const QString &UserName, const QString &Password, const QString &NewPassword, const QString &AdminPassword) override
Definition: myth.cpp:1072
Myth::GetLogs
DTC::LogMessageList * GetLogs(const QString &HostName, const QString &Application, int PID, int TID, const QString &Thread, const QString &Filename, int Line, const QString &Function, const QDateTime &FromTime, const QDateTime &ToTime, const QString &Level, const QString &MsgContains) override
Definition: myth.cpp:467
mythcorecontext.h
DTC::BackendInfo
Definition: backendInfo.h:24
DatabaseParams::m_wolCommand
QString m_wolCommand
command to use for wake-on-lan
Definition: mythdbparams.h:36
MythCoreContext::GetSettingOnHost
QString GetSettingOnHost(const QString &key, const QString &host, const QString &defaultval="")
Definition: mythcorecontext.cpp:947
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:864
MythDate::ISODate
@ ISODate
Default UTC.
Definition: mythdate.h:14
DatabaseParams::m_dbUserName
QString m_dbUserName
DB user name.
Definition: mythdbparams.h:24
DTC::DatabaseInfo
Definition: databaseInfo.h:22
Myth::ParseISODateString
QDateTime ParseISODateString(const QString &DateTime) override
Definition: myth.cpp:453
MythDate::kDateFull
@ kDateFull
Default local time.
Definition: mythdate.h:16
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:859
MYTH_DATABASE_VERSION
#define MYTH_DATABASE_VERSION
Increment this whenever the MythTV core database schema changes.
Definition: mythversion.h:77
DIGEST_USER_ADD
@ DIGEST_USER_ADD
Definition: mythsession.h:11
Myth::GetSettingList
DTC::SettingList * GetSettingList(const QString &HostName) override
Definition: myth.cpp:664
logPropagateArgs
QString logPropagateArgs
Definition: logging.cpp:86
Myth::ChangePassword
bool ChangePassword(const QString &UserName, const QString &OldPassword, const QString &NewPassword) override
Definition: myth.cpp:733
Myth::GetHosts
QStringList GetHosts() override
Definition: myth.cpp:151
kDB_Backup_Unknown
@ kDB_Backup_Unknown
Definition: dbutil.h:11
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
DatabaseParams::m_localEnabled
bool m_localEnabled
true if localHostName is not default
Definition: mythdbparams.h:29
MythDate::kDateTimeFull
@ kDateTimeFull
Default local time.
Definition: mythdate.h:20
Myth::ManageUrlProtection
bool ManageUrlProtection(const QString &Services, const QString &AdminPassword) override
Definition: myth.cpp:1104
MythDate::kTime
@ kTime
Default local time.
Definition: mythdate.h:19
Myth::ProfileText
QString ProfileText(void) override
Definition: myth.cpp:1024
DatabaseParams::m_wolEnabled
bool m_wolEnabled
true if wake-on-lan params are used
Definition: mythdbparams.h:33
DatabaseParams::m_localHostName
QString m_localHostName
name used for loading/saving settings
Definition: mythdbparams.h:30
query
MSqlQuery query(MSqlQuery::InitCon())
MythCoreContext::SaveSettingOnHost
bool SaveSettingOnHost(const QString &key, const QString &newValue, const QString &host)
Definition: mythcorecontext.cpp:912
DTC::Frontend
Definition: libs/libmythservicecontracts/datacontracts/frontend.h:24
Priority
Definition: channelsettings.cpp:191
mythtimezone.h
Myth::ProfileURL
QString ProfileURL(void) override
Definition: myth.cpp:990
Myth::GetFormatTime
QString GetFormatTime(const QDateTime &Time) override
Definition: myth.cpp:444
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:919
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:808
DTC::LabelValue
Definition: labelValue.h:19
Myth::GetFrontends
DTC::FrontendList * GetFrontends(bool OnLine) override
Definition: myth.cpp:599