36 #define LOC QString("EITHelper: ")
37 #define LOC_ID QString("EITHelper[%1]: ").arg(m_cardnum)
45 QString(
"EITHelper chunk size %1 and queue size %2 events")
52 QString(
"EITCache %1")
53 .arg(persistent ?
"in memory, backup to database" :
"in memory only"));
104 insertCount +=
event->UpdateDB(query, 1000);
117 QString(
"Added %1 events -- complete: %2 incomplete: %3")
124 QString(
"Added %1/%2 events, queued: %3")
125 .arg(insertCount).arg(eventCount).arg(
m_dbEvents.size()));
134 FixupKey atsc_key = (atsc_major << 16) | atsc_minor;
143 QStringList::const_iterator it;
144 for (it = langPref.begin(); it != langPref.end(); ++it)
146 if (!(*it).isEmpty())
170 uint atsc_key = (atsc_major << 16) | atsc_minor;
191 EventIDToATSCEvent::iterator it = events.find(eit->
EventID(i));
192 if (it != events.end())
194 delete [] (*it).m_desc;
201 events.insert(eit->
EventID(i), ev);
211 uint atsc_key = (atsc_major << 16) | atsc_minor;
215 EventIDToATSCEvent::iterator it = (*eits_it).find(ett->
EventID());
216 if (it != (*eits_it).end())
219 if (!it->IsStale()) {
221 atsc_major, atsc_minor, *it,
226 delete [] (*it).m_desc;
227 (*eits_it).erase(it);
233 QMap<uint,uint> languagePreferences,
234 QString &title, QString &subtitle,
235 QString &description, QMultiMap<QString,QString> &items)
237 const unsigned char *bestShortEvent =
291 subtitle = sed.
Text(enc);
295 std::vector<const unsigned char*> bestExtendedEvents =
300 for (
auto & best_event : bestExtendedEvents)
311 description += eed.
Text(enc);
314 items.unite (eed.
Items());
319 unsigned char &subtitle_type,
320 unsigned char &audio_properties,
321 unsigned char &video_properties)
325 for (
auto & comp : components)
362 uint descCompression = (eit->
TableID() > 0x80) ? 2 : 1;
384 QString title = QString(
"");
385 QString subtitle = QString(
"");
386 QString description = QString(
"");
387 QString category = QString(
"");
389 unsigned char subtitle_type=0;
390 unsigned char audio_props=0;
391 unsigned char video_props=0;
394 uint totalepisodes = 0;
395 QMultiMap<QString,QString> items;
401 const unsigned char *dish_event_name =
nullptr;
412 title = dend.
Name(descCompression);
414 const unsigned char *dish_event_description =
417 if (dish_event_description)
427 title, subtitle, description, items);
433 QString programId = QString(
"");
434 QString seriesId = QString(
"");
435 QString
rating = QString(
"");
436 QString rating_system = QString(
"");
437 QString advisory = QString(
"");
439 QDate originalairdate;
449 stars = mpaa.
stars();
454 rating_system =
"MPAA";
467 rating_system =
"VCHIP";
472 if (!advisory.isEmpty() && !
rating.isEmpty())
473 rating +=
", " + advisory;
474 else if (!advisory.isEmpty())
477 rating_system =
"advisory";
489 if (programId.startsWith(
"MV") || programId.startsWith(
"SP"))
503 const unsigned char *content_data =
525 category =
content.GetCategory();
529 static const std::array<const std::string,16> s_auGenres
530 {
"Unknown",
"Movie",
"News",
"Entertainment",
531 "Sport",
"Children",
"Music",
"Arts/Culture",
532 "Current Affairs",
"Education",
"Infotainment",
533 "Special",
"Comedy",
"Drama",
"Documentary",
538 category = QString::fromStdString(s_auGenres[
content.Nibble1(0)]);
539 category_type =
content.GetMythCategory(0);
544 static const std::array<const std::string,16>s_grGenres
545 {
"Unknown",
"Ταινία",
"Ενημερωτικό",
"Unknown",
546 "Αθλητικό",
"Παιδικό",
"Unknown",
"Unknown",
547 "Unknown",
"Ντοκιμαντέρ",
"Unknown",
"Unknown",
548 "Unknown",
"Unknown",
"Unknown",
"Unknown"};
552 category = QString::fromStdString(s_grGenres[
content.Nibble2(0)]);
553 category_type =
content.GetMythCategory(2);
561 category =
content.GetDescription(0);
563 category_type =
content.GetMythCategory(0);
571 for (
auto &
id : contentIds)
576 for (
size_t k = 0; k < desc.
CRIDCount(); k++)
586 if (!desc.
ContentId(k).startsWith (
"eventis.nl/"))
593 if (!desc.
ContentId(k).startsWith (
"eventis.nl/"))
604 if (subtitle.isEmpty()) {
608 for (
auto & specifier : private_data_specifiers) {
623 subtitle = desc.
Text();
637 title, subtitle, description,
638 category, category_type,
639 starttime, endtime, fix,
644 season, episode, totalepisodes);
645 event->m_items = items;
663 QString title = QString(
"");
664 QString subtitle = QString(
"");
665 QString description = QString(
"");
666 QString category = QString(
"");
668 unsigned char subtitle_type=0;
669 unsigned char audio_props=0;
670 unsigned char video_props=0;
673 uint totalepisodes = 0;
674 QMultiMap<QString,QString> items;
681 title, subtitle, description, items);
686 const unsigned char *content_data =
701 category = QObject::tr(
"Sports");
706 category_type =
content.GetMythCategory(0);
707 category =
content.GetDescription(0);
721 for (
auto & trans : transmissions)
735 QString(
"Premiere EIT for NIT %1, TID %2, SID %3, "
736 "count %4, title: %5. Channel not found!")
737 .arg(networkid).arg(tsid).arg(serviceid)
758 title, subtitle, description,
759 category, category_type,
765 season, episode, totalepisodes);
766 event->m_items = items;
806 QDateTime endtime = starttime.addSecs(event.
m_length);
809 unsigned char subtitle_type =
811 SUB_HARDHEAR : SUB_UNKNOWN;
812 unsigned char audio_properties = AUD_UNKNOWN;
813 unsigned char video_properties = VID_UNKNOWN;
815 uint atsc_key = (atsc_major << 16) | atsc_minor;
818 QString title =
event.m_title;
819 const QString& subtitle = ett;
822 m_fixup.value(atsc_key), subtitle_type,
823 audio_properties, video_properties));
832 uint64_t key = sourceid;
833 key |= ((uint64_t) atsc_minor) << 16;
834 key |= ((uint64_t) atsc_major) << 32;
836 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
852 uint64_t key = sourceid;
853 key |= ((uint64_t) serviceid) << 16;
854 key |= ((uint64_t) networkid) << 32;
855 key |= ((uint64_t) tsid) << 48;
857 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
873 uint64_t key = sourceid;
874 key |= ((uint64_t) program_number) << 16;
877 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
892 "SELECT chanid, useonairguide "
894 "WHERE deleted IS NULL AND "
895 " atsc_major_chan = :MAJORCHAN AND "
896 " atsc_minor_chan = :MINORCHAN AND "
897 " sourceid = :SOURCEID");
898 query.
bindValue(
":MAJORCHAN", atsc_major);
899 query.
bindValue(
":MINORCHAN", atsc_minor);
904 else if (query.
next())
906 bool useOnAirGuide = query.
value(1).toBool();
907 return (useOnAirGuide) ? query.
value(0).toUInt() : 0;
921 "SELECT chanid, useonairguide "
922 "FROM channel, dtv_multiplex "
923 "WHERE deleted IS NULL AND "
924 " serviceid = :SERVICEID AND "
925 " networkid = :NETWORKID AND "
926 " transportid = :TRANSPORTID AND "
927 " channel.sourceid = :SOURCEID AND "
928 " channel.mplexid = dtv_multiplex.mplexid";
931 query.
bindValue(
":SERVICEID", serviceid);
932 query.
bindValue(
":NETWORKID", networkid);
933 query.
bindValue(
":TRANSPORTID", transportid);
942 if (query.
size() > 1)
944 LOG(VB_EIT, LOG_ERR,
LOC +
945 QString(
"Found %1 channels for sourceid %1 networkid %2 "
946 "transportid %3 serviceid %4 but only one expected")
948 .arg(sourceid).arg(networkid).arg(transportid).arg(serviceid));
954 bool useOnAirGuide = query.
value(1).toBool();
955 return useOnAirGuide ? chanid : 0;
960 LOG(VB_EIT, LOG_DEBUG,
LOC +
961 QString(
"No channel found for sourceid %1 networkid %2 "
962 "transportid %3 serviceid %4")
963 .arg(sourceid).arg(networkid).arg(transportid).arg(serviceid));
977 uint db_sourceid = 0;
982 "SELECT c1.chanid, c1.useonairguide, c1.sourceid "
983 "FROM channel c1, dtv_multiplex m, channel c2 "
984 "WHERE c1.deleted IS NULL AND "
985 " c1.serviceid = :SERVICEID AND "
986 " c1.mplexid = m.mplexid AND "
987 " m.mplexid = c2.mplexid AND "
988 " c2.chanid = :CHANID";
991 query.
bindValue(
":SERVICEID", serviceid);
1000 while (query.
next())
1004 bool useOnAirGuide = query.
value(1).toBool();
1005 db_sourceid = query.
value(2).toUInt();
1006 if (sourceid == db_sourceid)
1007 return useOnAirGuide ? chanid : 0;
1010 if (query.
size() > 0)
1012 LOG(VB_EIT, LOG_DEBUG,
1013 LOC + QString(
"Found %1 channels for multiplex of chanid %2, "
1014 "serviceid %3, sourceid %4 in database but none "
1015 "for current sourceid %5.")
1016 .arg(query.
size()).arg(tunedchanid)
1017 .arg(serviceid).arg(db_sourceid).arg(sourceid));
1047 for (
int i = 2001; i <= 2035; ++i)
1052 for (
int i = 2037; i <= 2057; ++i)
1056 for (
int i = 2063; i <= 2069; ++i)
1061 for (
int i = 2089; i <= 2092; ++i)
1063 for (
int i = 2094; i <= 2099; ++i)
1065 for (
int i = 2102; i <= 2110; ++i)
1081 for (
int i = 2401; i <= 2413; ++i)
1125 fix[ 1089LL << 32 | 1 << 16] =
1126 fix[ 1041LL << 32 | 1 << 16] =
1127 fix[ 1057LL << 32 | 1 << 16] =
1194 fix[ 42249U << 16] =
1262 fix[ 9999 << 16 | 161LL << 32 | 12101 ] =
1263 fix[ 9999 << 16 | 161LL << 32 | 12104 ] =
1264 fix[ 9999 << 16 | 161LL << 32 | 12107 ] =
1265 fix[ 9999 << 16 | 161LL << 32 | 12109 ] =
1266 fix[ 9999 << 16 | 301LL << 32 | 30114 ] =
1268 fix[ 9999 << 16 | 191LL << 32 | 11102 ] =
1271 fix[ 9999 << 16 | 401LL << 32 | 29109 ] =
1274 fix[ 9999 << 16 | 121LL << 32 | 12107 ] =
1275 fix[ 9999 << 16 | 151LL << 32 | 15110 ] =
1276 fix[ 9999 << 16 | 161LL << 32 | 12107 ] =
1277 fix[ 9999 << 16 | 161LL << 32 | 12109 ] =
1278 fix[ 9999 << 16 | 171LL << 32 | 17119 ] =
1279 fix[ 9999 << 16 | 171LL << 32 | 27102 ] =
1280 fix[ 9999 << 16 | 181LL << 32 | 24108 ] =
1281 fix[ 9999 << 16 | 181LL << 32 | 25102 ] =
1282 fix[ 9999 << 16 | 191LL << 32 | 11102 ] =
1283 fix[ 9999 << 16 | 191LL << 32 | 12110 ] =
1284 fix[ 9999 << 16 | 191LL << 32 | 12111 ] =
1285 fix[ 9999 << 16 | 201LL << 32 | 27103 ] =
1286 fix[ 9999 << 16 | 211LL << 32 | 29108 ] =
1287 fix[ 9999 << 16 | 231LL << 32 | 23117 ] =
1288 fix[ 9999 << 16 | 231LL << 32 | 23115 ] =
1289 fix[ 9999 << 16 | 271LL << 32 | 27101 ] =
1290 fix[ 9999 << 16 | 541LL << 32 | 54101 ] =
1300 fix[ 1022LL << 32 | 1 << 16 | 6901 ] =
1301 fix[ 1022LL << 32 | 1 << 16 | 6905 ] =
1302 fix[ 1022LL << 32 | 1 << 16 | 6911 ] =
1303 fix[ 1072LL << 32 | 1 << 16 | 8201 ] =
1304 fix[ 1070LL << 32 | 1 << 16 | 8004 ] =
1305 fix[ 1091LL << 32 | 1 << 16 | 31220 ] =
1306 fix[ 1094LL << 32 | 1 << 16 | 17027 ] =
1307 fix[ 1094LL << 32 | 1 << 16 | 17028 ] =
1308 fix[ 1100LL << 32 | 1 << 16 | 8710 ] =
1318 fix[ 100LL << 32 | 8492LL << 16 ] =
1319 fix[ 102LL << 32 | 8492LL << 16 ] =
1320 fix[ 320LL << 32 | 8492LL << 16 ] =
1324 fix[ 2LL << 32 | 8492LL << 16 ] =