MythTV  master
mythtv/programs/mythfilldatabase/main.cpp
Go to the documentation of this file.
1 // C headers
2 #include <unistd.h>
3 
4 // C++ headers
5 #include <iostream>
6 
7 // Qt headers
8 #include <QtGlobal>
9 #include <QCoreApplication>
10 #include <QFileInfo>
11 
12 // libmyth headers
13 #include "exitcodes.h"
14 #include "mythcontext.h"
15 #include "mythdb.h"
16 #include "mythversion.h"
17 #include "mythdate.h"
18 #include "mythtranslation.h"
19 
20 #include "mythconfig.h"
21 
22 // libmythtv headers
23 #include "commandlineparser.h"
24 #include "scheduledrecording.h"
25 #include "mythmiscutil.h"
26 #include "remoteutil.h"
27 #include "videosource.h" // for is_grabber..
28 #include "dbcheck.h"
29 #include "mythsystemevent.h"
30 #include "loggingserver.h"
31 #include "mythlogging.h"
32 #include "signalhandling.h"
33 #include "cleanupguard.h"
34 
35 // filldata headers
36 #include "filldata.h"
37 namespace
38 {
39  void cleanup()
40  {
41  delete gContext;
42  gContext = nullptr;
44  }
45 }
46 
47 int main(int argc, char *argv[])
48 {
49  FillData fill_data;
50  int fromfile_id = 1;
51  QString fromfile_name;
52  bool from_file = false;
53  bool mark_repeats = true;
54 
55  int sourceid = -1;
56 
58  if (!cmdline.Parse(argc, argv))
59  {
62  }
63 
64  if (cmdline.toBool("showhelp"))
65  {
67  return GENERIC_EXIT_OK;
68  }
69 
70  if (cmdline.toBool("showversion"))
71  {
73  return GENERIC_EXIT_OK;
74  }
75 
76  QCoreApplication a(argc, argv);
77  QCoreApplication::setApplicationName(MYTH_APPNAME_MYTHFILLDATABASE);
78 
79  myth_nice(19);
80 
81  int retval = cmdline.ConfigureLogging();
82  if (retval != GENERIC_EXIT_OK)
83  return retval;
84 
85  if (cmdline.toBool("ddgraball"))
86  LOG(VB_GENERAL, LOG_WARNING,
87  "Invalid option, see: mythfilldatabase --help dd-grab-all");
88 
89  if (cmdline.toBool("manual"))
90  {
91  std::cout << "###\n";
92  std::cout << "### Running in manual channel configuration mode.\n";
93  std::cout << "### This will ask you questions about every channel.\n";
94  std::cout << "###\n";
95  fill_data.m_chanData.m_interactive = true;
96  }
97 
98  if (cmdline.toBool("onlyguide") || cmdline.toBool("update"))
99  {
100  LOG(VB_GENERAL, LOG_NOTICE,
101  "Only updating guide data, channel and icon updates will be ignored");
102  fill_data.m_chanData.m_guideDataOnly = true;
103  }
104 
105  if (cmdline.toBool("preset"))
106  {
107  std::cout << "###\n";
108  std::cout << "### Running in preset channel configuration mode.\n";
109  std::cout << "### This will assign channel ";
110  std::cout << "preset numbers to every channel.\n";
111  std::cout << "###\n";
112  fill_data.m_chanData.m_channelPreset = true;
113  }
114 
115  if (cmdline.toBool("file"))
116  {
117  // manual file mode
118  if (!cmdline.toBool("sourceid") ||
119  !cmdline.toBool("xmlfile"))
120  {
121  std::cerr << "The --file option must be used in combination" << std::endl
122  << "with both --sourceid and --xmlfile." << std::endl;
124  }
125 
126  fromfile_id = cmdline.toInt("sourceid");
127  fromfile_name = cmdline.toString("xmlfile");
128 
129  LOG(VB_GENERAL, LOG_INFO,
130  "Bypassing grabbers, reading directly from file");
131  from_file = true;
132  }
133 
134  if (cmdline.toBool("dochannelupdates"))
135  fill_data.m_chanData.m_channelUpdates = true;
136  if (cmdline.toBool("nofilterchannels"))
137  fill_data.m_chanData.m_filterNewChannels = false;
138  if (!cmdline.GetPassthrough().isEmpty())
139  fill_data.m_grabOptions = " " + cmdline.GetPassthrough();
140  if (cmdline.toBool("sourceid"))
141  sourceid = cmdline.toInt("sourceid");
142  if (cmdline.toBool("cardtype"))
143  {
144  if (!cmdline.toBool("sourceid"))
145  {
146  std::cerr << "The --cardtype option must be used in combination" << std::endl
147  << "with a --sourceid option." << std::endl;
149  }
150 
151  fill_data.m_chanData.m_cardType = cmdline.toString("cardtype")
152  .trimmed().toUpper();
153  }
154  if (cmdline.toBool("maxdays") && cmdline.toInt("maxdays") > 0)
155  {
156  fill_data.m_maxDays = cmdline.toInt("maxdays");
157  if (fill_data.m_maxDays == 1)
158  fill_data.SetRefresh(0, true);
159  }
160 
161  if (cmdline.toBool("refreshtoday"))
162  cmdline.SetValue("refresh",
163  cmdline.toStringList("refresh") << "today");
164  if (cmdline.toBool("dontrefreshtomorrow"))
165  cmdline.SetValue("refresh",
166  cmdline.toStringList("refresh") << "nottomorrow");
167  if (cmdline.toBool("refreshsecond"))
168  cmdline.SetValue("refresh",
169  cmdline.toStringList("refresh") << "second");
170  if (cmdline.toBool("refreshall"))
171  cmdline.SetValue("refresh",
172  cmdline.toStringList("refresh") << "all");
173  if (cmdline.toBool("refreshday"))
174  {
175  cmdline.SetValue("refresh",
176  cmdline.toStringList("refresh") <<
177  cmdline.toStringList("refreshday"));
178  }
179 
180  QStringList sl = cmdline.toStringList("refresh");
181  if (!sl.isEmpty())
182  {
183  for (const auto & item : qAsConst(sl))
184  {
185  QString warn = QString("Invalid entry in --refresh list: %1")
186  .arg(item);
187 
188  bool enable = !item.contains("not");
189 
190  if (item.contains("today"))
191  fill_data.SetRefresh(0, enable);
192  else if (item.contains("tomorrow"))
193  fill_data.SetRefresh(1, enable);
194  else if (item.contains("second"))
195  fill_data.SetRefresh(2, enable);
196  else if (item.contains("all"))
197  fill_data.SetRefresh(FillData::kRefreshAll, enable);
198  else if (item.contains("-"))
199  {
200  bool ok = false;
201  QStringList r = item.split("-");
202 
203  uint lower = r[0].toUInt(&ok);
204  if (!ok)
205  {
206  std::cerr << warn.toLocal8Bit().constData() << std::endl;
207  return 0;
208  }
209 
210  uint upper = r[1].toUInt(&ok);
211  if (!ok)
212  {
213  std::cerr << warn.toLocal8Bit().constData() << std::endl;
214  return 0;
215  }
216 
217  if (lower > upper)
218  {
219  std::cerr << warn.toLocal8Bit().constData() << std::endl;
220  return 0;
221  }
222 
223  for (uint j = lower; j <= upper; ++j)
224  fill_data.SetRefresh(j, true);
225  }
226  else
227  {
228  bool ok = false;
229  uint day = item.toUInt(&ok);
230  if (!ok)
231  {
232  std::cerr << warn.toLocal8Bit().constData() << std::endl;
233  return 0;
234  }
235 
236  fill_data.SetRefresh(day, true);
237  }
238  }
239  }
240 
241  if (cmdline.toBool("dontrefreshtba"))
242  fill_data.m_refreshTba = false;
243  if (cmdline.toBool("onlychannels"))
244  fill_data.m_onlyUpdateChannels = true;
245  if (cmdline.toBool("noallatonce"))
246  fill_data.m_noAllAtOnce = true;
247 
248  mark_repeats = cmdline.toBool("markrepeats");
249 
250  CleanupGuard callCleanup(cleanup);
251 
252 #ifndef _WIN32
253  QList<int> signallist;
254  signallist << SIGINT << SIGTERM << SIGSEGV << SIGABRT << SIGBUS << SIGFPE
255  << SIGILL;
256 #ifndef Q_OS_DARWIN
257  signallist << SIGRTMIN;
258 #endif
259  SignalHandler::Init(signallist);
260  SignalHandler::SetHandler(SIGHUP, logSigHup);
261 #endif
262 
264  if (!gContext->Init(false))
265  {
266  LOG(VB_GENERAL, LOG_ERR, "Failed to init MythContext, exiting.");
268  }
269 
270  setHttpProxy();
271 
272  MythTranslation::load("mythfrontend");
273 
274  if (!UpgradeTVDatabaseSchema(false))
275  {
276  LOG(VB_GENERAL, LOG_ERR, "Incorrect database schema");
278  }
279 
280  if (gCoreContext->SafeConnectToMasterServer(true, false))
281  {
282  LOG(VB_GENERAL, LOG_INFO,
283  "Opening blocking connection to master backend");
284  }
285  else
286  {
287  LOG(VB_GENERAL, LOG_WARNING,
288  "Failed to connect to master backend. MythFillDatabase will "
289  "continue running but will be unable to prevent backend from "
290  "shutting down, or triggering a reschedule when complete.");
291  }
292 
293  if (from_file)
294  {
295  QString status = QObject::tr("currently running.");
296  QDateTime GuideDataBefore;
297  QDateTime GuideDataAfter;
298 
300  updateLastRunStatus(status);
301 
302  MSqlQuery query(MSqlQuery::InitCon());
303  query.prepare("SELECT MAX(endtime) FROM program p "
304  "LEFT JOIN channel c ON p.chanid=c.chanid "
305  "WHERE c.deleted IS NULL AND c.sourceid= :SRCID "
306  "AND manualid = 0 AND c.xmltvid != '';");
307  query.bindValue(":SRCID", fromfile_id);
308 
309  if (query.exec() && query.next())
310  {
311  if (!query.isNull(0))
312  GuideDataBefore =
313  MythDate::fromString(query.value(0).toString());
314  }
315 
316  if (!fill_data.GrabDataFromFile(fromfile_id, fromfile_name))
317  {
318  return GENERIC_EXIT_NOT_OK;
319  }
320 
322 
323  query.prepare("SELECT MAX(endtime) FROM program p "
324  "LEFT JOIN channel c ON p.chanid=c.chanid "
325  "WHERE c.deleted IS NULL AND c.sourceid= :SRCID "
326  "AND manualid = 0 AND c.xmltvid != '';");
327  query.bindValue(":SRCID", fromfile_id);
328 
329  if (query.exec() && query.next())
330  {
331  if (!query.isNull(0))
332  GuideDataAfter =
333  MythDate::fromString(query.value(0).toString());
334  }
335 
336  if (GuideDataAfter == GuideDataBefore)
337  {
338  status = QObject::tr("mythfilldatabase ran, but did not insert "
339  "any new data into the Guide. This can indicate a "
340  "potential problem with the XML file used for the update.");
341  }
342  else
343  {
344  status = QObject::tr("Successful.");
345  }
346 
347  updateLastRunStatus(status);
348  }
349  else
350  {
351  SourceList sourcelist;
352 
353  MSqlQuery sourcequery(MSqlQuery::InitCon());
354  QString where;
355 
356  if (sourceid != -1)
357  {
358  LOG(VB_GENERAL, LOG_INFO,
359  QString("Running for sourceid %1 ONLY because --sourceid "
360  "was given on command-line").arg(sourceid));
361  where = QString("WHERE sourceid = %1").arg(sourceid);
362  }
363 
364  QString querystr = QString("SELECT sourceid,name,xmltvgrabber,userid,"
365  "password,lineupid "
366  "FROM videosource ") + where +
367  QString(" ORDER BY sourceid;");
368 
369  if (sourcequery.exec(querystr))
370  {
371  if (sourcequery.size() > 0)
372  {
373  while (sourcequery.next())
374  {
375  Source newsource;
376 
377  newsource.id = sourcequery.value(0).toInt();
378  newsource.name = sourcequery.value(1).toString();
379  newsource.xmltvgrabber = sourcequery.value(2).toString();
380  newsource.userid = sourcequery.value(3).toString();
381  newsource.password = sourcequery.value(4).toString();
382  newsource.lineupid = sourcequery.value(5).toString();
383 
384  newsource.xmltvgrabber_baseline = false;
385  newsource.xmltvgrabber_manualconfig = false;
386  newsource.xmltvgrabber_cache = false;
387  newsource.xmltvgrabber_prefmethod = "";
388 
389  sourcelist.push_back(newsource);
390  }
391  }
392  else
393  {
394  LOG(VB_GENERAL, LOG_ERR,
395  "There are no channel sources defined, did you run "
396  "the setup program?");
398  }
399  }
400  else
401  {
402  MythDB::DBError("loading channel sources", sourcequery);
403  return GENERIC_EXIT_DB_ERROR;
404  }
405 
406  if (!fill_data.Run(sourcelist))
407  LOG(VB_GENERAL, LOG_ERR, "Failed to fetch some program info");
408  else
409  LOG(VB_GENERAL, LOG_NOTICE, "Data fetching complete.");
410  }
411 
412  if (fill_data.m_onlyUpdateChannels && !fill_data.m_needPostGrabProc)
413  {
414  return GENERIC_EXIT_OK;
415  }
416 
417  LOG(VB_GENERAL, LOG_INFO, "Adjusting program database end times.");
418  int update_count = ProgramData::fix_end_times();
419  if (update_count == -1)
420  LOG(VB_GENERAL, LOG_ERR, "fix_end_times failed!");
421  else
422  LOG(VB_GENERAL, LOG_INFO,
423  QString(" %1 replacements made").arg(update_count));
424 
425  LOG(VB_GENERAL, LOG_INFO, "Marking generic episodes.");
426 
427  MSqlQuery query(MSqlQuery::InitCon());
428  query.prepare("UPDATE program SET generic = 1 WHERE "
429  "((programid = '' AND subtitle = '' AND description = '') OR "
430  " (programid <> '' AND category_type = 'series' AND "
431  " program.programid LIKE '%0000'));");
432 
433  if (!query.exec())
434  MythDB::DBError("mark generic", query);
435  else
436  LOG(VB_GENERAL, LOG_INFO,
437  QString(" Found %1").arg(query.numRowsAffected()));
438 
439  LOG(VB_GENERAL, LOG_INFO, "Extending non-unique programids "
440  "with multiple parts.");
441 
442  int found = 0;
444  sel.prepare("SELECT DISTINCT programid, partnumber, parttotal "
445  "FROM program WHERE partnumber > 0 AND parttotal > 0 AND "
446  "programid LIKE '%0000'");
447  if (sel.exec())
448  {
450  repl.prepare("UPDATE program SET programid = :NEWID "
451  "WHERE programid = :OLDID AND "
452  "partnumber = :PARTNUM AND "
453  "parttotal = :PARTTOTAL");
454 
455  while (sel.next())
456  {
457  QString orig_programid = sel.value(0).toString();
458  QString new_programid = orig_programid.left(10);
459  QString part;
460 
461  int partnum = sel.value(1).toInt();
462  int parttotal = sel.value(2).toInt();
463 
464  part.setNum(parttotal);
465  new_programid.append(part.rightJustified(2, '0'));
466  part.setNum(partnum);
467  new_programid.append(part.rightJustified(2, '0'));
468 
469  LOG(VB_GENERAL, LOG_INFO,
470  QString(" %1 -> %2 (part %3 of %4)")
471  .arg(orig_programid, new_programid)
472  .arg(partnum).arg(parttotal));
473 
474  repl.bindValue(":NEWID", new_programid);
475  repl.bindValue(":OLDID", orig_programid);
476  repl.bindValue(":PARTNUM", partnum);
477  repl.bindValue(":PARTTOTAL", parttotal);
478  if (!repl.exec())
479  {
480  LOG(VB_GENERAL, LOG_INFO,
481  QString("Fudging programid from '%1' to '%2'")
482  .arg(orig_programid, new_programid));
483  }
484  else
485  found += repl.numRowsAffected();
486  }
487  }
488 
489  LOG(VB_GENERAL, LOG_INFO, QString(" Found %1").arg(found));
490 
491  LOG(VB_GENERAL, LOG_INFO, "Fixing missing original airdates.");
492  query.prepare("UPDATE program p "
493  "JOIN ( "
494  " SELECT programid, MAX(originalairdate) maxoad "
495  " FROM program "
496  " WHERE programid <> '' AND "
497  " originalairdate IS NOT NULL "
498  " GROUP BY programid ) oad "
499  " ON p.programid = oad.programid "
500  "SET p.originalairdate = oad.maxoad "
501  "WHERE p.originalairdate IS NULL");
502 
503  if (query.exec())
504  {
505  LOG(VB_GENERAL, LOG_INFO,
506  QString(" Found %1 with programids")
507  .arg(query.numRowsAffected()));
508  }
509 
510  query.prepare("UPDATE program p "
511  "JOIN ( "
512  " SELECT title, subtitle, description, "
513  " MAX(originalairdate) maxoad "
514  " FROM program "
515  " WHERE programid = '' AND "
516  " originalairdate IS NOT NULL "
517  " GROUP BY title, subtitle, description ) oad "
518  " ON p.programid = '' AND "
519  " p.title = oad.title AND "
520  " p.subtitle = oad.subtitle AND "
521  " p.description = oad.description "
522  "SET p.originalairdate = oad.maxoad "
523  "WHERE p.originalairdate IS NULL");
524 
525  if (query.exec())
526  {
527  LOG(VB_GENERAL, LOG_INFO,
528  QString(" Found %1 without programids")
529  .arg(query.numRowsAffected()));
530  }
531 
532  if (mark_repeats)
533  {
534  LOG(VB_GENERAL, LOG_INFO, "Marking repeats.");
535 
536  int newEpiWindow = gCoreContext->GetNumSetting( "NewEpisodeWindow", 14);
537 
538  MSqlQuery query2(MSqlQuery::InitCon());
539  query2.prepare("UPDATE program SET previouslyshown = 1 "
540  "WHERE previouslyshown = 0 "
541  "AND originalairdate is not null "
542  "AND (to_days(starttime) - to_days(originalairdate)) "
543  " > :NEWWINDOW;");
544  query2.bindValue(":NEWWINDOW", newEpiWindow);
545 
546  if (query2.exec())
547  LOG(VB_GENERAL, LOG_INFO,
548  QString(" Found %1").arg(query2.numRowsAffected()));
549 
550  LOG(VB_GENERAL, LOG_INFO, "Unmarking new episode rebroadcast repeats.");
551  query2.prepare("UPDATE program SET previouslyshown = 0 "
552  "WHERE previouslyshown = 1 "
553  "AND originalairdate is not null "
554  "AND (to_days(starttime) - to_days(originalairdate)) "
555  " <= :NEWWINDOW;");
556  query2.bindValue(":NEWWINDOW", newEpiWindow);
557 
558  if (query2.exec())
559  LOG(VB_GENERAL, LOG_INFO,
560  QString(" Found %1").arg(query2.numRowsAffected()));
561  }
562 
563  // Mark first and last showings
565  updt.prepare("UPDATE program SET first = 0, last = 0;");
566  if (!updt.exec())
567  MythDB::DBError("Clearing first and last showings", updt);
568 
569  LOG(VB_GENERAL, LOG_INFO, "Marking episode first showings.");
570  updt.prepare("UPDATE program "
571  "JOIN (SELECT MIN(p.starttime) AS starttime, p.programid "
572  " FROM program p, channel c "
573  " WHERE p.programid <> '' "
574  " AND p.chanid = c.chanid "
575  " AND c.deleted IS NULL "
576  " AND c.visible > 0 "
577  " GROUP BY p.programid "
578  " ) AS firsts "
579  "ON program.programid = firsts.programid "
580  " AND program.starttime = firsts.starttime "
581  "SET program.first=1;");
582  if (!updt.exec())
583  MythDB::DBError("Marking first showings by id", updt);
584  found = updt.numRowsAffected();
585 
586  updt.prepare("UPDATE program "
587  "JOIN (SELECT MIN(p.starttime) AS starttime, p.title, p.subtitle, "
588  " LEFT(p.description, 1024) AS partdesc "
589  " FROM program p, channel c "
590  " WHERE p.programid = '' "
591  " AND p.chanid = c.chanid "
592  " AND c.deleted IS NULL "
593  " AND c.visible > 0 "
594  " GROUP BY p.title, p.subtitle, partdesc "
595  " ) AS firsts "
596  "ON program.starttime = firsts.starttime "
597  " AND program.title = firsts.title "
598  " AND program.subtitle = firsts.subtitle "
599  " AND LEFT(program.description, 1024) = firsts.partdesc "
600  "SET program.first = 1 "
601  "WHERE program.programid = '';");
602  if (!updt.exec())
603  MythDB::DBError("Marking first showings", updt);
604  found += updt.numRowsAffected();
605  LOG(VB_GENERAL, LOG_INFO, QString(" Found %1").arg(found));
606 
607  LOG(VB_GENERAL, LOG_INFO, "Marking episode last showings.");
608  updt.prepare("UPDATE program "
609  "JOIN (SELECT MAX(p.starttime) AS starttime, p.programid "
610  " FROM program p, channel c "
611  " WHERE p.programid <> '' "
612  " AND p.chanid = c.chanid "
613  " AND c.deleted IS NULL "
614  " AND c.visible > 0 "
615  " GROUP BY p.programid "
616  " ) AS lasts "
617  "ON program.programid = lasts.programid "
618  " AND program.starttime = lasts.starttime "
619  "SET program.last=1;");
620  if (!updt.exec())
621  MythDB::DBError("Marking last showings by id", updt);
622  found = updt.numRowsAffected();
623 
624  updt.prepare("UPDATE program "
625  "JOIN (SELECT MAX(p.starttime) AS starttime, p.title, p.subtitle, "
626  " LEFT(p.description, 1024) AS partdesc "
627  " FROM program p, channel c "
628  " WHERE p.programid = '' "
629  " AND p.chanid = c.chanid "
630  " AND c.deleted IS NULL "
631  " AND c.visible > 0 "
632  " GROUP BY p.title, p.subtitle, partdesc "
633  " ) AS lasts "
634  "ON program.starttime = lasts.starttime "
635  " AND program.title = lasts.title "
636  " AND program.subtitle = lasts.subtitle "
637  " AND LEFT(program.description, 1024) = lasts.partdesc "
638  "SET program.last = 1 "
639  "WHERE program.programid = '';");
640  if (!updt.exec())
641  MythDB::DBError("Marking last showings", updt);
642  found += updt.numRowsAffected();
643  LOG(VB_GENERAL, LOG_INFO, QString(" Found %1").arg(found));
644 
645 #if 1
646  // limit MSqlQuery's lifetime
647  MSqlQuery query2(MSqlQuery::InitCon());
648  query2.prepare("SELECT count(previouslyshown) "
649  "FROM program WHERE previouslyshown = 1;");
650  if (query2.exec() && query2.next())
651  {
652  if (query2.value(0).toInt() != 0)
653  gCoreContext->SaveSettingOnHost("HaveRepeats", "1", nullptr);
654  else
655  gCoreContext->SaveSettingOnHost("HaveRepeats", "0", nullptr);
656  }
657 #endif
658 
659  LOG(VB_GENERAL, LOG_INFO, "\n"
660  "===============================================================\n"
661  "| Attempting to contact the master backend for rescheduling. |\n"
662  "| If the master is not running, rescheduling will happen when |\n"
663  "| the master backend is restarted. |\n"
664  "===============================================================");
665 
666  ScheduledRecording::RescheduleMatch(0, 0, 0, QDateTime(),
667  "MythFillDatabase");
668 
669  gCoreContext->SendMessage("CLEAR_SETTINGS_CACHE");
670 
671  gCoreContext->SendSystemEvent("MYTHFILLDATABASE_RAN");
672 
673  LOG(VB_GENERAL, LOG_NOTICE, "mythfilldatabase run complete.");
674 
675  return GENERIC_EXIT_OK;
676 }
677 
678 /* vim: set expandtab tabstop=4 shiftwidth=4: */
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:806
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:125
Source::lineupid
QString lineupid
Definition: filldata.h:32
MythCoreContext::SendMessage
void SendMessage(const QString &message)
Definition: mythcorecontext.cpp:1543
MSqlQuery::size
int size(void) const
Definition: mythdbcon.h:212
GENERIC_EXIT_OK
#define GENERIC_EXIT_OK
Exited with no error.
Definition: exitcodes.h:10
setHttpProxy
void setHttpProxy(void)
Get network proxy settings from OS, and use for [Q]Http[Comms].
Definition: mythmiscutil.cpp:857
MSqlQuery::isNull
bool isNull(int field) const
Definition: mythdbcon.h:217
mythdb.h
updateLastRunStart
bool updateLastRunStart(void)
Definition: filldata.cpp:47
UpgradeTVDatabaseSchema
bool UpgradeTVDatabaseSchema(const bool upgradeAllowed, const bool upgradeIfNoUI, const bool informSystemd)
Called from outside dbcheck.cpp to update the schema.
Definition: dbcheck.cpp:360
ChannelData::m_cardType
QString m_cardType
Definition: channeldata.h:33
MythContext
Startup context for MythTV.
Definition: mythcontext.h:43
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:202
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:607
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
mythsystemevent.h
filldata.h
GENERIC_EXIT_INVALID_CMDLINE
#define GENERIC_EXIT_INVALID_CMDLINE
Command line parse error.
Definition: exitcodes.h:15
Source::xmltvgrabber_manualconfig
bool xmltvgrabber_manualconfig
Definition: filldata.h:34
remoteutil.h
MythCoreContext::SafeConnectToMasterServer
bool SafeConnectToMasterServer(bool blockingClient=true, bool openEventSocket=true)
Definition: mythcorecontext.cpp:372
mythversion.h
MythCommandLineParser::Parse
virtual bool Parse(int argc, const char *const *argv)
Loop through argv and populate arguments with values.
Definition: mythcommandlineparser.cpp:1449
ChannelData::m_channelPreset
bool m_channelPreset
Definition: channeldata.h:30
mythdate.h
FillData::m_grabOptions
QString m_grabOptions
Definition: filldata.h:66
ChannelData::m_guideDataOnly
bool m_guideDataOnly
Definition: channeldata.h:29
ChannelData::m_interactive
bool m_interactive
Definition: channeldata.h:28
mythlogging.h
Source::xmltvgrabber_prefmethod
QString xmltvgrabber_prefmethod
Definition: filldata.h:38
ProgramData::fix_end_times
static int fix_end_times(void)
Definition: programdata.cpp:1645
updateLastRunEnd
bool updateLastRunEnd(void)
Definition: filldata.cpp:39
FillData::Run
bool Run(SourceList &sourcelist)
Goes through the sourcelist and updates its channels with program info grabbed with the associated gr...
Definition: filldata.cpp:247
Source
Definition: channelsettings.cpp:68
Source::xmltvgrabber_baseline
bool xmltvgrabber_baseline
Definition: filldata.h:33
dbcheck.h
MythCoreContext::SendSystemEvent
void SendSystemEvent(const QString &msg)
Definition: mythcorecontext.cpp:1570
MythFillDatabaseCommandLineParser
Definition: mythfilldatabase/commandlineparser.h:6
signalhandling.h
commandlineparser.h
ChannelData::m_channelUpdates
bool m_channelUpdates
Definition: channeldata.h:31
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:539
CleanupGuard
Definition: cleanupguard.h:6
Source::userid
QString userid
Definition: filldata.h:30
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:227
GENERIC_EXIT_SETUP_ERROR
#define GENERIC_EXIT_SETUP_ERROR
Incorrectly setup system.
Definition: exitcodes.h:21
Source::xmltvgrabber_cache
bool xmltvgrabber_cache
Definition: filldata.h:35
SIGHUP
#define SIGHUP
Definition: compat.h:216
MythCommandLineParser::PrintVersion
static void PrintVersion(void)
Print application version information.
Definition: mythcommandlineparser.cpp:1277
mythtranslation.h
Source::id
int id
Definition: filldata.h:27
scheduledrecording.h
MythCommandLineParser::PrintHelp
void PrintHelp(void) const
Print command line option help.
Definition: mythcommandlineparser.cpp:1293
FillData::m_chanData
ChannelData m_chanData
Definition: filldata.h:63
uint
unsigned int uint
Definition: compat.h:144
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:61
Source::name
QString name
Definition: filldata.h:28
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:938
cleanup
static QString cleanup(const QString &str)
Definition: remoteencoder.cpp:672
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:30
FillData::GrabDataFromFile
bool GrabDataFromFile(int id, const QString &filename)
Definition: filldata.cpp:89
MYTH_BINARY_VERSION
#define MYTH_BINARY_VERSION
Update this whenever the plug-in ABI changes.
Definition: mythversion.h:15
GENERIC_EXIT_DB_ERROR
#define GENERIC_EXIT_DB_ERROR
Database error.
Definition: exitcodes.h:17
cmdline
MythCommFlagCommandLineParser cmdline
Definition: mythtv/programs/mythcommflag/main.cpp:75
FillData
Definition: filldata.h:42
mythmiscutil.h
MythCommandLineParser::toString
QString toString(const QString &key) const
Returns stored QVariant as a QString, falling to default if not provided.
Definition: mythcommandlineparser.cpp:2252
FillData::m_onlyUpdateChannels
bool m_onlyUpdateChannels
Definition: filldata.h:73
GENERIC_EXIT_NOT_OK
#define GENERIC_EXIT_NOT_OK
Exited with error.
Definition: exitcodes.h:11
MythCommandLineParser::SetValue
bool SetValue(const QString &key, const QVariant &value)
Set a new stored value for an existing argument definition, or spawn a new definition store value in.
Definition: mythcommandlineparser.cpp:2723
MythCommandLineParser::toBool
bool toBool(const QString &key) const
Returns stored QVariant as a boolean.
Definition: mythcommandlineparser.cpp:2095
cleanupguard.h
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:882
MythCommandLineParser::toStringList
QStringList toStringList(const QString &key, const QString &sep="") const
Returns stored QVariant as a QStringList, falling to default if not provided.
Definition: mythcommandlineparser.cpp:2283
Source::password
QString password
Definition: filldata.h:31
FillData::SetRefresh
void SetRefresh(int day, bool set)
Definition: filldata.cpp:71
mythcontext.h
GENERIC_EXIT_NO_MYTHCONTEXT
#define GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
Definition: exitcodes.h:13
SignalHandler::SetHandler
static void SetHandler(int signum, SigHandlerFunc handler)
Definition: signalhandling.cpp:141
ChannelData::m_filterNewChannels
bool m_filterNewChannels
Definition: channeldata.h:32
FillData::m_refreshTba
bool m_refreshTba
Definition: filldata.h:71
main
int main(int argc, char *argv[])
Definition: mythtv/programs/mythfilldatabase/main.cpp:47
MSqlQuery::numRowsAffected
int numRowsAffected() const
Definition: mythdbcon.h:215
SourceList
std::vector< Source > SourceList
Definition: filldata.h:40
MythCommandLineParser::ConfigureLogging
int ConfigureLogging(const QString &mask="general", bool progress=false)
Read in logging options and initialize the logging interface.
Definition: mythcommandlineparser.cpp:2756
myth_nice
bool myth_nice(int val)
Definition: mythmiscutil.cpp:707
FillData::m_noAllAtOnce
bool m_noAllAtOnce
Definition: filldata.h:75
MYTH_APPNAME_MYTHFILLDATABASE
#define MYTH_APPNAME_MYTHFILLDATABASE
Definition: mythcorecontext.h:25
updateLastRunStatus
bool updateLastRunStatus(QString &status)
Definition: filldata.cpp:56
MythTranslation::load
static void load(const QString &module_name)
Load a QTranslator for the user's preferred language.
Definition: mythtranslation.cpp:37
exitcodes.h
MythCommandLineParser::toInt
int toInt(const QString &key) const
Returns stored QVariant as an integer, falling to default if not provided.
Definition: mythcommandlineparser.cpp:2117
FillData::m_needPostGrabProc
bool m_needPostGrabProc
Definition: filldata.h:72
loggingserver.h
MythCommandLineParser::GetPassthrough
QString GetPassthrough(void) const
Return any text supplied on the command line after a bare '–'.
Definition: mythcommandlineparser.cpp:1999
FillData::m_maxDays
uint m_maxDays
Definition: filldata.h:67
ScheduledRecording::RescheduleMatch
static void RescheduleMatch(uint recordid, uint sourceid, uint mplexid, const QDateTime &maxstarttime, const QString &why)
Definition: scheduledrecording.h:17
MythCoreContext::SaveSettingOnHost
bool SaveSettingOnHost(const QString &key, const QString &newValue, const QString &host)
Definition: mythcorecontext.cpp:917
gContext
MythContext * gContext
This global variable contains the MythContext instance for the application.
Definition: mythcontext.cpp:64
videosource.h
MythContext::Init
bool Init(bool gui=true, bool promptForBackend=false, bool disableAutoDiscovery=false, bool ignoreDB=false)
Definition: mythcontext.cpp:1571
SignalHandler::Done
static void Done(void)
Definition: signalhandling.cpp:134
Source::xmltvgrabber
QString xmltvgrabber
Definition: filldata.h:29
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:831
FillData::kRefreshAll
@ kRefreshAll
Definition: filldata.h:59
SignalHandler::Init
static void Init(QList< int > &signallist, QObject *parent=nullptr)
Definition: signalhandling.cpp:127
GENERIC_EXIT_DB_OUTOFDATE
#define GENERIC_EXIT_DB_OUTOFDATE
Database needs upgrade.
Definition: exitcodes.h:16