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