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