Go to the documentation of this file.
29 LOG(VB_GENERAL, LOG_ERR,
"Cannot load 'Info buttonlist'");
40 QString table = (recorded) ?
"recordedrating" :
"programrating";
41 QString sel = QString(
42 "SELECT `system`, rating FROM %1 "
43 "WHERE chanid = :CHANID "
44 "AND starttime = :STARTTIME").arg(table);
57 QMap<QString,QString> main_ratings;
61 if (query.
value(0).toString().toLower() ==
"advisory")
63 advisory += query.
value(1).toString() +
", ";
66 main_ratings[query.
value(0).toString()] = query.
value(1).toString();
69 advisory = advisory.left(advisory.length() - 2);
71 if (main_ratings.empty())
74 if (!advisory.isEmpty())
75 advisory =
": " + advisory;
77 if (main_ratings.size() == 1)
79 return *main_ratings.begin() + advisory;
83 QMap<QString,QString>::const_iterator it;
84 for (it = main_ratings.cbegin(); it != main_ratings.cend(); ++it)
86 ratings += it.key() +
": " + *it +
", ";
89 return ratings +
"Advisory" + advisory;
124 for (
int i = 0; i < actions.size() && !handled; ++i)
126 QString
action = actions[i];
134 else if (
action ==
"DOWN")
160 using string_pair = QPair<QString, QString>;
161 QVector<string_pair> tests;
179 tests.append(qMakePair(QString(
"channel.recpriority"),
180 QString(
"channel.recpriority")));
181 tests.append(qMakePair(QString(
"capturecard.recpriority"),
182 QString(
"capturecard.recpriority")));
186 pwrpri = QString(
"(capturecard.cardid = record.prefinput) * %1")
188 tests.append(qMakePair(pwrpri, pwrpri));
192 pwrpri = QString(
"(program.hdtv > 0 OR "
193 "FIND_IN_SET('HDTV', program.videoprop) > 0) * %1")
195 tests.append(qMakePair(pwrpri, pwrpri));
200 (
"(FIND_IN_SET('WIDESCREEN', program.videoprop) > 0) * %1")
202 tests.append(qMakePair(pwrpri, pwrpri));
207 (
"(FIND_IN_SET('SIGNED', program.subtitletypes) > 0) * %1")
209 tests.append(qMakePair(pwrpri, pwrpri));
214 (
"(FIND_IN_SET('ONSCREEN', program.subtitletypes) > 0) * %1")
216 tests.append(qMakePair(pwrpri, pwrpri));
221 (
"(FIND_IN_SET('NORMAL', program.subtitletypes) > 0 OR "
222 "program.closecaptioned > 0 OR program.subtitled > 0) * %1")
224 tests.append(qMakePair(pwrpri, pwrpri));
229 (
"(FIND_IN_SET('HARDHEAR', program.subtitletypes) > 0 OR "
230 "FIND_IN_SET('HARDHEAR', program.audioprop) > 0) * %1")
232 tests.append(qMakePair(pwrpri, pwrpri));
237 (
"(FIND_IN_SET('VISUALIMPAIR', program.audioprop) > 0) * %1")
239 tests.append(qMakePair(pwrpri, pwrpri));
242 query.
prepare(
"SELECT recpriority, selectclause FROM powerpriority;");
252 int adj = query.
value(0).toInt();
255 QString sclause = query.
value(1).toString();
258 pwrpri = QString(
"(%1) * %2").arg(sclause)
259 .arg(query.
value(0).toInt());
260 pwrpri.replace(
"RECTABLE",
"record");
263 pwrpri += QString(
" AS powerpriority ");
265 tests.append(qMakePair(desc, pwrpri));
269 recmatch = QString(
"INNER JOIN record "
270 " ON ( record.recordid = %1 ) ")
273 for (
const auto & [label, csqlStart] : qAsConst(tests))
275 QString sqlStart = csqlStart;
276 query.
prepare(
"SELECT " + sqlStart.replace(
"program.",
"p.")
279 "INNER JOIN channel "
280 " ON ( channel.chanid = p.chanid ) "
281 "INNER JOIN capturecard "
282 " ON ( channel.sourceid = capturecard.sourceid AND "
283 " ( capturecard.schedorder <> 0 OR "
284 " capturecard.parentid = 0 ) ) ").arg(ptable)
286 "WHERE p.chanid = :CHANID AND"
287 " p.starttime = :STARTTIME ;");
292 adjustmsg = QString(
"%1 : ").arg(label);
295 int adj = query.
value(0).toInt();
298 adjustmsg += tr(
" MATCHED, adding %1").arg(adj);
302 adjustmsg += tr(
" not matched");
305 adjustmsg += tr(
" Query FAILED");
307 addItem(tr(
"Recording Priority Adjustment"), adjustmsg,
311 if (!tests.isEmpty())
312 addItem(tr(
"Priority Adjustment Total"), QString::number(total),
319 QString category_type;
322 QString syndicatedEpisodeNum;
325 QString title_pronounce;
333 bool recorded =
false;
345 QString ptable = recorded ?
"recordedprogram" :
"program";
349 query.
prepare(QString(
"SELECT category_type, airdate, stars,"
350 " partnumber, parttotal, audioprop+0, videoprop+0,"
351 " subtitletypes+0, syndicatedepisodenumber, generic,"
352 " showtype, colorcode, title_pronounce"
353 " FROM %1 WHERE chanid = :CHANID AND"
354 " starttime = :STARTTIME ;").arg(ptable));
361 category_type = query.
value(0).toString();
362 year = query.
value(1).toString();
363 stars = query.
value(2).toFloat();
364 partnumber = query.
value(3).toInt();
365 parttotal = query.
value(4).toInt();
366 audioprop = query.
value(5).toInt();
367 videoprop = query.
value(6).toInt();
368 subtype = query.
value(7).toInt();
369 syndicatedEpisodeNum = query.
value(8).toString();
370 generic = query.
value(9).toInt();
371 showtype = query.
value(10).toString();
372 colorcode = query.
value(11).toString();
373 title_pronounce = query.
value(12).toString();
388 category_type =
"movie";
390 category_type =
"series";
392 category_type =
"sports";
394 category_type =
"tvshow";
408 attr += tr(
"Part %1 of %2, ").arg(partnumber).arg(parttotal);
412 if (category_type ==
"movie")
421 attr += tr(
"%n star(s)",
"", roundf(stars * 10.0F)) +
", ";
423 if (!colorcode.isEmpty())
424 attr += colorcode +
", ";
426 if (audioprop & AUD_MONO)
427 attr += tr(
"Mono") +
", ";
428 if (audioprop & AUD_STEREO)
429 attr += tr(
"Stereo") +
", ";
430 if (audioprop & AUD_SURROUND)
431 attr += tr(
"Surround Sound") +
", ";
432 if (audioprop & AUD_DOLBY)
433 attr += tr(
"Dolby Sound") +
", ";
434 if (audioprop & AUD_HARDHEAR)
435 attr += tr(
"Audio for Hearing Impaired") +
", ";
436 if (audioprop & AUD_VISUALIMPAIR)
437 attr += tr(
"Audio for Visually Impaired") +
", ";
439 if (videoprop & VID_HDTV)
440 attr += tr(
"HDTV") +
", ";
441 if (videoprop & VID_WIDESCREEN)
442 attr += tr(
"Widescreen") +
", ";
443 if (videoprop & VID_AVC)
444 attr += tr(
"AVC/H.264") +
", ";
445 if (videoprop & VID_HEVC)
446 attr += tr(
"HEVC/H.265") +
", ";
447 if (videoprop & VID_720)
448 attr += tr(
"720p Resolution") +
", ";
450 if (videoprop & VID_PROGRESSIVE)
452 if (videoprop & VID_1080)
453 attr += tr(
"1080p Resolution") +
", ";
454 if (videoprop & VID_4K)
455 attr += tr(
"4K Resolution") +
", ";
459 if (videoprop & VID_1080)
460 attr += tr(
"1080i Resolution") +
", ";
461 if (videoprop & VID_4K)
462 attr += tr(
"4Ki Resolution") +
", ";
465 if (videoprop & VID_DAMAGED)
466 attr += tr(
"Damaged") +
", ";
468 if (subtype & SUB_HARDHEAR)
469 attr += tr(
"CC",
"Closed Captioned") +
", ";
470 if (subtype & SUB_NORMAL)
471 attr += tr(
"Subtitles Available") +
", ";
472 if (subtype & SUB_ONSCREEN)
473 attr += tr(
"Subtitled") +
", ";
474 if (subtype & SUB_SIGNED)
475 attr += tr(
"Deaf Signing") +
", ";
477 if (
generic && category_type ==
"series")
478 attr += tr(
"Unidentified Episode") +
", ";
480 attr += tr(
"Repeat") +
", ";
484 attr.truncate(attr.lastIndexOf(
','));
485 s +=
" (" + attr +
")";
493 QString execProducers;
499 QString commentators;
502 using string_pair = QPair<QString, QString>;
503 QVector<string_pair> actor_list;
504 QVector<string_pair> guest_star_list;
510 table =
"recordedcredits";
514 query.
prepare(QString(
"SELECT role, people.name, roles.name FROM %1"
516 " LEFT JOIN people ON"
517 " credits.person = people.person"
518 " LEFT JOIN roles ON"
519 " credits.roleid = roles.roleid"
520 " WHERE credits.chanid = :CHANID"
521 " AND credits.starttime = :STARTTIME"
522 " ORDER BY role, priority;").arg(table));
527 if (query.
exec() && query.
size() > 0)
537 role = query.
value(0).toString();
553 pname = QString::fromUtf8(query.
value(1)
554 .toByteArray().constData());
555 character = QString::fromUtf8(query.
value(2)
556 .toByteArray().constData());
558 if (!character.isEmpty())
561 actor_list.append(qMakePair(pname, character));
562 else if (role ==
"guest_star")
563 guest_star_list.append(qMakePair(pname, character));
568 plist.removeDuplicates();
570 actors = plist.join(
", ");
571 else if (rstr ==
"director")
572 directors = plist.join(
", ");
573 else if (rstr ==
"producer")
574 producers = plist.join(
", ");
575 else if (rstr ==
"executive_producer")
576 execProducers = plist.join(
", ");
577 else if (rstr ==
"writer")
578 writers = plist.join(
", ");
579 else if (rstr ==
"guest_star")
580 guestStars = plist.join(
", ");
581 else if (rstr ==
"host")
582 hosts = plist.join(
", ");
583 else if (rstr ==
"adapter")
584 adapters = plist.join(
", ");
585 else if (rstr ==
"presenter")
586 presenters = plist.join(
", ");
587 else if (rstr ==
"commentator")
588 commentators = plist.join(
", ");
589 else if (rstr ==
"guest")
590 guests = plist.join(
", ");
598 plist.removeDuplicates();
600 actors = plist.join(
", ");
601 else if (rstr ==
"director")
602 directors = plist.join(
", ");
603 else if (rstr ==
"producer")
604 producers = plist.join(
", ");
605 else if (rstr ==
"executive_producer")
606 execProducers = plist.join(
", ");
607 else if (rstr ==
"writer")
608 writers = plist.join(
", ");
609 else if (rstr ==
"guest_star")
610 guestStars = plist.join(
", ");
611 else if (rstr ==
"host")
612 hosts = plist.join(
", ");
613 else if (rstr ==
"adapter")
614 adapters = plist.join(
", ");
615 else if (rstr ==
"presenter")
616 presenters = plist.join(
", ");
617 else if (rstr ==
"commentator")
618 commentators = plist.join(
", ");
619 else if (rstr ==
"guest")
620 guests = plist.join(
", ");
627 if (!actor_list.isEmpty())
629 for (
const auto & [actor, role] : qAsConst(actor_list))
632 if (!guest_star_list.isEmpty())
634 for (
const auto & [actor, role] : qAsConst(guest_star_list))
649 query.
prepare(
"SELECT genre FROM programgenres "
650 "WHERE chanid = :CHANID AND starttime = :STARTTIME "
651 "AND relevance <> '0' ORDER BY relevance;");
662 s += query.
value(0).toString();
668 if (!category_type.isEmpty())
673 if (!showtype.isEmpty())
698 addItem(tr(
"Syndicated Episode Number"), syndicatedEpisodeNum,
703 category_type !=
"movie")
713 QDateTime statusDate;
725 query.
prepare(
"SELECT recstatus, starttime "
726 "FROM oldrecorded WHERE duplicate > 0 AND "
728 "((programid <> '' AND programid = :PROGRAMID) OR "
729 " (title <> '' AND title = :TITLE AND "
730 " subtitle <> '' AND subtitle = :SUBTITLE AND "
731 " description <> '' AND description = :DECRIPTION));");
742 else if (query.
next())
772 if (statusDate.isValid())
778 QString recordingRule;
779 QString lastRecorded;
780 QString nextRecording;
781 QString averageTimeShift;
782 QString watchListScore;
783 QString watchListStatus;
784 QString searchPhrase;
791 if (record && !record->
m_title.isEmpty())
792 recordingRule += QString(
" \"%2\"").arg(record->
m_title);
794 query.
prepare(
"SELECT last_record, next_record, avg_delay "
795 "FROM record WHERE recordid = :RECORDID");
800 if (query.
value(0).toDateTime().isValid())
806 if (query.
value(1).toDateTime().isValid())
812 if (query.
value(2).toInt() > 0)
813 averageTimeShift = tr(
"%n hour(s)",
"",
814 query.
value(2).toInt());
827 watchListStatus = tr(
"Auto-expire off");
830 watchListStatus = tr(
"Marked as 'watched'");
833 watchListStatus = tr(
"Not the earliest episode");
836 watchListStatus = tr(
"Recently deleted episode");
851 QDateTime fdate(QDate(1970, 1, 1),QTime(12,0,0));
865 QString recordingHost;
866 QString recordingInput;
868 QString recordedPathname;
869 QString recordedFilename;
870 QString recordedFileSize;
871 QString recordingGroup;
872 QString storageGroup;
873 QString playbackGroup;
874 QString recordingProfile;
884 recordedFileSize = QString(
"%1 ")
886 recordedFileSize += tr(
"GB",
"GigaBytes");
888 query.
prepare(
"SELECT profile FROM recorded"
889 " WHERE chanid = :CHANID"
890 " AND starttime = :STARTTIME;");
904 recordingProfile = record ? record->
m_recProfile : tr(
"Unknown");
bool isActive(void) const
bool LoadByProgram(const ProgramInfo *proginfo)
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
virtual uint64_t GetFilesize(void) const
QString GetHostname(void) const
QString GetInputName(void) const
std::tuple< QString, QString, int > DataItem
QDateTime as_utc(const QDateTime &old_dt)
Returns copy of QDateTime with TimeSpec set to UTC.
void addItem(const QString &title, const QString &value, ProgInfoList::VisibleLevel level)
uint GetRecordingID(void) const
QVariant value(int i) const
QString GetCategory(void) const
static const QRegularExpression kReLeadingAnd
Internal representation of a recording rule, mirrors the record table.
bool Create(void) override
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
QDateTime GetScheduledEndTime(void) const
The scheduled end time of the program.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
QString GetRecordingGroup(void) const
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
QString GetPathname(void) const
void PowerPriorities(const QString &ptable)
static QString toString(RecStatus::Type recstatus, uint id)
Converts "recstatus" into a short (unreadable) string.
static QString getRatings(bool recorded, uint chanid, const QDateTime &startts)
bool IsRepeat(void) const
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
RecStatus::Type GetRecordingStatus(void) const
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
bool Create(bool focusable)
Initialise buttonlist from XML.
void Toggle(void)
Toggle infolist state. Focusable widgets toggle between Basic & Full info. Non-focusable widgets togg...
QString GetTitle(void) const
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
QString GetDescription(void) const
static void DBError(const QString &where, const MSqlQuery &query)
uint GetEpisodeTotal(void) const
void BuildFocusList(void)
def rating(profile, smoonURL, gate)
RecSearchType m_searchType
QString toString(Verbosity v=kLongDescription, const QString &sep=":", const QString &grp="\"") const
void Display(const DataList &data)
Build list of key:value buttons.
QString GetPlaybackGroup(void) const
uint GetFindID(void) const
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
QString GetSeriesID(void) const
static QString i18n(const QString &msg)
Translations for play,recording, & storage groups +.
int GetNumSetting(const QString &key, int defaultval=0)
QString GetStorageGroup(void) const
QDate GetOriginalAirDate(void) const
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
ProgInfoList::DataList m_data
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
RecordingType GetRecordingRuleType(void) const
uint GetEpisode(void) const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
@ kAddYear
Add year to string if not included.
uint GetSeason(void) const
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
MythMainWindow * GetMythMainWindow(void)
@ kDateFull
Default local time.
QString GetProgramID(void) const
int GetRecordingPriority2(void) const
uint GetRecordingRuleID(void) const
QString GetBasename(void) const
bool Hide(void)
Remove infolist from display.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
QString GetSubtitle(void) const