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;
448 stars = mpaa.
stars();
453 rating_system =
"MPAA";
466 rating_system =
"VCHIP";
471 if (!advisory.isEmpty() && !
rating.isEmpty())
472 rating +=
", " + advisory;
473 else if (!advisory.isEmpty())
476 rating_system =
"advisory";
488 if (programId.startsWith(
"MV") || programId.startsWith(
"SP"))
502 const unsigned char *content_data =
524 category =
content.GetCategory();
528 static const std::array<const std::string,16> s_auGenres
529 {
"Unknown",
"Movie",
"News",
"Entertainment",
530 "Sport",
"Children",
"Music",
"Arts/Culture",
531 "Current Affairs",
"Education",
"Infotainment",
532 "Special",
"Comedy",
"Drama",
"Documentary",
537 category = QString::fromStdString(s_auGenres[
content.Nibble1(0)]);
538 category_type =
content.GetMythCategory(0);
543 static const std::array<const std::string,16>s_grGenres
544 {
"Unknown",
"Ταινία",
"Ενημερωτικό",
"Unknown",
545 "Αθλητικό",
"Παιδικό",
"Unknown",
"Unknown",
546 "Unknown",
"Ντοκιμαντέρ",
"Unknown",
"Unknown",
547 "Unknown",
"Unknown",
"Unknown",
"Unknown"};
551 category = QString::fromStdString(s_grGenres[
content.Nibble2(0)]);
552 category_type =
content.GetMythCategory(2);
560 category =
content.GetDescription(0);
562 category_type =
content.GetMythCategory(0);
570 for (
auto &
id : contentIds)
575 for (
size_t k = 0; k < desc.
CRIDCount(); k++)
585 if (!desc.
ContentId(k).startsWith (
"eventis.nl/"))
592 if (!desc.
ContentId(k).startsWith (
"eventis.nl/"))
603 if (subtitle.isEmpty()) {
607 for (
auto & specifier : private_data_specifiers) {
622 subtitle = desc.
Text();
636 title, subtitle, description,
637 category, category_type,
638 starttime, endtime, fix,
643 season, episode, totalepisodes);
644 event->m_items = items;
662 QString title = QString(
"");
663 QString subtitle = QString(
"");
664 QString description = QString(
"");
665 QString category = QString(
"");
667 unsigned char subtitle_type=0;
668 unsigned char audio_props=0;
669 unsigned char video_props=0;
672 uint totalepisodes = 0;
673 QMultiMap<QString,QString> items;
680 title, subtitle, description, items);
685 const unsigned char *content_data =
700 category = QObject::tr(
"Sports");
705 category_type =
content.GetMythCategory(0);
706 category =
content.GetDescription(0);
720 for (
auto & trans : transmissions)
734 QString(
"Premiere EIT for NIT %1, TID %2, SID %3, "
735 "count %4, title: %5. Channel not found!")
736 .arg(networkid).arg(tsid).arg(serviceid)
757 title, subtitle, description,
758 category, category_type,
764 season, episode, totalepisodes);
765 event->m_items = items;
805 QDateTime endtime = starttime.addSecs(event.
m_length);
808 unsigned char subtitle_type =
810 SUB_HARDHEAR : SUB_UNKNOWN;
811 unsigned char audio_properties = AUD_UNKNOWN;
812 unsigned char video_properties = VID_UNKNOWN;
814 uint atsc_key = (atsc_major << 16) | atsc_minor;
817 QString title =
event.m_title;
818 const QString& subtitle = ett;
821 m_fixup.value(atsc_key), subtitle_type,
822 audio_properties, video_properties));
831 uint64_t key = sourceid;
832 key |= ((uint64_t) atsc_minor) << 16;
833 key |= ((uint64_t) atsc_major) << 32;
835 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
851 uint64_t key = sourceid;
852 key |= ((uint64_t) serviceid) << 16;
853 key |= ((uint64_t) networkid) << 32;
854 key |= ((uint64_t) tsid) << 48;
856 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
872 uint64_t key = sourceid;
873 key |= ((uint64_t) program_number) << 16;
876 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
891 "SELECT chanid, useonairguide "
893 "WHERE deleted IS NULL AND "
894 " atsc_major_chan = :MAJORCHAN AND "
895 " atsc_minor_chan = :MINORCHAN AND "
896 " sourceid = :SOURCEID");
897 query.
bindValue(
":MAJORCHAN", atsc_major);
898 query.
bindValue(
":MINORCHAN", atsc_minor);
903 else if (query.
next())
905 bool useOnAirGuide = query.
value(1).toBool();
906 return (useOnAirGuide) ? query.
value(0).toUInt() : 0;
920 "SELECT chanid, useonairguide "
921 "FROM channel, dtv_multiplex "
922 "WHERE deleted IS NULL AND "
923 " serviceid = :SERVICEID AND "
924 " networkid = :NETWORKID AND "
925 " transportid = :TRANSPORTID AND "
926 " channel.sourceid = :SOURCEID AND "
927 " channel.mplexid = dtv_multiplex.mplexid";
930 query.
bindValue(
":SERVICEID", serviceid);
931 query.
bindValue(
":NETWORKID", networkid);
932 query.
bindValue(
":TRANSPORTID", transportid);
941 if (query.
size() > 1)
943 LOG(VB_EIT, LOG_ERR,
LOC +
944 QString(
"Found %1 channels for sourceid %1 networkid %2 "
945 "transportid %3 serviceid %4 but only one expected")
947 .arg(sourceid).arg(networkid).arg(transportid).arg(serviceid));
953 bool useOnAirGuide = query.
value(1).toBool();
954 return useOnAirGuide ? chanid : 0;
959 LOG(VB_EIT, LOG_DEBUG,
LOC +
960 QString(
"No channel found for sourceid %1 networkid %2 "
961 "transportid %3 serviceid %4")
962 .arg(sourceid).arg(networkid).arg(transportid).arg(serviceid));
976 uint db_sourceid = 0;
981 "SELECT c1.chanid, c1.useonairguide, c1.sourceid "
982 "FROM channel c1, dtv_multiplex m, channel c2 "
983 "WHERE c1.deleted IS NULL AND "
984 " c1.serviceid = :SERVICEID AND "
985 " c1.mplexid = m.mplexid AND "
986 " m.mplexid = c2.mplexid AND "
987 " c2.chanid = :CHANID";
990 query.
bindValue(
":SERVICEID", serviceid);
1003 bool useOnAirGuide = query.
value(1).toBool();
1004 db_sourceid = query.
value(2).toUInt();
1005 if (sourceid == db_sourceid)
1006 return useOnAirGuide ? chanid : 0;
1009 if (query.
size() > 0)
1011 LOG(VB_EIT, LOG_DEBUG,
1012 LOC + QString(
"Found %1 channels for multiplex of chanid %2, "
1013 "serviceid %3, sourceid %4 in database but none "
1014 "for current sourceid %5.")
1015 .arg(query.
size()).arg(tunedchanid)
1016 .arg(serviceid).arg(db_sourceid).arg(sourceid));
1046 for (
int i = 2001; i <= 2035; ++i)
1051 for (
int i = 2037; i <= 2057; ++i)
1055 for (
int i = 2063; i <= 2069; ++i)
1060 for (
int i = 2089; i <= 2092; ++i)
1062 for (
int i = 2094; i <= 2099; ++i)
1064 for (
int i = 2102; i <= 2110; ++i)
1080 for (
int i = 2401; i <= 2413; ++i)
1124 fix[ 1089LL << 32 | 1 << 16] =
1125 fix[ 1041LL << 32 | 1 << 16] =
1126 fix[ 1057LL << 32 | 1 << 16] =
1127 fix[ 773LL << 32 | 8468U << 16] =
1128 fix[ 2819LL << 32 | 8468U << 16] =
1129 fix[ 8706LL << 32 | 8468U << 16] =
1130 fix[ 12801LL << 32 | 8468U << 16] =
1199 fix[ 42249U << 16] =
1252 fix[ 8707LL << 32 | 8468U << 16 | 16426 ] =
1268 fix[10004LL<<32 | 61441U << 16 | 50403] =
1269 fix[10004LL<<32 | 61441U << 16 | 53101] =
1270 fix[10004LL<<32 | 61441U << 16 | 53108] =
1271 fix[10004LL<<32 | 61441U << 16 | 53109] =
1272 fix[10004LL<<32 | 61441U << 16 | 53406] =
1273 fix[10004LL<<32 | 61441U << 16 | 53407] =
1274 fix[10004LL<<32 | 61441U << 16 | 53404] =
1275 fix[10004LL<<32 | 61441U << 16 | 53408] =
1276 fix[10004LL<<32 | 61441U << 16 | 53409] =
1277 fix[10004LL<<32 | 61441U << 16 | 53410] =
1278 fix[10004LL<<32 | 61441U << 16 | 53503] =
1279 fix[10004LL<<32 | 61441U << 16 | 53411] =
1280 fix[10004LL<<32 | 61441U << 16 | 53412] =
1281 fix[10004LL<<32 | 61441U << 16 | 53112] =
1282 fix[10004LL<<32 | 61441U << 16 | 53513] =
1283 fix[10004LL<<32 | 61441U << 16 | 53618] =
1284 fix[10004LL<<32 | 61441U << 16 | 53619] =
1287 fix[10005LL<<32 | 61441U << 16 | 50104] =
1288 fix[10005LL<<32 | 61441U << 16 | 50107] =
1289 fix[10005LL<<32 | 61441U << 16 | 50301] =
1290 fix[10005LL<<32 | 61441U << 16 | 50302] =
1291 fix[10005LL<<32 | 61441U << 16 | 50303] =
1292 fix[10005LL<<32 | 61441U << 16 | 50304] =
1293 fix[10005LL<<32 | 61441U << 16 | 50305] =
1294 fix[10005LL<<32 | 61441U << 16 | 50306] =
1295 fix[10005LL<<32 | 61441U << 16 | 50307] =
1296 fix[10005LL<<32 | 61441U << 16 | 53105] =
1297 fix[10005LL<<32 | 61441U << 16 | 53115] =
1298 fix[10005LL<<32 | 61441U << 16 | 53405] =
1299 fix[10005LL<<32 | 61441U << 16 | 53402] =
1300 fix[10005LL<<32 | 61441U << 16 | 53613] =
1301 fix[10005LL<<32 | 61441U << 16 | 53516] =
1302 fix[10005LL<<32 | 61441U << 16 | 53611] =
1303 fix[10005LL<<32 | 61441U << 16 | 53104] =
1306 fix[10007LL<<32| 61441U << 16 | 53607] =
1307 fix[10007LL<<32| 61441U << 16 | 53608] =
1308 fix[10007LL<<32| 61441U << 16 | 53609] =
1309 fix[10007LL<<32| 61441U << 16 | 53628] =
1312 fix[10007LL<<32| 61441U << 16 | 53601] =
1313 fix[10007LL<<32| 61441U << 16 | 53602] =
1314 fix[10007LL<<32| 61441U << 16 | 53604] =
1315 fix[10007LL<<32| 61441U << 16 | 53606] =
1318 fix[ 10008LL<<32 | 61441U << 16 | 53002] =
1322 fix[ 9999 << 16 | 161LL << 32 | 12101 ] =
1323 fix[ 9999 << 16 | 161LL << 32 | 12104 ] =
1324 fix[ 9999 << 16 | 161LL << 32 | 12107 ] =
1325 fix[ 9999 << 16 | 161LL << 32 | 12109 ] =
1326 fix[ 9999 << 16 | 301LL << 32 | 30114 ] =
1328 fix[ 9999 << 16 | 191LL << 32 | 11102 ] =
1331 fix[ 9999 << 16 | 401LL << 32 | 29109 ] =
1334 fix[ 9999 << 16 | 121LL << 32 | 12107 ] =
1335 fix[ 9999 << 16 | 151LL << 32 | 15110 ] =
1336 fix[ 9999 << 16 | 161LL << 32 | 12107 ] =
1337 fix[ 9999 << 16 | 161LL << 32 | 12109 ] =
1338 fix[ 9999 << 16 | 171LL << 32 | 17119 ] =
1339 fix[ 9999 << 16 | 171LL << 32 | 27102 ] =
1340 fix[ 9999 << 16 | 181LL << 32 | 24108 ] =
1341 fix[ 9999 << 16 | 181LL << 32 | 25102 ] =
1342 fix[ 9999 << 16 | 191LL << 32 | 11102 ] =
1343 fix[ 9999 << 16 | 191LL << 32 | 12110 ] =
1344 fix[ 9999 << 16 | 191LL << 32 | 12111 ] =
1345 fix[ 9999 << 16 | 201LL << 32 | 27103 ] =
1346 fix[ 9999 << 16 | 211LL << 32 | 29108 ] =
1347 fix[ 9999 << 16 | 231LL << 32 | 23117 ] =
1348 fix[ 9999 << 16 | 231LL << 32 | 23115 ] =
1349 fix[ 9999 << 16 | 271LL << 32 | 27101 ] =
1350 fix[ 9999 << 16 | 541LL << 32 | 54101 ] =
1360 fix[ 1022LL << 32 | 1 << 16 | 6901 ] =
1361 fix[ 1022LL << 32 | 1 << 16 | 6905 ] =
1362 fix[ 1022LL << 32 | 1 << 16 | 6911 ] =
1363 fix[ 1072LL << 32 | 1 << 16 | 8201 ] =
1364 fix[ 1070LL << 32 | 1 << 16 | 8004 ] =
1365 fix[ 1091LL << 32 | 1 << 16 | 31220 ] =
1366 fix[ 1094LL << 32 | 1 << 16 | 17027 ] =
1367 fix[ 1094LL << 32 | 1 << 16 | 17028 ] =
1368 fix[ 1100LL << 32 | 1 << 16 | 8710 ] =
1378 fix[ 100LL << 32 | 8492LL << 16 ] =
1379 fix[ 102LL << 32 | 8492LL << 16 ] =
1380 fix[ 320LL << 32 | 8492LL << 16 ] =
1384 fix[ 2LL << 32 | 8492LL << 16 ] =