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" << std::endl
103 << "with both --sourceid and --xmlfile." << std::endl;
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" << std::endl
128 << "with a --sourceid option." << std::endl;
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 {
162 bool ok = false;
163 QStringList r = item.split("-");
164
165 uint lower = r[0].toUInt(&ok);
166 if (!ok)
167 {
168 std::cerr << warn.toLocal8Bit().constData() << std::endl;
169 return 0;
170 }
171
172 uint upper = r[1].toUInt(&ok);
173 if (!ok)
174 {
175 std::cerr << warn.toLocal8Bit().constData() << std::endl;
176 return 0;
177 }
178
179 if (lower > upper)
180 {
181 std::cerr << warn.toLocal8Bit().constData() << std::endl;
182 return 0;
183 }
184
185 for (uint j = lower; j <= upper; ++j)
186 fill_data.SetRefresh(j, true);
187 }
188 else
189 {
190 bool ok = false;
191 uint day = item.toUInt(&ok);
192 if (!ok)
193 {
194 std::cerr << warn.toLocal8Bit().constData() << std::endl;
195 return 0;
196 }
197
198 fill_data.SetRefresh(day, true);
199 }
200 }
201 }
202
203 if (cmdline.toBool("dontrefreshtba"))
204 fill_data.m_refreshTba = false;
205 if (cmdline.toBool("onlychannels"))
206 fill_data.m_onlyUpdateChannels = true;
207 if (cmdline.toBool("noallatonce"))
208 fill_data.m_noAllAtOnce = true;
209
210 mark_repeats = cmdline.toBool("markrepeats");
211
212 MythContext context {MYTH_BINARY_VERSION};
213 if (!context.Init(false))
214 {
215 LOG(VB_GENERAL, LOG_ERR, "Failed to init MythContext, exiting.");
217 }
218
219 setHttpProxy();
220
221 MythTranslation::load("mythfrontend");
222
223 if (!UpgradeTVDatabaseSchema(false))
224 {
225 LOG(VB_GENERAL, LOG_ERR, "Incorrect database schema");
227 }
228
229 if (gCoreContext->SafeConnectToMasterServer(true, false))
230 {
231 LOG(VB_GENERAL, LOG_INFO,
232 "Opening blocking connection to master backend");
233 }
234 else
235 {
236 LOG(VB_GENERAL, LOG_WARNING,
237 "Failed to connect to master backend. MythFillDatabase will "
238 "continue running but will be unable to prevent backend from "
239 "shutting down, or triggering a reschedule when complete.");
240 }
241
242 if (from_file)
243 {
244 QString status = QObject::tr("currently running.");
245 QDateTime GuideDataBefore;
246 QDateTime GuideDataAfter;
247
249 updateLastRunStatus(status);
250
252 query.prepare("SELECT MAX(endtime) FROM program p "
253 "LEFT JOIN channel c ON p.chanid=c.chanid "
254 "WHERE c.deleted IS NULL AND c.sourceid= :SRCID "
255 "AND manualid = 0 AND c.xmltvid != '';");
256 query.bindValue(":SRCID", fromfile_id);
257
258 if (query.exec() && query.next())
259 {
260 if (!query.isNull(0))
261 GuideDataBefore =
262 MythDate::fromString(query.value(0).toString());
263 }
264
265 if (!fill_data.GrabDataFromFile(fromfile_id, fromfile_name))
266 {
267 return GENERIC_EXIT_NOT_OK;
268 }
269
271
272 query.prepare("SELECT MAX(endtime) FROM program p "
273 "LEFT JOIN channel c ON p.chanid=c.chanid "
274 "WHERE c.deleted IS NULL AND c.sourceid= :SRCID "
275 "AND manualid = 0 AND c.xmltvid != '';");
276 query.bindValue(":SRCID", fromfile_id);
277
278 if (query.exec() && query.next())
279 {
280 if (!query.isNull(0))
281 GuideDataAfter =
282 MythDate::fromString(query.value(0).toString());
283 }
284
285 if (GuideDataAfter == GuideDataBefore)
286 {
287 status = QObject::tr("mythfilldatabase ran, but did not insert "
288 "any new data into the Guide. This can indicate a "
289 "potential problem with the XML file used for the update.");
290 }
291 else
292 {
293 status = QObject::tr("Successful.");
294 }
295
296 updateLastRunStatus(status);
297 }
298 else
299 {
300 DataSourceList sourcelist;
301
302 MSqlQuery sourcequery(MSqlQuery::InitCon());
303 QString where;
304
305 if (sourceid != -1)
306 {
307 LOG(VB_GENERAL, LOG_INFO,
308 QString("Running for sourceid %1 ONLY because --sourceid "
309 "was given on command-line").arg(sourceid));
310 where = QString("WHERE sourceid = %1").arg(sourceid);
311 }
312
313 QString querystr = QString("SELECT sourceid,name,xmltvgrabber,userid,"
314 "password,lineupid "
315 "FROM videosource ") + where +
316 QString(" ORDER BY sourceid;");
317
318 if (sourcequery.exec(querystr))
319 {
320 if (sourcequery.size() > 0)
321 {
322 while (sourcequery.next())
323 {
324 DataSource newsource;
325
326 newsource.id = sourcequery.value(0).toInt();
327 newsource.name = sourcequery.value(1).toString();
328 newsource.xmltvgrabber = sourcequery.value(2).toString();
329 newsource.userid = sourcequery.value(3).toString();
330 newsource.password = sourcequery.value(4).toString();
331 newsource.lineupid = sourcequery.value(5).toString();
332
333 newsource.xmltvgrabber_baseline = false;
334 newsource.xmltvgrabber_manualconfig = false;
335 newsource.xmltvgrabber_cache = false;
336 newsource.xmltvgrabber_prefmethod = "";
337
338 sourcelist.push_back(newsource);
339 }
340 }
341 else
342 {
343 LOG(VB_GENERAL, LOG_ERR,
344 "There are no channel sources defined, did you run "
345 "the setup program?");
347 }
348 }
349 else
350 {
351 MythDB::DBError("loading channel sources", sourcequery);
353 }
354
355 if (!fill_data.Run(sourcelist))
356 LOG(VB_GENERAL, LOG_ERR, "Failed to fetch some program info");
357 else
358 LOG(VB_GENERAL, LOG_NOTICE, "Data fetching complete.");
359 }
360
361 if (fill_data.m_onlyUpdateChannels && !fill_data.m_needPostGrabProc)
362 {
363 return GENERIC_EXIT_OK;
364 }
365
366 LOG(VB_GENERAL, LOG_INFO, "Adjusting program database end times.");
367 int update_count = ProgramData::fix_end_times();
368 if (update_count == -1)
369 LOG(VB_GENERAL, LOG_ERR, "fix_end_times failed!");
370 else
371 LOG(VB_GENERAL, LOG_INFO,
372 QString(" %1 replacements made").arg(update_count));
373
374 LOG(VB_GENERAL, LOG_INFO, "Marking generic episodes.");
375
377 query.prepare("UPDATE program SET generic = 1 WHERE "
378 "((programid = '' AND subtitle = '' AND description = '') OR "
379 " (programid <> '' AND category_type = 'series' AND "
380 " program.programid LIKE '%0000'));");
381
382 if (!query.exec())
383 MythDB::DBError("mark generic", query);
384 else
385 LOG(VB_GENERAL, LOG_INFO,
386 QString(" Found %1").arg(query.numRowsAffected()));
387
388 LOG(VB_GENERAL, LOG_INFO, "Extending non-unique programids "
389 "with multiple parts.");
390
391 int found = 0;
393 sel.prepare("SELECT DISTINCT programid, partnumber, parttotal "
394 "FROM program WHERE partnumber > 0 AND parttotal > 0 AND "
395 "programid LIKE '%0000'");
396 if (sel.exec())
397 {
399 repl.prepare("UPDATE program SET programid = :NEWID "
400 "WHERE programid = :OLDID AND "
401 "partnumber = :PARTNUM AND "
402 "parttotal = :PARTTOTAL");
403
404 while (sel.next())
405 {
406 QString orig_programid = sel.value(0).toString();
407 QString new_programid = orig_programid.left(10);
408 QString part;
409
410 int partnum = sel.value(1).toInt();
411 int parttotal = sel.value(2).toInt();
412
413 part.setNum(parttotal);
414 new_programid.append(part.rightJustified(2, '0'));
415 part.setNum(partnum);
416 new_programid.append(part.rightJustified(2, '0'));
417
418 LOG(VB_GENERAL, LOG_INFO,
419 QString(" %1 -> %2 (part %3 of %4)")
420 .arg(orig_programid, new_programid)
421 .arg(partnum).arg(parttotal));
422
423 repl.bindValue(":NEWID", new_programid);
424 repl.bindValue(":OLDID", orig_programid);
425 repl.bindValue(":PARTNUM", partnum);
426 repl.bindValue(":PARTTOTAL", parttotal);
427 if (!repl.exec())
428 {
429 LOG(VB_GENERAL, LOG_INFO,
430 QString("Fudging programid from '%1' to '%2'")
431 .arg(orig_programid, new_programid));
432 }
433 else
434 {
435 found += repl.numRowsAffected();
436 }
437 }
438 }
439
440 LOG(VB_GENERAL, LOG_INFO, QString(" Found %1").arg(found));
441
442 LOG(VB_GENERAL, LOG_INFO, "Fixing missing original airdates.");
443 query.prepare("UPDATE program p "
444 "JOIN ( "
445 " SELECT programid, MAX(originalairdate) maxoad "
446 " FROM program "
447 " WHERE programid <> '' AND "
448 " originalairdate IS NOT NULL "
449 " GROUP BY programid ) oad "
450 " ON p.programid = oad.programid "
451 "SET p.originalairdate = oad.maxoad "
452 "WHERE p.originalairdate IS NULL");
453
454 if (query.exec())
455 {
456 LOG(VB_GENERAL, LOG_INFO,
457 QString(" Found %1 with programids")
458 .arg(query.numRowsAffected()));
459 }
460
461 query.prepare("UPDATE program p "
462 "JOIN ( "
463 " SELECT title, subtitle, description, "
464 " MAX(originalairdate) maxoad "
465 " FROM program "
466 " WHERE programid = '' AND "
467 " originalairdate IS NOT NULL "
468 " GROUP BY title, subtitle, description ) oad "
469 " ON p.programid = '' AND "
470 " p.title = oad.title AND "
471 " p.subtitle = oad.subtitle AND "
472 " p.description = oad.description "
473 "SET p.originalairdate = oad.maxoad "
474 "WHERE p.originalairdate IS NULL");
475
476 if (query.exec())
477 {
478 LOG(VB_GENERAL, LOG_INFO,
479 QString(" Found %1 without programids")
480 .arg(query.numRowsAffected()));
481 }
482
483 if (mark_repeats)
484 {
485 LOG(VB_GENERAL, LOG_INFO, "Marking repeats.");
486
487 int newEpiWindow = gCoreContext->GetNumSetting( "NewEpisodeWindow", 14);
488
490 query2.prepare("UPDATE program SET previouslyshown = 1 "
491 "WHERE previouslyshown = 0 "
492 "AND originalairdate is not null "
493 "AND (to_days(starttime) - to_days(originalairdate)) "
494 " > :NEWWINDOW;");
495 query2.bindValue(":NEWWINDOW", newEpiWindow);
496
497 if (query2.exec())
498 LOG(VB_GENERAL, LOG_INFO,
499 QString(" Found %1").arg(query2.numRowsAffected()));
500
501 LOG(VB_GENERAL, LOG_INFO, "Unmarking new episode rebroadcast repeats.");
502 query2.prepare("UPDATE program SET previouslyshown = 0 "
503 "WHERE previouslyshown = 1 "
504 "AND originalairdate is not null "
505 "AND (to_days(starttime) - to_days(originalairdate)) "
506 " <= :NEWWINDOW;");
507 query2.bindValue(":NEWWINDOW", newEpiWindow);
508
509 if (query2.exec())
510 LOG(VB_GENERAL, LOG_INFO,
511 QString(" Found %1").arg(query2.numRowsAffected()));
512 }
513
514 // Mark first and last showings
516 updt.prepare("UPDATE program SET first = 0, last = 0;");
517 if (!updt.exec())
518 MythDB::DBError("Clearing first and last showings", updt);
519
520 LOG(VB_GENERAL, LOG_INFO, "Marking episode first showings.");
521 updt.prepare("UPDATE program "
522 "JOIN (SELECT MIN(p.starttime) AS starttime, p.programid "
523 " FROM program p, channel c "
524 " WHERE p.programid <> '' "
525 " AND p.chanid = c.chanid "
526 " AND c.deleted IS NULL "
527 " AND c.visible > 0 "
528 " GROUP BY p.programid "
529 " ) AS firsts "
530 "ON program.programid = firsts.programid "
531 " AND program.starttime = firsts.starttime "
532 "SET program.first=1;");
533 if (!updt.exec())
534 MythDB::DBError("Marking first showings by id", updt);
535 found = updt.numRowsAffected();
536
537 updt.prepare("UPDATE program "
538 "JOIN (SELECT MIN(p.starttime) AS starttime, p.title, p.subtitle, "
539 " LEFT(p.description, 1024) AS partdesc "
540 " FROM program p, channel c "
541 " WHERE p.programid = '' "
542 " AND p.chanid = c.chanid "
543 " AND c.deleted IS NULL "
544 " AND c.visible > 0 "
545 " GROUP BY p.title, p.subtitle, partdesc "
546 " ) AS firsts "
547 "ON program.starttime = firsts.starttime "
548 " AND program.title = firsts.title "
549 " AND program.subtitle = firsts.subtitle "
550 " AND LEFT(program.description, 1024) = firsts.partdesc "
551 "SET program.first = 1 "
552 "WHERE program.programid = '';");
553 if (!updt.exec())
554 MythDB::DBError("Marking first showings", updt);
555 found += updt.numRowsAffected();
556 LOG(VB_GENERAL, LOG_INFO, QString(" Found %1").arg(found));
557
558 LOG(VB_GENERAL, LOG_INFO, "Marking episode last showings.");
559 updt.prepare("UPDATE program "
560 "JOIN (SELECT MAX(p.starttime) AS starttime, p.programid "
561 " FROM program p, channel c "
562 " WHERE p.programid <> '' "
563 " AND p.chanid = c.chanid "
564 " AND c.deleted IS NULL "
565 " AND c.visible > 0 "
566 " GROUP BY p.programid "
567 " ) AS lasts "
568 "ON program.programid = lasts.programid "
569 " AND program.starttime = lasts.starttime "
570 "SET program.last=1;");
571 if (!updt.exec())
572 MythDB::DBError("Marking last showings by id", updt);
573 found = updt.numRowsAffected();
574
575 updt.prepare("UPDATE program "
576 "JOIN (SELECT MAX(p.starttime) AS starttime, p.title, p.subtitle, "
577 " LEFT(p.description, 1024) AS partdesc "
578 " FROM program p, channel c "
579 " WHERE p.programid = '' "
580 " AND p.chanid = c.chanid "
581 " AND c.deleted IS NULL "
582 " AND c.visible > 0 "
583 " GROUP BY p.title, p.subtitle, partdesc "
584 " ) AS lasts "
585 "ON program.starttime = lasts.starttime "
586 " AND program.title = lasts.title "
587 " AND program.subtitle = lasts.subtitle "
588 " AND LEFT(program.description, 1024) = lasts.partdesc "
589 "SET program.last = 1 "
590 "WHERE program.programid = '';");
591 if (!updt.exec())
592 MythDB::DBError("Marking last showings", updt);
593 found += updt.numRowsAffected();
594 LOG(VB_GENERAL, LOG_INFO, QString(" Found %1").arg(found));
595
596#if 1
597 // limit MSqlQuery's lifetime
599 query2.prepare("SELECT count(previouslyshown) "
600 "FROM program WHERE previouslyshown = 1;");
601 if (query2.exec() && query2.next())
602 {
603 if (query2.value(0).toInt() != 0)
604 gCoreContext->SaveSettingOnHost("HaveRepeats", "1", nullptr);
605 else
606 gCoreContext->SaveSettingOnHost("HaveRepeats", "0", nullptr);
607 }
608#endif
609
610 if (!cmdline.toBool("noresched"))
611 {
612 LOG(VB_GENERAL, LOG_INFO, "\n"
613 "===============================================================\n"
614 "| Attempting to contact the master backend for rescheduling. |\n"
615 "| If the master is not running, rescheduling will happen when |\n"
616 "| the master backend is restarted. |\n"
617 "===============================================================");
618
619 ScheduledRecording::RescheduleMatch(0, 0, 0, QDateTime(),
620 "MythFillDatabase");
621 }
622
623 gCoreContext->SendMessage("CLEAR_SETTINGS_CACHE");
624
625 gCoreContext->SendSystemEvent("MYTHFILLDATABASE_RAN");
626
627 LOG(VB_GENERAL, LOG_NOTICE, "mythfilldatabase run complete.");
628
629 return GENERIC_EXIT_OK;
630}
631
632/* 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
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
@ kRefreshAll
Definition: filldata.h:59
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