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