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  QMap<QString, Frontend*>::const_iterator it;
605  for (it = frontends.begin(); it != frontends.end(); ++it)
606  {
607  DTC::Frontend *pFrontend = pList->AddNewFrontend();
608  pFrontend->setName((*it)->m_name);
609  pFrontend->setIP((*it)->m_ip.toString());
610  int port = gCoreContext->GetNumSettingOnHost("FrontendStatusPort",
611  (*it)->m_name, 6547);
612  pFrontend->setPort(port);
613  pFrontend->setOnLine((*it)->m_connectionCount > 0);
614  }
615 
616  return pList;
617 }
618 
620 //
622 
623 QString Myth::GetSetting( const QString &sHostName,
624  const QString &sKey,
625  const QString &sDefault )
626 {
627  if (sKey.isEmpty())
628  throw( QString("Missing or empty Key (settings.value)") );
629 
630  if (sHostName == "_GLOBAL_")
631  {
633 
634  query.prepare("SELECT data FROM settings "
635  "WHERE value = :VALUE "
636  "AND (hostname IS NULL)" );
637 
638  query.bindValue(":VALUE", sKey );
639 
640  if (!query.exec())
641  {
642  MythDB::DBError("API Myth/GetSetting ", query);
643  throw( QString( "Database Error executing query." ));
644  }
645 
646  return query.next() ? query.value(0).toString() : sDefault;
647  }
648 
649  QString hostname = sHostName;
650 
651  if (sHostName.isEmpty())
653 
654  return gCoreContext->GetSettingOnHost(sKey, hostname, sDefault);
655 }
656 
658 //
660 
661 DTC::SettingList *Myth::GetSettingList(const QString &sHostName)
662 {
663 
665 
666  if (!query.isConnected())
667  {
668  throw( QString("Database not open while trying to load settings for host: %1")
669  .arg( sHostName ));
670  }
671 
672  auto *pList = new DTC::SettingList();
673 
674  //pList->setObjectName( "Settings" );
675  pList->setHostName ( sHostName );
676 
677  // ------------------------------------------------------------------
678  // Looking to return all Setting for supplied hostname
679  // ------------------------------------------------------------------
680 
681  if (sHostName.isEmpty())
682  {
683  query.prepare("SELECT value, data FROM settings "
684  "WHERE (hostname IS NULL)" );
685  }
686  else
687  {
688  query.prepare("SELECT value, data FROM settings "
689  "WHERE (hostname = :HOSTNAME)" );
690 
691  query.bindValue(":HOSTNAME", sHostName );
692  }
693 
694  if (!query.exec())
695  {
696  // clean up unused object we created.
697 
698  delete pList;
699 
700  MythDB::DBError("MythAPI::GetSetting() w/o key ", query);
701  throw( QString( "Database Error executing query." ));
702  }
703 
704  while (query.next())
705  pList->Settings().insert( query.value(0).toString(), query.value(1) );
706 
707  return pList;
708 }
709 
711 //
713 
714 bool Myth::PutSetting( const QString &sHostName,
715  const QString &sKey,
716  const QString &sValue )
717 {
718  if (!sKey.isEmpty())
719  {
720  return gCoreContext->SaveSettingOnHost( sKey, sValue, sHostName );
721  }
722 
723  throw ( QString( "Key Required" ));
724 }
725 
727 //
729 
730 bool Myth::ChangePassword( const QString &sUserName,
731  const QString &sOldPassword,
732  const QString &sNewPassword )
733 {
734  LOG(VB_GENERAL, LOG_NOTICE, "ChangePassword is deprecated, use "
735  "ManageDigestUser.");
736 
737  return ( ManageDigestUser("ChangePassword", sUserName, sOldPassword,
738  sNewPassword, "") );
739 }
740 
742 //
744 
745 bool Myth::TestDBSettings( const QString &sHostName,
746  const QString &sUserName,
747  const QString &sPassword,
748  const QString &sDBName,
749  int dbPort)
750 {
751  bool bResult = false;
752 
753  QString db("mythconverg");
754  int port = 3306;
755 
756  if (!sDBName.isEmpty())
757  db = sDBName;
758 
759  if (dbPort != 0)
760  port = dbPort;
761 
762  bResult = TestDatabase(sHostName, sUserName, sPassword, db, port);
763 
764  return bResult;
765 }
766 
768 //
770 
771 bool Myth::SendMessage( const QString &sMessage,
772  const QString &sAddress,
773  int udpPort,
774  int Timeout)
775 {
776  bool bResult = false;
777 
778  if (sMessage.isEmpty())
779  return bResult;
780 
781  if (Timeout < 0 || Timeout > 999)
782  Timeout = 0;
783 
784  QString xmlMessage =
785  "<mythmessage version=\"1\">\n"
786  " <text>" + sMessage + "</text>\n"
787  " <timeout>" + QString::number(Timeout) + "</timeout>\n"
788  "</mythmessage>";
789 
790  QHostAddress address = QHostAddress::Broadcast;
791  unsigned short port = 6948;
792 
793  if (!sAddress.isEmpty())
794  address.setAddress(sAddress);
795 
796  if (udpPort != 0)
797  port = udpPort;
798 
799  auto *sock = new QUdpSocket();
800  QByteArray utf8 = xmlMessage.toUtf8();
801  int size = utf8.length();
802 
803  if (sock->writeDatagram(utf8.constData(), size, address, port) < 0)
804  {
805  LOG(VB_GENERAL, LOG_ERR,
806  QString("Failed to send UDP/XML packet (Message: %1 "
807  "Address: %2 Port: %3")
808  .arg(sMessage).arg(sAddress).arg(port));
809  }
810  else
811  {
812  LOG(VB_GENERAL, LOG_DEBUG,
813  QString("UDP/XML packet sent! (Message: %1 Address: %2 Port: %3")
814  .arg(sMessage)
815  .arg(address.toString().toLocal8Bit().constData()).arg(port));
816  bResult = true;
817  }
818 
819  sock->deleteLater();
820 
821  return bResult;
822 }
823 
824 bool Myth::SendNotification( bool bError,
825  const QString &Type,
826  const QString &sMessage,
827  const QString &sOrigin,
828  const QString &sDescription,
829  const QString &sImage,
830  const QString &sExtra,
831  const QString &sProgressText,
832  float fProgress,
833  int Duration,
834  bool bFullscreen,
835  uint Visibility,
836  uint Priority,
837  const QString &sAddress,
838  int udpPort )
839 {
840  bool bResult = false;
841 
842  if (sMessage.isEmpty())
843  return bResult;
844 
845  if (Duration < 0 || Duration > 999)
846  Duration = -1;
847 
848  QString xmlMessage =
849  "<mythnotification version=\"1\">\n"
850  " <text>" + sMessage + "</text>\n"
851  " <origin>" + (sOrigin.isNull() ? tr("MythServices") : sOrigin) + "</origin>\n"
852  " <description>" + sDescription + "</description>\n"
853  " <timeout>" + QString::number(Duration) + "</timeout>\n"
854  " <image>" + sImage + "</image>\n"
855  " <extra>" + sExtra + "</extra>\n"
856  " <progress_text>" + sProgressText + "</progress_text>\n"
857  " <progress>" + QString::number(fProgress) + "</progress>\n"
858  " <fullscreen>" + (bFullscreen ? "true" : "false") + "</fullscreen>\n"
859  " <visibility>" + QString::number(Visibility) + "</visibility>\n"
860  " <priority>" + QString::number(Priority) + "</priority>\n"
861  " <type>" + (bError ? "error" : Type) + "</type>\n"
862  "</mythnotification>";
863 
864  QHostAddress address = QHostAddress::Broadcast;
865  unsigned short port = 6948;
866 
867  if (!sAddress.isEmpty())
868  address.setAddress(sAddress);
869 
870  if (udpPort != 0)
871  port = udpPort;
872 
873  auto *sock = new QUdpSocket();
874  QByteArray utf8 = xmlMessage.toUtf8();
875  int size = utf8.length();
876 
877  if (sock->writeDatagram(utf8.constData(), size, address, port) < 0)
878  {
879  LOG(VB_GENERAL, LOG_ERR,
880  QString("Failed to send UDP/XML packet (Notification: %1 "
881  "Address: %2 Port: %3")
882  .arg(sMessage).arg(sAddress).arg(port));
883  }
884  else
885  {
886  LOG(VB_GENERAL, LOG_DEBUG,
887  QString("UDP/XML packet sent! (Notification: %1 Address: %2 Port: %3")
888  .arg(sMessage)
889  .arg(address.toString().toLocal8Bit().constData()).arg(port));
890  bResult = true;
891  }
892 
893  sock->deleteLater();
894 
895  return bResult;
896 }
897 
899 //
901 
903 {
904  bool bResult = false;
905 
906  DBUtil dbutil;
908  QString filename;
909 
910  LOG(VB_GENERAL, LOG_NOTICE, "Performing API invoked DB Backup.");
911 
912  status = DBUtil::BackupDB(filename);
913 
914  if (status == kDB_Backup_Completed)
915  {
916  LOG(VB_GENERAL, LOG_NOTICE, "Database backup succeeded.");
917  bResult = true;
918  }
919  else
920  LOG(VB_GENERAL, LOG_ERR, "Database backup failed.");
921 
922  return bResult;
923 }
924 
926 //
928 
929 bool Myth::CheckDatabase( bool repair )
930 {
931  LOG(VB_GENERAL, LOG_NOTICE, "Performing API invoked DB Check.");
932 
933  bool bResult = DBUtil::CheckTables(repair);
934 
935  if (bResult)
936  LOG(VB_GENERAL, LOG_NOTICE, "Database check complete.");
937  else
938  LOG(VB_GENERAL, LOG_ERR, "Database check failed.");
939 
940  return bResult;
941 }
942 
944 {
945  auto *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
946  scheduler->DelayShutdown();
947  LOG(VB_GENERAL, LOG_NOTICE, "Shutdown delayed 5 minutes for external application.");
948  return true;
949 }
950 
952 //
954 
956 {
958  LOG(VB_GENERAL, LOG_NOTICE, "Profile Submission...");
959  profile.GenerateUUIDs();
960  bool bResult = profile.SubmitProfile();
961  if (bResult)
962  LOG(VB_GENERAL, LOG_NOTICE, "Profile Submitted.");
963 
964  return bResult;
965 }
966 
968 //
970 
972 {
974  LOG(VB_GENERAL, LOG_NOTICE, "Profile Deletion...");
975  profile.GenerateUUIDs();
976  bool bResult = profile.DeleteProfile();
977  if (bResult)
978  LOG(VB_GENERAL, LOG_NOTICE, "Profile Deleted.");
979 
980  return bResult;
981 }
982 
984 //
986 
988 {
989  QString sProfileURL;
990 
992  profile.GenerateUUIDs();
993  sProfileURL = profile.GetProfileURL();
994  LOG(VB_GENERAL, LOG_NOTICE, QString("ProfileURL: %1").arg(sProfileURL));
995 
996  return sProfileURL;
997 }
998 
1000 //
1002 
1004 {
1005  QString sProfileUpdate;
1006 
1008  profile.GenerateUUIDs();
1009  QDateTime tUpdated;
1010  tUpdated = profile.GetLastUpdate();
1011  sProfileUpdate = tUpdated.toString(
1012  gCoreContext->GetSetting( "DateFormat", "MM.dd.yyyy"));
1013 
1014  return sProfileUpdate;
1015 }
1016 
1018 //
1020 
1022 {
1023  QString sProfileText;
1024 
1026  sProfileText = HardwareProfile::GetHardwareProfile();
1027 
1028  return sProfileText;
1029 }
1030 
1032 //
1034 
1036 {
1037 
1038  // ----------------------------------------------------------------------
1039  // Create and populate a Configuration object
1040  // ----------------------------------------------------------------------
1041 
1042  auto *pInfo = new DTC::BackendInfo();
1043  DTC::BuildInfo *pBuild = pInfo->Build();
1044  DTC::EnvInfo *pEnv = pInfo->Env();
1045  DTC::LogInfo *pLog = pInfo->Log();
1046 
1047  pBuild->setVersion ( MYTH_SOURCE_VERSION );
1048  pBuild->setLibX264 ( CONFIG_LIBX264 );
1049  pBuild->setLibDNS_SD ( CONFIG_LIBDNS_SD );
1050  pEnv->setLANG ( getenv("LANG") );
1051  pEnv->setLCALL ( getenv("LC_ALL") );
1052  pEnv->setLCCTYPE ( getenv("LC_CTYPE") );
1053  pEnv->setHOME ( getenv("HOME") );
1054  pEnv->setMYTHCONFDIR ( getenv("MYTHCONFDIR") );
1055  pLog->setLogArgs ( logPropagateArgs );
1056 
1057  // ----------------------------------------------------------------------
1058  // Return the pointer... caller is responsible to delete it!!!
1059  // ----------------------------------------------------------------------
1060 
1061  return pInfo;
1062 
1063 }
1064 
1066 //
1068 
1069 bool Myth::ManageDigestUser( const QString &sAction,
1070  const QString &sUserName,
1071  const QString &sPassword,
1072  const QString &sNewPassword,
1073  const QString &sAdminPassword )
1074 {
1075 
1076  DigestUserActions sessionAction = DIGEST_USER_ADD;
1077 
1078  if (sAction == "Add")
1079  sessionAction = DIGEST_USER_ADD;
1080  else if (sAction == "Remove")
1081  sessionAction = DIGEST_USER_REMOVE;
1082  else if (sAction == "ChangePassword")
1083  sessionAction = DIGEST_USER_CHANGE_PW;
1084  else
1085  {
1086  LOG(VB_GENERAL, LOG_ERR, QString("Action must be Add, Remove or "
1087  "ChangePassword, not '%1'")
1088  .arg(sAction));
1089  return false;
1090  }
1091 
1092  return MythSessionManager::ManageDigestUser(sessionAction, sUserName,
1093  sPassword, sNewPassword,
1094  sAdminPassword);
1095 }
1096 
1098 //
1100 
1101 bool Myth::ManageUrlProtection( const QString &sServices,
1102  const QString &sAdminPassword )
1103 {
1104  if (!MythSessionManager::IsValidUser("admin"))
1105  {
1106  LOG(VB_GENERAL, LOG_ERR, QString("Backend has no '%1' user!")
1107  .arg("admin"));
1108  return false;
1109  }
1110 
1111  if (MythSessionManager::CreateDigest("admin", sAdminPassword) !=
1113  {
1114  LOG(VB_GENERAL, LOG_ERR, QString("Incorrect password for user: %1")
1115  .arg("admin"));
1116  return false;
1117  }
1118 
1119  QStringList serviceList = sServices.split(",");
1120 
1121  serviceList.removeDuplicates();
1122 
1123  QStringList protectedURLs;
1124 
1125  if (serviceList.size() == 1 && serviceList.first() == "All")
1126  {
1127  for (const QString& service : KnownServices)
1128  protectedURLs << '/' + service;
1129  }
1130  else if (serviceList.size() == 1 && serviceList.first() == "None")
1131  {
1132  protectedURLs << "Unprotected";
1133  }
1134  else
1135  {
1136  for (const QString& service : serviceList)
1137  {
1138  if (KnownServices.contains(service))
1139  protectedURLs << '/' + service;
1140  else
1141  LOG(VB_GENERAL, LOG_ERR, QString("Invalid service name: '%1'")
1142  .arg(service));
1143  }
1144  }
1145 
1146  if (protectedURLs.isEmpty())
1147  {
1148  LOG(VB_GENERAL, LOG_ERR, "No valid Services were found");
1149  return false;
1150  }
1151 
1152  return gCoreContext->SaveSettingOnHost("HTTP/Protected/Urls",
1153  protectedURLs.join(';'), "");
1154 }
serviceUtil.h
Myth::GetBackendInfo
DTC::BackendInfo * GetBackendInfo(void) override
Definition: myth.cpp:1035
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: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:902
DTC::BuildInfo
Definition: buildInfo.h:22
Myth::DelayShutdown
bool DelayShutdown(void) override
Definition: myth.cpp:943
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:973
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:216
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: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:623
Myth::ProfileSubmit
bool ProfileSubmit(void) override
Definition: myth.cpp:955
MythCoreContext::GetScheduler
MythScheduler * GetScheduler(void)
Definition: mythcorecontext.cpp:1885
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:40
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:52
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:136
DTC::VersionInfo
Definition: versionInfo.h:22
Scheduler::DelayShutdown
void DelayShutdown()
Definition: scheduler.cpp:3048
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:771
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:138
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:745
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: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:857
DTC::LogMessage
Definition: logMessage.h:20
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:14
DTC::StorageGroupDirList
Definition: storageGroupDirList.h:14
Myth::GetFormatDateTime
QString GetFormatDateTime(QDateTime DateTime, bool ShortDate) override
Definition: myth.cpp:427
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:1022
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:179
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:835
Myth::ProfileUpdated
QString ProfileUpdated(void) override
Definition: myth.cpp:1003
kDB_Backup_Completed
@ kDB_Backup_Completed
Definition: dbutil.h:13
HardwareProfile::GetHardwareProfile
static QString GetHardwareProfile(void)
Definition: hardwareprofile.cpp:264
Myth::ProfileDelete
bool ProfileDelete(void) override
Definition: myth.cpp:971
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:634
MythCoreContext::GetNumSettingOnHost
int GetNumSettingOnHost(const QString &key, const QString &host, int defaultval=0)
Definition: mythcorecontext.cpp:961
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:714
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:824
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: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:57
DTC::EnvInfo
Definition: envInfo.h:22
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:16
MYTH_PROTO_VERSION
#define MYTH_PROTO_VERSION
Increment this whenever the MythTV network protocol changes.
Definition: mythversion.h:48
MythTZ::calc_utc_offset
int calc_utc_offset(void)
Definition: mythtimezone.cpp:20
Myth::CheckDatabase
bool CheckDatabase(bool Repair) override
Definition: myth.cpp:929
Myth::ManageDigestUser
bool ManageDigestUser(const QString &Action, const QString &UserName, const QString &Password, const QString &NewPassword, const QString &AdminPassword) override
Definition: myth.cpp:1069
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: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:944
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:449
MythDate::kDateFull
@ kDateFull
Default local time.
Definition: mythdate.h:16
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:856
MYTH_DATABASE_VERSION
#define MYTH_DATABASE_VERSION
Increment this whenever the MythTV core database schema changes.
Definition: mythversion.h:78
DIGEST_USER_ADD
@ DIGEST_USER_ADD
Definition: mythsession.h:11
Myth::GetSettingList
DTC::SettingList * GetSettingList(const QString &HostName) override
Definition: myth.cpp:661
logPropagateArgs
QString logPropagateArgs
Definition: logging.cpp:89
Myth::ChangePassword
bool ChangePassword(const QString &UserName, const QString &OldPassword, const QString &NewPassword) override
Definition: myth.cpp:730
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:1101
MythDate::kTime
@ kTime
Default local time.
Definition: mythdate.h:19
Myth::ProfileText
QString ProfileText(void) override
Definition: myth.cpp:1021
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:909
DTC::Frontend
Definition: libs/libmythservicecontracts/datacontracts/frontend.h:24
Priority
Definition: channelsettings.cpp:191
mythtimezone.h
Myth::GetFormatTime
QString GetFormatTime(QDateTime Time) override
Definition: myth.cpp:440
Myth::ProfileURL
QString ProfileURL(void) override
Definition: myth.cpp:987
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:916
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:595