MythTV  master
backendhousekeeper.cpp
Go to the documentation of this file.
1 // POSIX headers
2 #include <unistd.h>
3 #include <sys/types.h>
4 
5 // ANSI C headers
6 #include <cstdlib>
7 
8 // Qt headers
9 #include <QDateTime>
10 #include <QDir>
11 #include <QFileInfo>
12 #include <QStringList>
13 
14 // MythTV headers
15 #include "libmythbase/exitcodes.h"
17 #include "libmythbase/mythdb.h"
18 #include "libmythbase/mythdirs.h"
21 #include "libmythbase/mythversion.h"
25 #include "libmythbase/unziputil.h"
27 #include "libmythtv/jobqueue.h"
28 
29 // MythBackend
30 #include "backendhousekeeper.h"
31 
32 static constexpr int64_t kFourHours {4LL * 60 * 60};
33 
34 #if QT_VERSION < QT_VERSION_CHECK(5,15,2)
35 #define capturedView capturedRef
36 #endif
37 
39 {
47  return true;
48 }
49 
51 {
53 
54  query.prepare("DELETE FROM inuseprograms "
55  "WHERE hostname = :HOSTNAME AND "
56  "( recusage = 'recorder' OR recusage LIKE 'Unknown %' );");
57  query.bindValue(":HOSTNAME", gCoreContext->GetHostName());
58  if (!query.exec())
59  MythDB::DBError("CleanupTask::CleanupOldRecordings", query);
60 }
61 
63 {
64  QDateTime fourHoursAgo = MythDate::current().addSecs(-kFourHours);
66 
67  query.prepare("DELETE FROM inuseprograms "
68  "WHERE lastupdatetime < :FOURHOURSAGO ;");
69  query.bindValue(":FOURHOURSAGO", fourHoursAgo);
70  if (!query.exec())
71  MythDB::DBError("CleanupTask::CleanupInUsePrograms", query);
72 }
73 
75 {
76  QDateTime fourHoursAgo = MythDate::current().addSecs(-kFourHours);
78  MSqlQuery deleteQuery(MSqlQuery::InitCon());
79 
80  // Keep these tvchains, they may be in use.
81  query.prepare("SELECT DISTINCT chainid FROM tvchain "
82  "WHERE endtime > :FOURHOURSAGO ;");
83  query.bindValue(":FOURHOURSAGO", fourHoursAgo);
84 
85  if (!query.exec() || !query.isActive())
86  {
87  MythDB::DBError("HouseKeeper Cleaning TVChain Table", query);
88  return;
89  }
90 
91  QString msg;
92  QString keepChains;
93  while (query.next())
94  {
95  if (keepChains.isEmpty())
96  keepChains = "'" + query.value(0).toString() + "'";
97  else
98  keepChains += ", '" + query.value(0).toString() + "'";
99  }
100 
101  if (keepChains.isEmpty())
102  msg = "DELETE FROM tvchain WHERE endtime < now();";
103  else
104  {
105  msg = QString("DELETE FROM tvchain "
106  "WHERE chainid NOT IN ( %1 ) AND endtime < now();")
107  .arg(keepChains);
108  }
109  deleteQuery.prepare(msg);
110  if (!deleteQuery.exec())
111  MythDB::DBError("CleanupTask::CleanupOrphanedLiveTV", deleteQuery);
112 }
113 
115 {
116  MSqlQuery query(MSqlQuery::InitCon());
117  MSqlQuery deleteQuery(MSqlQuery::InitCon());
118  // tables[tableIndex][0] is the table name
119  // tables[tableIndex][1] is the name of the column on which the join is
120  // performed
121  std::array<std::array<QString,2>,5> tables {{
122  { "recordedprogram", "progstart" },
123  { "recordedrating", "progstart" },
124  { "recordedcredits", "progstart" },
125  { "recordedmarkup", "starttime" },
126  { "recordedseek", "starttime" },
127  }};
128 
129  // Because recordedseek can have millions of rows, we don't want to JOIN it
130  // with recorded. Instead, pull out DISTINCT chanid and starttime into a
131  // temporary table (resulting in tens, hundreds, or--at most--a few
132  // thousand rows) for the JOIN
133  QString querystr;
134  querystr = "CREATE TEMPORARY TABLE IF NOT EXISTS temprecordedcleanup ( "
135  "chanid int(10) unsigned NOT NULL default '0', "
136  "starttime datetime NOT NULL default '0000-00-00 00:00:00' "
137  ");";
138 
139  if (!query.exec(querystr))
140  {
141  MythDB::DBError("CleanupTask::CleanupRecordedTables"
142  "(creating temporary table)", query);
143  return;
144  }
145 
146  for (const auto & [table,column] : tables)
147  {
148  query.prepare(QString("TRUNCATE TABLE temprecordedcleanup;"));
149  if (!query.exec() || !query.isActive())
150  {
151  MythDB::DBError("CleanupTask::CleanupRecordedTables"
152  "(truncating temporary table)", query);
153  return;
154  }
155 
156  query.prepare(QString("INSERT INTO temprecordedcleanup "
157  "( chanid, starttime ) "
158  "SELECT DISTINCT chanid, starttime "
159  "FROM %1;")
160  .arg(table));
161 
162  if (!query.exec() || !query.isActive())
163  {
164  MythDB::DBError("CleanupTask::CleanupRecordedTables"
165  "(cleaning recorded tables)", query);
166  return;
167  }
168 
169  query.prepare(QString("SELECT DISTINCT p.chanid, p.starttime "
170  "FROM temprecordedcleanup p "
171  "LEFT JOIN recorded r "
172  "ON p.chanid = r.chanid "
173  "AND p.starttime = r.%1 "
174  "WHERE r.chanid IS NULL;").arg(column));
175  if (!query.exec() || !query.isActive())
176  {
177  MythDB::DBError("CleanupTask::CleanupRecordedTables"
178  "(cleaning recorded tables)", query);
179  return;
180  }
181 
182  deleteQuery.prepare(QString("DELETE FROM %1 "
183  "WHERE chanid = :CHANID "
184  "AND starttime = :STARTTIME;")
185  .arg(table));
186  while (query.next())
187  {
188  deleteQuery.bindValue(":CHANID", query.value(0).toString());
189  deleteQuery.bindValue(":STARTTIME", query.value(1));
190  if (!deleteQuery.exec())
191  {
192  MythDB::DBError("CleanupTask::CleanupRecordedTables"
193  "(cleaning recorded tables)", deleteQuery);
194  return;
195  }
196  }
197  }
198 
199  if (!query.exec("DROP TABLE temprecordedcleanup;"))
200  MythDB::DBError("CleanupTask::CleanupRecordedTables"
201  "(deleting temporary table)", query);
202 }
203 
205 {
206  MSqlQuery query(MSqlQuery::InitCon());
207  MSqlQuery deleteQuery(MSqlQuery::InitCon());
208 
209  query.prepare(QString("DELETE channel "
210  "FROM channel "
211  "LEFT JOIN recorded r "
212  " ON r.chanid = channel.chanid "
213  "LEFT JOIN oldrecorded o "
214  " ON o.chanid = channel.chanid "
215  "WHERE channel.deleted IS NOT NULL "
216  " AND channel.deleted < "
217  " DATE_SUB(NOW(), INTERVAL 1 DAY) "
218  " AND r.chanid IS NULL "
219  " AND o.chanid IS NULL"));
220  if (!query.exec())
221  MythDB::DBError("CleanupTask::CleanupChannelTables "
222  "(channel table)", query);
223 
224  query.prepare(QString("DELETE dtv_multiplex "
225  "FROM dtv_multiplex "
226  "LEFT JOIN channel c "
227  " ON c.mplexid = dtv_multiplex.mplexid "
228  "WHERE c.chanid IS NULL"));
229  if (!query.exec())
230  MythDB::DBError("CleanupTask::CleanupChannelTables "
231  "(dtv_multiplex table)", query);
232 }
233 
235 {
236  MSqlQuery query(MSqlQuery::InitCon());
237  // Keep as many days of listings data as we keep matching, non-recorded
238  // oldrecorded entries to allow for easier post-mortem analysis
239  int offset = gCoreContext->GetNumSetting( "CleanOldRecorded", 10);
240  // Also make sure to keep enough data so that we can flag the original
241  // airdate, for when that isn't included in guide data
242  int newEpiWindow = gCoreContext->GetNumSetting( "NewEpisodeWindow", 14);
243  if (newEpiWindow > offset)
244  offset = newEpiWindow;
245 
246  query.prepare("DELETE FROM oldprogram WHERE airdate < "
247  "DATE_SUB(CURRENT_DATE, INTERVAL 320 DAY);");
248  if (!query.exec())
249  MythDB::DBError("HouseKeeper Cleaning Program Listings", query);
250 
251  query.prepare("REPLACE INTO oldprogram (oldtitle,airdate) "
252  "SELECT title,starttime FROM program "
253  "WHERE starttime < NOW() AND manualid = 0 "
254  "GROUP BY title;");
255  if (!query.exec())
256  MythDB::DBError("HouseKeeper Cleaning Program Listings", query);
257 
258  query.prepare("DELETE FROM program WHERE starttime <= "
259  "DATE_SUB(CURRENT_DATE, INTERVAL :OFFSET DAY);");
260  query.bindValue(":OFFSET", offset);
261  if (!query.exec())
262  MythDB::DBError("HouseKeeper Cleaning Program Listings", query);
263 
264  query.prepare("DELETE FROM programrating WHERE starttime <= "
265  "DATE_SUB(CURRENT_DATE, INTERVAL :OFFSET DAY);");
266  query.bindValue(":OFFSET", offset);
267  if (!query.exec())
268  MythDB::DBError("HouseKeeper Cleaning Program Listings", query);
269 
270  query.prepare("DELETE FROM programgenres WHERE starttime <= "
271  "DATE_SUB(CURRENT_DATE, INTERVAL :OFFSET DAY);");
272  query.bindValue(":OFFSET", offset);
273  if (!query.exec())
274  MythDB::DBError("HouseKeeper Cleaning Program Listings", query);
275 
276  query.prepare("DELETE FROM credits WHERE starttime <= "
277  "DATE_SUB(CURRENT_DATE, INTERVAL :OFFSET DAY);");
278  query.bindValue(":OFFSET", offset);
279  if (!query.exec())
280  MythDB::DBError("HouseKeeper Cleaning Program Listings", query);
281 
282  query.prepare("DELETE FROM record WHERE (type = :SINGLE "
283  "OR type = :OVERRIDE OR type = :DONTRECORD) "
284  "AND enddate < CURDATE();");
285  query.bindValue(":SINGLE", kSingleRecord);
286  query.bindValue(":OVERRIDE", kOverrideRecord);
287  query.bindValue(":DONTRECORD", kDontRecord);
288  if (!query.exec())
289  MythDB::DBError("HouseKeeper Cleaning Program Listings", query);
290 
291  MSqlQuery findq(MSqlQuery::InitCon());
292  findq.prepare("SELECT record.recordid FROM record "
293  "LEFT JOIN oldfind ON oldfind.recordid = record.recordid "
294  "WHERE type = :FINDONE AND oldfind.findid IS NOT NULL;");
295  findq.bindValue(":FINDONE", kOneRecord);
296 
297  if (findq.exec())
298  {
299  query.prepare("DELETE FROM record WHERE recordid = :RECORDID;");
300  while (findq.next())
301  {
302  query.bindValue(":RECORDID", findq.value(0).toInt());
303  if (!query.exec())
304  MythDB::DBError("HouseKeeper Cleaning Program Listings", query);
305  }
306  }
307  query.prepare("DELETE FROM oldfind WHERE findid < TO_DAYS(NOW()) - 14;");
308  if (!query.exec())
309  MythDB::DBError("HouseKeeper Cleaning Program Listings", query);
310 
311  query.prepare("DELETE FROM oldrecorded WHERE "
312  "recstatus <> :RECORDED AND duplicate = 0 AND "
313  "endtime < DATE_SUB(CURRENT_DATE, INTERVAL :CLEAN DAY);");
314  query.bindValue(":RECORDED", RecStatus::Recorded);
315  query.bindValue(":CLEAN", offset);
316  if (!query.exec())
317  MythDB::DBError("HouseKeeper Cleaning Program Listings", query);
318 }
319 
320 bool ThemeUpdateTask::DoCheckRun(const QDateTime& now)
321 {
322  return gCoreContext->GetBoolSetting("ThemeUpdateNofications", true) &&
324 }
325 
327 {
328  bool result = false;
329  QString MythVersion = GetMythSourcePath();
330 
331  // Treat devel branches as master
332  if (!MythVersion.isEmpty() && !MythVersion.startsWith("fixes/"))
333  {
334  // FIXME: For now, treat git master the same as svn trunk
335  MythVersion = "trunk";
336 
337  result |= LoadVersion(MythVersion, LOG_ERR);
338  LOG(VB_GENERAL, LOG_INFO,
339  QString("Loading themes for %1").arg(MythVersion));
340  }
341  else
342  {
343  static const QRegularExpression kVersionDateRE { "\\.[0-9]{8,}.*" };
344  MythVersion = MYTH_BINARY_VERSION; // Example: 29.20161017-1
345  MythVersion.remove(kVersionDateRE);
346  LOG(VB_GENERAL, LOG_INFO,
347  QString("Loading themes for %1").arg(MythVersion));
348  result |= LoadVersion(MythVersion, LOG_ERR);
349 
350  // If a version of the theme for this tag exists, use it...
351  static const QRegularExpression subexp
352  { "v[0-9]+\\.([0-9]+)-*", QRegularExpression::CaseInsensitiveOption };
353  auto match = subexp.match(GetMythSourceVersion());
354  if (match.hasMatch())
355  {
356  QString subversion;
357  int idx = match.capturedView(1).toInt();
358  for ( ; idx > 0; --idx)
359  {
360  subversion = MythVersion + "." + QString::number(idx);
361  LOG(VB_GENERAL, LOG_INFO,
362  QString("Loading themes for %1").arg(subversion));
363  result |= LoadVersion(subversion, LOG_INFO);
364  }
365  }
366  }
367  return result;
368 }
369 
370 bool ThemeUpdateTask::LoadVersion(const QString &version, int download_log_level)
371 {
372  QString remoteThemesDir = GetConfDir();
373  remoteThemesDir.append("/tmp/remotethemes");
374 
375  QDir dir(remoteThemesDir);
376  if (!dir.exists() && !dir.mkpath(remoteThemesDir))
377  {
378  LOG(VB_GENERAL, LOG_ERR,
379  QString("HouseKeeper: Error creating %1 "
380  "directory for remote themes info cache.")
381  .arg(remoteThemesDir));
382  return false;
383  }
384 
385  QString remoteThemesFile = remoteThemesDir;
386  remoteThemesFile.append("/themes.zip");
387 
388  m_url = QString("%1/%2/themes.zip")
389  .arg(gCoreContext->GetSetting("ThemeRepositoryURL",
390  "http://themes.mythtv.org/themes/repository"),
391  version);
392 
393  m_running = true;
394  bool result = GetMythDownloadManager()->download(m_url, remoteThemesFile);
395  m_running = false;
396 
397  if (!result)
398  {
399  LOG(VB_GENERAL, (LogLevel_t)download_log_level,
400  QString("HouseKeeper: Failed to download %1 "
401  "remote themes info package.").arg(m_url));
402  return false;
403  }
404 
405  if (!extractZIP(remoteThemesFile, remoteThemesDir))
406  {
407  LOG(VB_GENERAL, LOG_ERR,
408  QString("HouseKeeper: Error extracting %1 "
409  "remote themes info package.").arg(remoteThemesFile));
410  QFile::remove(remoteThemesFile);
411  return false;
412  }
413 
414  return true;
415 }
416 
418 {
419  if (m_running)
421  m_running = false;
422 }
423 
425  : DailyHouseKeeperTask("UpdateRadioStreams", kHKGlobal, kHKRunOnStartup)
426 {
427 }
428 
430 {
431  if (m_msMU)
432  {
433  // this should never be defined, but terminate it anyway
435  m_msMU->Term(true);
436  delete m_msMU;
437  m_msMU = nullptr;
438  }
439 
440  QString command = GetAppBinDir() + "mythutil";
441  QStringList args;
442  args << "--updateradiostreams";
444 
445  LOG(VB_GENERAL, LOG_INFO, QString("Performing Radio Streams Update: %1 %2")
446  .arg(command, args.join(" ")));
447 
449 
450  m_msMU->Run();
451  uint result = m_msMU->Wait();
452 
453  delete m_msMU;
454  m_msMU = nullptr;
455 
456  if (result != GENERIC_EXIT_OK)
457  {
458  LOG(VB_GENERAL, LOG_ERR, QString("Update Radio Streams command '%1' failed")
459  .arg(command));
460  return false;
461  }
462 
463  LOG(VB_GENERAL, LOG_INFO, QString("Radio Streams Update Complete"));
464  return true;
465 }
466 
468 {
469  delete m_msMU;
470  m_msMU = nullptr;
471 }
472 
473 bool RadioStreamUpdateTask::DoCheckRun(const QDateTime& now)
474 {
475  // we are only interested in the global setting so remove any local host setting just in case
476  QString setting = GetMythDB()->GetSettingOnHost("MusicStreamListModified", gCoreContext->GetHostName(), "");
477  if (!setting.isEmpty())
478  {
479  GetMythDB()->ClearSetting("MusicStreamListModified");
480  }
481 
482  // check we are not already running a radio stream update
483  return gCoreContext->GetSetting("MusicStreamListModified") == "Updating" &&
485 }
486 
488 {
490  // just kill it, the runner thread will handle any necessary cleanup
491  m_msMU->Term(true);
492 }
493 
495  : DailyHouseKeeperTask("RecordedArtworkUpdate", kHKGlobal, kHKRunOnStartup)
496 {
497 }
498 
500 {
501  if (m_msMML)
502  {
503  // this should never be defined, but terminate it anyway
505  m_msMML->Term(true);
506  delete m_msMML;
507  m_msMML = nullptr;
508  }
509 
510  QString command = GetAppBinDir() + "mythmetadatalookup";
511  QStringList args;
512  args << "--refresh-all-artwork";
514 
515  LOG(VB_GENERAL, LOG_INFO, QString("Performing Artwork Refresh: %1 %2")
516  .arg(command, args.join(" ")));
517 
519 
520  m_msMML->Run();
521  uint result = m_msMML->Wait();
522 
523  delete m_msMML;
524  m_msMML = nullptr;
525 
526  if (result != GENERIC_EXIT_OK)
527  {
528  LOG(VB_GENERAL, LOG_ERR, QString("Artwork command '%1' failed")
529  .arg(command));
530  return false;
531  }
532  LOG(VB_GENERAL, LOG_INFO, QString("Artwork Refresh Complete"));
533  return true;
534 }
535 
537 {
538  delete m_msMML;
539  m_msMML = nullptr;
540 }
541 
542 bool ArtworkTask::DoCheckRun(const QDateTime& now)
543 {
544  return gCoreContext->GetBoolSetting("DailyArtworkUpdates", false) &&
546 }
547 
549 {
551  // just kill it, the runner thread will handle any necessary cleanup
552  m_msMML->Term(true);
553 }
554 
556 {
558  return true;
559 }
560 
562  DailyHouseKeeperTask("MythFillDB")
563 {
565 }
566 
568 {
569  // we need to set the time window from database settings, so we cannot
570  // initialize these values in. grab them and set them afterwards
571  auto min = gCoreContext->GetDurSetting<std::chrono::hours>("MythFillMinHour", -1h);
572  auto max = gCoreContext->GetDurSetting<std::chrono::hours>("MythFillMaxHour", 23h);
573 
574  if (min == -1h)
575  {
576  min = 0h;
577  max = 23h;
578  }
579  else
580  {
581  // make sure they fall within the range of 0-23
582  min %= 24;
583  max %= 24;
584  }
585 
587 }
588 
590 {
591 // if (!gCoreContext->GetBoolSetting("MythFillGrabberSuggestsTime", true))
592 // // this feature is disabled, so don't bother with a deeper check
593 // return false;
594 //
595 // MSqlQuery result(MSqlQuery::InitCon());
596 // if (result.isConnected())
597 // {
598 // // check to see if we have any of a list of supported grabbers in use
599 // // TODO: this is really cludgy. there has to be a better way to test
600 // result.prepare("SELECT COUNT(*) FROM videosource"
601 // " WHERE xmltvgrabber IN"
602 // " ( 'technovera' );");
603 // if ((result.exec()) &&
604 // (result.next()) &&
605 // (result.value(0).toInt() > 0))
606 // return true;
607 // }
608 
609  return gCoreContext->GetBoolSetting("MythFillGrabberSuggestsTime", true);
610 }
611 
612 bool MythFillDatabaseTask::DoCheckRun(const QDateTime& now)
613 {
614  if (!gCoreContext->GetBoolSetting("MythFillEnabled", true))
615  {
616  // we don't want to run this manually, so abort early
617  LOG(VB_GENERAL, LOG_DEBUG, "MythFillDatabase is disabled. Cannot run.");
618  return false;
619  }
620 
621 // if (m_running)
622 // // we're still running from the previous pass, so abort early
623 // return false;
624 
625  if (UseSuggestedTime())
626  {
627  QDateTime nextRun = MythDate::fromString(
628  gCoreContext->GetSetting("MythFillSuggestedRunTime",
629  "1970-01-01T00:00:00"));
630  LOG(VB_GENERAL, LOG_DEBUG,
631  QString("MythFillDatabase scheduled to run at %1.")
632  .arg(nextRun.toString()));
633  // is it yet time
634  return nextRun <= now;
635  }
636  if (InWindow(now))
637  // we're inside our permitted window
638  return true;
639 
640  // just let DailyHouseKeeperTask handle things
641  LOG(VB_GENERAL, LOG_DEBUG, "Performing daily run check.");
643 }
644 
646 {
647  if (m_msMFD)
648  {
649  // this should never be defined, but terminate it anyway
651  m_msMFD->Term(true);
652  delete m_msMFD;
653  m_msMFD = nullptr;
654  }
655 
656  QString mfpath = gCoreContext->GetSetting("MythFillDatabasePath",
657  "mythfilldatabase");
658  QString mfarg = gCoreContext->GetSetting("MythFillDatabaseArgs", "");
659 
661  if (mfpath == "mythfilldatabase")
662  {
664  mfpath = GetAppBinDir() + "mythfilldatabase";
665  }
666 
667  QString cmd = QString("%1 %2").arg(mfpath, mfarg);
668 
669  m_msMFD = new MythSystemLegacy(cmd, opts);
670 
671  m_msMFD->Run();
672  uint result = m_msMFD->Wait();
673 
674  delete m_msMFD;
675  m_msMFD = nullptr;
676 
677  if (result != GENERIC_EXIT_OK)
678  {
679  LOG(VB_GENERAL, LOG_ERR, QString("MythFillDatabase command '%1' failed")
680  .arg(cmd));
681  return false;
682  }
683 
684  return true;
685 }
686 
688 {
689  delete m_msMFD;
690  m_msMFD = nullptr;
691 }
692 
694 {
696  // just kill it, the runner thread will handle any necessary cleanup
697  m_msMFD->Term(true);
698 }
ArtworkTask::ArtworkTask
ArtworkTask(void)
Definition: backendhousekeeper.cpp:494
MSqlQuery::isActive
bool isActive(void) const
Definition: mythdbcon.h:216
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:811
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:128
build_compdb.args
args
Definition: build_compdb.py:11
JobQueueRecoverTask::DoRun
bool DoRun(void) override
Definition: backendhousekeeper.cpp:555
extractZIP
bool extractZIP(QString zipFile, const QString &outDir)
Definition: unziputil.cpp:17
ThemeUpdateTask::m_running
bool m_running
Definition: backendhousekeeper.h:45
MythFillDatabaseTask::DoRun
bool DoRun(void) override
Definition: backendhousekeeper.cpp:645
kVersionDateRE
static const QRegularExpression kVersionDateRE
Definition: themechooser.cpp:44
MythSystemLegacy::Term
void Term(bool force=false)
Definition: mythsystemlegacy.cpp:285
unziputil.h
mythdb.h
MythSystemLegacy
Definition: mythsystemlegacy.h:67
MythFillDatabaseTask::SetHourWindowFromDB
void SetHourWindowFromDB(void)
Definition: backendhousekeeper.cpp:567
MythSystemLegacy::GetStatus
uint GetStatus(void) const
Definition: mythsystemlegacy.h:122
CleanupTask::DoRun
bool DoRun(void) override
Definition: backendhousekeeper.cpp:38
RadioStreamUpdateTask::Terminate
void Terminate(void) override
Definition: backendhousekeeper.cpp:487
ThemeUpdateTask::DoCheckRun
bool DoCheckRun(const QDateTime &now) override
Definition: backendhousekeeper.cpp:320
CleanupTask::CleanupInUsePrograms
static void CleanupInUsePrograms(void)
Definition: backendhousekeeper.cpp:62
MythFillDatabaseTask::m_msMFD
MythSystemLegacy * m_msMFD
Definition: backendhousekeeper.h:86
recordingstatus.h
GetMythSourceVersion
const char * GetMythSourceVersion()
Definition: mythversion.cpp:5
ArtworkTask::DoCheckRun
bool DoCheckRun(const QDateTime &now) override
Definition: backendhousekeeper.cpp:542
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:205
RadioStreamUpdateTask::~RadioStreamUpdateTask
~RadioStreamUpdateTask(void) override
Definition: backendhousekeeper.cpp:467
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:617
ThemeUpdateTask::Terminate
void Terminate(void) override
Definition: backendhousekeeper.cpp:417
PeriodicHouseKeeperTask::DoCheckRun
bool DoCheckRun(const QDateTime &now) override
Definition: housekeeper.cpp:375
RecStatus::Recorded
@ Recorded
Definition: recordingstatus.h:29
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
ArtworkTask::DoRun
bool DoRun(void) override
Definition: backendhousekeeper.cpp:499
GetMythDB
MythDB * GetMythDB(void)
Definition: mythdb.cpp:50
CleanupTask::CleanupOldRecordings
static void CleanupOldRecordings(void)
Definition: backendhousekeeper.cpp:50
mythdirs.h
recordingtypes.h
ThemeUpdateTask::m_url
QString m_url
Definition: backendhousekeeper.h:46
GENERIC_EXIT_OK
@ GENERIC_EXIT_OK
Exited with no error.
Definition: exitcodes.h:11
RadioStreamUpdateTask::m_msMU
MythSystemLegacy * m_msMU
Definition: backendhousekeeper.h:31
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:14
DailyHouseKeeperTask::InWindow
bool InWindow(const QDateTime &now) override
Definition: housekeeper.cpp:492
mythsystemlegacy.h
programtypes.h
RadioStreamUpdateTask::RadioStreamUpdateTask
RadioStreamUpdateTask(void)
Definition: backendhousekeeper.cpp:424
MythFillDatabaseTask::MythFillDatabaseTask
MythFillDatabaseTask(void)
Definition: backendhousekeeper.cpp:561
GetConfDir
QString GetConfDir(void)
Definition: mythdirs.cpp:256
CleanupTask::CleanupRecordedTables
static void CleanupRecordedTables(void)
Definition: backendhousekeeper.cpp:114
ArtworkTask::~ArtworkTask
~ArtworkTask(void) override
Definition: backendhousekeeper.cpp:536
MythFillDatabaseTask::~MythFillDatabaseTask
~MythFillDatabaseTask(void) override
Definition: backendhousekeeper.cpp:687
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:549
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:226
DailyHouseKeeperTask::SetHourWindow
virtual void SetHourWindow(std::chrono::hours min, std::chrono::hours max)
Definition: housekeeper.cpp:485
MythFillDatabaseTask::Terminate
void Terminate(void) override
Definition: backendhousekeeper.cpp:693
JobQueue::CleanupOldJobsInQueue
static void CleanupOldJobsInQueue()
Definition: jobqueue.cpp:1628
MythCoreContext::GetDurSetting
std::enable_if_t< std::chrono::__is_duration< T >::value, T > GetDurSetting(const QString &key, T defaultval=T::zero())
Definition: mythcorecontext.h:169
ThemeUpdateTask::LoadVersion
bool LoadVersion(const QString &version, int download_log_level)
Definition: backendhousekeeper.cpp:370
CleanupTask::CleanupOrphanedLiveTV
static void CleanupOrphanedLiveTV(void)
Definition: backendhousekeeper.cpp:74
kFourHours
static constexpr int64_t kFourHours
Definition: backendhousekeeper.cpp:32
MythSystemLegacy::Wait
uint Wait(std::chrono::seconds timeout=0s)
Definition: mythsystemlegacy.cpp:243
MythDownloadManager::download
bool download(const QString &url, const QString &dest, bool reload=false)
Downloads a URL to a file in blocking mode.
Definition: mythdownloadmanager.cpp:430
jobqueue.h
MythDownloadManager::cancelDownload
void cancelDownload(const QString &url, bool block=true)
Cancel a queued or current download.
Definition: mythdownloadmanager.cpp:1014
kMSPropagateLogs
@ kMSPropagateLogs
add arguments for MythTV log propagation
Definition: mythsystem.h:52
uint
unsigned int uint
Definition: compat.h:81
CleanupTask::CleanupProgramListings
static void CleanupProgramListings(void)
Definition: backendhousekeeper.cpp:234
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:55
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:911
kOneRecord
@ kOneRecord
Definition: recordingtypes.h:28
ThemeUpdateTask::DoRun
bool DoRun(void) override
Definition: backendhousekeeper.cpp:326
kMSRunShell
@ kMSRunShell
run process through shell
Definition: mythsystem.h:43
kMSAutoCleanup
@ kMSAutoCleanup
automatically delete if backgrounded
Definition: mythsystem.h:45
GetMythSourcePath
const char * GetMythSourcePath()
Definition: mythversion.cpp:10
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:34
MythCoreContext::GetBoolSetting
bool GetBoolSetting(const QString &key, bool defaultval=false)
Definition: mythcorecontext.cpp:905
ArtworkTask::Terminate
void Terminate(void) override
Definition: backendhousekeeper.cpp:548
ArtworkTask::m_msMML
MythSystemLegacy * m_msMML
Definition: backendhousekeeper.h:58
backendhousekeeper.h
mythcorecontext.h
MythFillDatabaseTask::UseSuggestedTime
static bool UseSuggestedTime(void)
Definition: backendhousekeeper.cpp:589
kOverrideRecord
@ kOverrideRecord
Definition: recordingtypes.h:29
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:887
kSingleRecord
@ kSingleRecord
Definition: recordingtypes.h:23
CleanupTask::CleanupChannelTables
static void CleanupChannelTables(void)
Definition: backendhousekeeper.cpp:204
GetAppBinDir
QString GetAppBinDir(void)
Definition: mythdirs.cpp:253
kHKRunOnStartup
@ kHKRunOnStartup
task is queued when HouseKeeper is started
Definition: housekeeper.h:36
MythCoreContext::GetHostName
QString GetHostName(void)
Definition: mythcorecontext.cpp:837
logPropagateArgs
QString logPropagateArgs
Definition: logging.cpp:82
MythSystemLegacy::Run
void Run(std::chrono::seconds timeout=0s)
Runs a command inside the /bin/sh shell. Returns immediately.
Definition: mythsystemlegacy.cpp:213
RadioStreamUpdateTask::DoCheckRun
bool DoCheckRun(const QDateTime &now) override
Definition: backendhousekeeper.cpp:473
RadioStreamUpdateTask::DoRun
bool DoRun(void) override
Definition: backendhousekeeper.cpp:429
exitcodes.h
mythdownloadmanager.h
GENERIC_EXIT_RUNNING
@ GENERIC_EXIT_RUNNING
Process is running.
Definition: exitcodes.h:26
nv_python_libs.bbciplayer.bbciplayer_api.version
string version
Definition: bbciplayer_api.py:77
DailyHouseKeeperTask
Modified PeriodicHouseKeeperTask for tasks to be run once daily.
Definition: housekeeper.h:108
JobQueue::RecoverOldJobsInQueue
static void RecoverOldJobsInQueue()
Definition: jobqueue.h:215
kDontRecord
@ kDontRecord
Definition: recordingtypes.h:30
musicmetadata.h
kHKGlobal
@ kHKGlobal
task should only run once per cluster e.g.
Definition: housekeeper.h:26
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:897
GetMythDownloadManager
MythDownloadManager * GetMythDownloadManager(void)
Gets the pointer to the MythDownloadManager singleton.
Definition: mythdownloadmanager.cpp:145
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:836
MythFillDatabaseTask::DoCheckRun
bool DoCheckRun(const QDateTime &now) override
Definition: backendhousekeeper.cpp:612