36 #define LOC QString("EITHelper: ")
37 #define LOC_ID QString("EITHelper[%1]: ").arg(m_cardnum)
92 insertCount +=
event->UpdateDB(
query, 1000);
105 QString(
"Added %1 events -- complete: %2 incomplete: %3")
112 QString(
"Added %1 events").
arg(insertCount));
121 FixupKey atsc_key = (atsc_major << 16) | atsc_minor;
130 QStringList::const_iterator it;
131 for (it = langPref.begin(); it != langPref.end(); ++it)
133 if (!(*it).isEmpty())
157 uint atsc_key = (atsc_major << 16) | atsc_minor;
178 EventIDToATSCEvent::iterator it = events.find(eit->
EventID(i));
179 if (it != events.end())
181 delete [] (*it).m_desc;
188 events.insert(eit->
EventID(i), ev);
198 uint atsc_key = (atsc_major << 16) | atsc_minor;
202 EventIDToATSCEvent::iterator it = (*eits_it).find(ett->
EventID());
203 if (it != (*eits_it).end())
206 if (!it->IsStale()) {
208 atsc_major, atsc_minor, *it,
213 delete [] (*it).m_desc;
214 (*eits_it).erase(it);
220 QMap<uint,uint> languagePreferences,
221 QString &
title, QString &subtitle,
222 QString &description, QMultiMap<QString,QString> &items)
224 const unsigned char *bestShortEvent =
278 subtitle = sed.
Text(enc);
282 std::vector<const unsigned char*> bestExtendedEvents =
287 for (
auto & best_event : bestExtendedEvents)
298 description += eed.
Text(enc);
301 items.unite (eed.
Items());
306 unsigned char &subtitle_type,
307 unsigned char &audio_properties,
308 unsigned char &video_properties)
312 for (
auto & comp : components)
349 uint descCompression = (eit->
TableID() > 0x80) ? 2 : 1;
371 QString
title = QString(
"");
372 QString subtitle = QString(
"");
373 QString description = QString(
"");
376 unsigned char subtitle_type=0;
377 unsigned char audio_props=0;
378 unsigned char video_props=0;
381 uint totalepisodes = 0;
382 QMultiMap<QString,QString> items;
388 const unsigned char *dish_event_name =
nullptr;
401 const unsigned char *dish_event_description =
404 if (dish_event_description)
414 title, subtitle, description, items);
420 QString programId = QString(
"");
421 QString seriesId = QString(
"");
422 QString
rating = QString(
"");
423 QString rating_system = QString(
"");
424 QString advisory = QString(
"");
426 QDate originalairdate;
435 stars = mpaa.
stars();
440 rating_system =
"MPAA";
453 rating_system =
"VCHIP";
458 if (!advisory.isEmpty() && !
rating.isEmpty())
459 rating +=
", " + advisory;
460 else if (!advisory.isEmpty())
463 rating_system =
"advisory";
475 if (programId.startsWith(
"MV") || programId.startsWith(
"SP"))
489 const unsigned char *content_data =
515 static const std::array<const std::string,16> s_auGenres
516 {
"Unknown",
"Movie",
"News",
"Entertainment",
517 "Sport",
"Children",
"Music",
"Arts/Culture",
518 "Current Affairs",
"Education",
"Infotainment",
519 "Special",
"Comedy",
"Drama",
"Documentary",
525 category_type =
content.GetMythCategory(0);
530 static const std::array<const std::string,16>s_grGenres
531 {
"Unknown",
"Ταινία",
"Ενημερωτικό",
"Unknown",
532 "Αθλητικό",
"Παιδικό",
"Unknown",
"Unknown",
533 "Unknown",
"Ντοκιμαντέρ",
"Unknown",
"Unknown",
534 "Unknown",
"Unknown",
"Unknown",
"Unknown"};
539 category_type =
content.GetMythCategory(2);
549 category_type =
content.GetMythCategory(0);
557 for (
auto &
id : contentIds)
562 for (
size_t k = 0; k < desc.
CRIDCount(); k++)
572 if (!desc.
ContentId(k).startsWith (
"eventis.nl/"))
579 if (!desc.
ContentId(k).startsWith (
"eventis.nl/"))
590 if (subtitle.isEmpty()) {
594 for (
auto & specifier : private_data_specifiers) {
609 subtitle = desc.
Text();
623 title, subtitle, description,
625 starttime, endtime, fix,
630 season, episode, totalepisodes);
631 event->m_items = items;
649 QString
title = QString(
"");
650 QString subtitle = QString(
"");
651 QString description = QString(
"");
654 unsigned char subtitle_type=0;
655 unsigned char audio_props=0;
656 unsigned char video_props=0;
659 uint totalepisodes = 0;
660 QMultiMap<QString,QString> items;
667 title, subtitle, description, items);
672 const unsigned char *content_data =
692 category_type =
content.GetMythCategory(0);
707 for (
auto & trans : transmissions)
721 QString(
"Premiere EIT for NIT %1, TID %2, SID %3, "
722 "count %4, title: %5. Channel not found!")
744 title, subtitle, description,
751 season, episode, totalepisodes);
752 event->m_items = items;
792 QDateTime endtime = starttime.addSecs(event.
m_length);
795 unsigned char subtitle_type =
801 uint atsc_key = (atsc_major << 16) | atsc_minor;
804 QString
title =
event.m_title;
805 const QString& subtitle = ett;
808 m_fixup.value(atsc_key), subtitle_type,
809 audio_properties, video_properties));
818 uint64_t key = sourceid;
819 key |= ((uint64_t) atsc_minor) << 16;
820 key |= ((uint64_t) atsc_major) << 32;
822 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
838 uint64_t key = sourceid;
839 key |= ((uint64_t) serviceid) << 16;
840 key |= ((uint64_t) networkid) << 32;
841 key |= ((uint64_t) tsid) << 48;
843 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
859 uint64_t key = sourceid;
860 key |= ((uint64_t) program_number) << 16;
863 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
878 "SELECT chanid, useonairguide "
880 "WHERE deleted IS NULL AND "
881 " atsc_major_chan = :MAJORCHAN AND "
882 " atsc_minor_chan = :MINORCHAN AND "
883 " sourceid = :SOURCEID");
893 return (useOnAirGuide) ?
query.
value(0).toUInt() : 0;
904 bool useOnAirGuide =
false;
909 "SELECT chanid, useonairguide "
910 "FROM channel, dtv_multiplex "
911 "WHERE deleted IS NULL AND "
912 " serviceid = :SERVICEID AND "
913 " networkid = :NETWORKID AND "
914 " transportid = :TRANSPORTID AND "
915 " channel.sourceid = :SOURCEID AND "
916 " channel.mplexid = dtv_multiplex.mplexid";
932 LOG(VB_EIT, LOG_ERR,
LOC +
933 QString(
"Found %1 channels for sourceid %1 networkid %2 "
934 "transportid %3 serviceid %4 but only one expected")
936 .arg(sourceid).arg(networkid).arg(transportid).arg(serviceid));
943 return useOnAirGuide ? chanid : 0;
948 LOG(VB_EIT, LOG_DEBUG,
LOC +
949 QString(
"No channel found for sourceid %1 networkid %2 "
950 "transportid %3 serviceid %4")
951 .
arg(sourceid).
arg(networkid).
arg(transportid).
arg(serviceid));
966 bool useOnAirGuide =
false;
967 uint db_sourceid = 0;
972 "SELECT c1.chanid, c1.useonairguide, c1.sourceid "
973 "FROM channel c1, dtv_multiplex m, channel c2 "
974 "WHERE c1.deleted IS NULL AND "
975 " c1.serviceid = :SERVICEID AND "
976 " c1.mplexid = m.mplexid AND "
977 " m.mplexid = c2.mplexid AND "
978 " c2.chanid = :CHANID";
996 if (sourceid == db_sourceid)
997 return useOnAirGuide ? chanid : 0;
1002 LOG(VB_EIT, LOG_DEBUG,
1003 LOC + QString(
"Found %1 channels for multiplex of chanid %2, "
1004 "serviceid %3, sourceid %4 in database but none "
1005 "for current sourceid %5.")
1007 .arg(serviceid).arg(db_sourceid).arg(sourceid));
1037 for (
int i = 2001; i <= 2035; ++i)
1042 for (
int i = 2037; i <= 2057; ++i)
1046 for (
int i = 2063; i <= 2069; ++i)
1051 for (
int i = 2089; i <= 2092; ++i)
1053 for (
int i = 2094; i <= 2099; ++i)
1055 for (
int i = 2102; i <= 2110; ++i)
1071 for (
int i = 2401; i <= 2413; ++i)
1115 fix[ 1089LL << 32 | 1 << 16] =
1116 fix[ 1041LL << 32 | 1 << 16] =
1117 fix[ 1057LL << 32 | 1 << 16] =
1118 fix[ 773LL << 32 | 8468U << 16] =
1119 fix[ 2819LL << 32 | 8468U << 16] =
1120 fix[ 8706LL << 32 | 8468U << 16] =
1121 fix[ 12801LL << 32 | 8468U << 16] =
1190 fix[ 42249U << 16] =
1243 fix[ 8707LL << 32 | 8468U << 16 | 16426 ] =
1259 fix[10004LL<<32 | 61441U << 16 | 50403] =
1260 fix[10004LL<<32 | 61441U << 16 | 53101] =
1261 fix[10004LL<<32 | 61441U << 16 | 53108] =
1262 fix[10004LL<<32 | 61441U << 16 | 53109] =
1263 fix[10004LL<<32 | 61441U << 16 | 53406] =
1264 fix[10004LL<<32 | 61441U << 16 | 53407] =
1265 fix[10004LL<<32 | 61441U << 16 | 53404] =
1266 fix[10004LL<<32 | 61441U << 16 | 53408] =
1267 fix[10004LL<<32 | 61441U << 16 | 53409] =
1268 fix[10004LL<<32 | 61441U << 16 | 53410] =
1269 fix[10004LL<<32 | 61441U << 16 | 53503] =
1270 fix[10004LL<<32 | 61441U << 16 | 53411] =
1271 fix[10004LL<<32 | 61441U << 16 | 53412] =
1272 fix[10004LL<<32 | 61441U << 16 | 53112] =
1273 fix[10004LL<<32 | 61441U << 16 | 53513] =
1274 fix[10004LL<<32 | 61441U << 16 | 53618] =
1275 fix[10004LL<<32 | 61441U << 16 | 53619] =
1278 fix[10005LL<<32 | 61441U << 16 | 50104] =
1279 fix[10005LL<<32 | 61441U << 16 | 50107] =
1280 fix[10005LL<<32 | 61441U << 16 | 50301] =
1281 fix[10005LL<<32 | 61441U << 16 | 50302] =
1282 fix[10005LL<<32 | 61441U << 16 | 50303] =
1283 fix[10005LL<<32 | 61441U << 16 | 50304] =
1284 fix[10005LL<<32 | 61441U << 16 | 50305] =
1285 fix[10005LL<<32 | 61441U << 16 | 50306] =
1286 fix[10005LL<<32 | 61441U << 16 | 50307] =
1287 fix[10005LL<<32 | 61441U << 16 | 53105] =
1288 fix[10005LL<<32 | 61441U << 16 | 53115] =
1289 fix[10005LL<<32 | 61441U << 16 | 53405] =
1290 fix[10005LL<<32 | 61441U << 16 | 53402] =
1291 fix[10005LL<<32 | 61441U << 16 | 53613] =
1292 fix[10005LL<<32 | 61441U << 16 | 53516] =
1293 fix[10005LL<<32 | 61441U << 16 | 53611] =
1294 fix[10005LL<<32 | 61441U << 16 | 53104] =
1297 fix[10007LL<<32| 61441U << 16 | 53607] =
1298 fix[10007LL<<32| 61441U << 16 | 53608] =
1299 fix[10007LL<<32| 61441U << 16 | 53609] =
1300 fix[10007LL<<32| 61441U << 16 | 53628] =
1303 fix[10007LL<<32| 61441U << 16 | 53601] =
1304 fix[10007LL<<32| 61441U << 16 | 53602] =
1305 fix[10007LL<<32| 61441U << 16 | 53604] =
1306 fix[10007LL<<32| 61441U << 16 | 53606] =
1309 fix[ 10008LL<<32 | 61441U << 16 | 53002] =
1313 fix[ 9999 << 16 | 161LL << 32 | 12101 ] =
1314 fix[ 9999 << 16 | 161LL << 32 | 12104 ] =
1315 fix[ 9999 << 16 | 161LL << 32 | 12107 ] =
1316 fix[ 9999 << 16 | 161LL << 32 | 12109 ] =
1317 fix[ 9999 << 16 | 301LL << 32 | 30114 ] =
1319 fix[ 9999 << 16 | 191LL << 32 | 11102 ] =
1322 fix[ 9999 << 16 | 401LL << 32 | 29109 ] =
1325 fix[ 9999 << 16 | 121LL << 32 | 12107 ] =
1326 fix[ 9999 << 16 | 151LL << 32 | 15110 ] =
1327 fix[ 9999 << 16 | 161LL << 32 | 12107 ] =
1328 fix[ 9999 << 16 | 161LL << 32 | 12109 ] =
1329 fix[ 9999 << 16 | 171LL << 32 | 17119 ] =
1330 fix[ 9999 << 16 | 171LL << 32 | 27102 ] =
1331 fix[ 9999 << 16 | 181LL << 32 | 24108 ] =
1332 fix[ 9999 << 16 | 181LL << 32 | 25102 ] =
1333 fix[ 9999 << 16 | 191LL << 32 | 11102 ] =
1334 fix[ 9999 << 16 | 191LL << 32 | 12110 ] =
1335 fix[ 9999 << 16 | 191LL << 32 | 12111 ] =
1336 fix[ 9999 << 16 | 201LL << 32 | 27103 ] =
1337 fix[ 9999 << 16 | 211LL << 32 | 29108 ] =
1338 fix[ 9999 << 16 | 231LL << 32 | 23117 ] =
1339 fix[ 9999 << 16 | 231LL << 32 | 23115 ] =
1340 fix[ 9999 << 16 | 271LL << 32 | 27101 ] =
1341 fix[ 9999 << 16 | 541LL << 32 | 54101 ] =
1351 fix[ 1022LL << 32 | 1 << 16 | 6901 ] =
1352 fix[ 1022LL << 32 | 1 << 16 | 6905 ] =
1353 fix[ 1022LL << 32 | 1 << 16 | 6911 ] =
1354 fix[ 1072LL << 32 | 1 << 16 | 8201 ] =
1355 fix[ 1070LL << 32 | 1 << 16 | 8004 ] =
1356 fix[ 1091LL << 32 | 1 << 16 | 31220 ] =
1357 fix[ 1094LL << 32 | 1 << 16 | 17027 ] =
1358 fix[ 1094LL << 32 | 1 << 16 | 17028 ] =
1359 fix[ 1100LL << 32 | 1 << 16 | 8710 ] =
1369 fix[ 100LL << 32 | 8492LL << 16 ] =
1370 fix[ 102LL << 32 | 8492LL << 16 ] =
1371 fix[ 320LL << 32 | 8492LL << 16 ] =
1375 fix[ 2LL << 32 | 8492LL << 16 ] =