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