37 #define LOC QString("EITHelper: ")
38 #define LOC_ID QString("EITHelper[%1]: ").arg(m_cardnum)
90 insertCount +=
event->UpdateDB(query, 1000);
103 QString(
"Added %1 events -- complete: %2 incomplete: %3")
110 QString(
"Added %1 events").arg(insertCount));
119 FixupKey atsc_key = (atsc_major << 16) | atsc_minor;
128 QStringList::const_iterator it;
129 for (it = langPref.begin(); it != langPref.end(); ++it)
131 if (!(*it).isEmpty())
155 uint atsc_key = (atsc_major << 16) | atsc_minor;
176 EventIDToATSCEvent::iterator it = events.find(eit->
EventID(i));
177 if (it != events.end())
179 delete [] (*it).m_desc;
186 events.insert(eit->
EventID(i), ev);
196 uint atsc_key = (atsc_major << 16) | atsc_minor;
200 EventIDToATSCEvent::iterator it = (*eits_it).find(ett->
EventID());
201 if (it != (*eits_it).end())
204 if (!it->IsStale()) {
206 atsc_major, atsc_minor, *it,
211 delete [] (*it).m_desc;
212 (*eits_it).erase(it);
218 QMap<uint,uint> languagePreferences,
219 QString &title, QString &subtitle,
220 QString &description, QMultiMap<QString,QString> &items)
222 const unsigned char *bestShortEvent =
276 subtitle = sed.
Text(enc);
280 std::vector<const unsigned char*> bestExtendedEvents =
285 for (
auto & best_event : bestExtendedEvents)
296 description += eed.
Text(enc);
299 items.unite (eed.
Items());
304 unsigned char &subtitle_type,
305 unsigned char &audio_properties,
306 unsigned char &video_properties)
310 for (
auto & comp : components)
347 uint descCompression = (eit->
TableID() > 0x80) ? 2 : 1;
369 QString title = QString(
"");
370 QString subtitle = QString(
"");
371 QString description = QString(
"");
372 QString category = QString(
"");
374 unsigned char subtitle_type=0;
375 unsigned char audio_props=0;
376 unsigned char video_props=0;
379 uint totalepisodes = 0;
380 QMultiMap<QString,QString> items;
386 const unsigned char *dish_event_name =
nullptr;
397 title = dend.
Name(descCompression);
399 const unsigned char *dish_event_description =
402 if (dish_event_description)
412 title, subtitle, description, items);
418 QString programId = QString(
"");
419 QString seriesId = QString(
"");
420 QString
rating = QString(
"");
421 QString rating_system = QString(
"");
422 QString advisory = QString(
"");
424 QDate originalairdate;
433 stars = mpaa.
stars();
438 rating_system =
"MPAA";
451 rating_system =
"VCHIP";
456 if (!advisory.isEmpty() && !
rating.isEmpty())
457 rating +=
", " + advisory;
458 else if (!advisory.isEmpty())
461 rating_system =
"advisory";
473 if (programId.startsWith(
"MV") || programId.startsWith(
"SP"))
487 const unsigned char *content_data =
509 category =
content.GetCategory();
513 static const std::array<const std::string,16> s_auGenres
514 {
"Unknown",
"Movie",
"News",
"Entertainment",
515 "Sport",
"Children",
"Music",
"Arts/Culture",
516 "Current Affairs",
"Education",
"Infotainment",
517 "Special",
"Comedy",
"Drama",
"Documentary",
522 category = QString::fromStdString(s_auGenres[
content.Nibble1(0)]);
523 category_type =
content.GetMythCategory(0);
528 static const std::array<const std::string,16>s_grGenres
529 {
"Unknown",
"Ταινία",
"Ενημερωτικό",
"Unknown",
530 "Αθλητικό",
"Παιδικό",
"Unknown",
"Unknown",
531 "Unknown",
"Ντοκιμαντέρ",
"Unknown",
"Unknown",
532 "Unknown",
"Unknown",
"Unknown",
"Unknown"};
536 category = QString::fromStdString(s_grGenres[
content.Nibble2(0)]);
537 category_type =
content.GetMythCategory(2);
545 category =
content.GetDescription(0);
547 category_type =
content.GetMythCategory(0);
555 for (
auto &
id : contentIds)
560 for (
size_t k = 0; k < desc.
CRIDCount(); k++)
570 if (!desc.
ContentId(k).startsWith (
"eventis.nl/"))
577 if (!desc.
ContentId(k).startsWith (
"eventis.nl/"))
588 if (subtitle.isEmpty()) {
592 for (
auto & specifier : private_data_specifiers) {
607 subtitle = desc.
Text();
621 title, subtitle, description,
622 category, category_type,
623 starttime, endtime, fix,
628 season, episode, totalepisodes);
629 event->m_items = items;
647 QString title = QString(
"");
648 QString subtitle = QString(
"");
649 QString description = QString(
"");
650 QString category = QString(
"");
652 unsigned char subtitle_type=0;
653 unsigned char audio_props=0;
654 unsigned char video_props=0;
657 uint totalepisodes = 0;
658 QMultiMap<QString,QString> items;
665 title, subtitle, description, items);
670 const unsigned char *content_data =
685 category = QObject::tr(
"Sports");
690 category_type =
content.GetMythCategory(0);
691 category =
content.GetDescription(0);
705 for (
auto & trans : transmissions)
719 QString(
"Premiere EIT for NIT %1, TID %2, SID %3, "
720 "count %4, title: %5. Channel not found!")
721 .arg(networkid).arg(tsid).arg(serviceid)
742 title, subtitle, description,
743 category, category_type,
749 season, episode, totalepisodes);
750 event->m_items = items;
790 QDateTime endtime = starttime.addSecs(event.
m_length);
793 unsigned char subtitle_type =
795 SUB_HARDHEAR : SUB_UNKNOWN;
796 unsigned char audio_properties = AUD_UNKNOWN;
797 unsigned char video_properties = VID_UNKNOWN;
799 uint atsc_key = (atsc_major << 16) | atsc_minor;
802 QString title =
event.m_title;
803 const QString& subtitle = ett;
806 m_fixup.value(atsc_key), subtitle_type,
807 audio_properties, video_properties));
816 uint64_t key = sourceid;
817 key |= ((uint64_t) atsc_minor) << 16;
818 key |= ((uint64_t) atsc_major) << 32;
820 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
836 uint64_t key = sourceid;
837 key |= ((uint64_t) serviceid) << 16;
838 key |= ((uint64_t) networkid) << 32;
839 key |= ((uint64_t) tsid) << 48;
841 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
857 uint64_t key = sourceid;
858 key |= ((uint64_t) program_number) << 16;
861 ServiceToChanID::const_iterator it =
m_srvToChanid.constFind(key);
876 "SELECT chanid, useonairguide "
878 "WHERE deleted IS NULL AND "
879 " atsc_major_chan = :MAJORCHAN AND "
880 " atsc_minor_chan = :MINORCHAN AND "
881 " sourceid = :SOURCEID");
882 query.
bindValue(
":MAJORCHAN", atsc_major);
883 query.
bindValue(
":MINORCHAN", atsc_minor);
888 else if (query.
next())
890 bool useOnAirGuide = query.
value(1).toBool();
891 return (useOnAirGuide) ? query.
value(0).toUInt() : 0;
905 "SELECT chanid, useonairguide "
906 "FROM channel, dtv_multiplex "
907 "WHERE deleted IS NULL AND "
908 " serviceid = :SERVICEID AND "
909 " networkid = :NETWORKID AND "
910 " transportid = :TRANSPORTID AND "
911 " channel.sourceid = :SOURCEID AND "
912 " channel.mplexid = dtv_multiplex.mplexid";
915 query.
bindValue(
":SERVICEID", serviceid);
916 query.
bindValue(
":NETWORKID", networkid);
917 query.
bindValue(
":TRANSPORTID", transportid);
926 if (query.
size() > 1)
928 LOG(VB_EIT, LOG_ERR,
LOC +
929 QString(
"Found %1 channels for sourceid %1 networkid %2 "
930 "transportid %3 serviceid %4 but only one expected")
932 .arg(sourceid).arg(networkid).arg(transportid).arg(serviceid));
938 bool useOnAirGuide = query.
value(1).toBool();
939 return useOnAirGuide ? chanid : 0;
944 LOG(VB_EIT, LOG_DEBUG,
LOC +
945 QString(
"No channel found for sourceid %1 networkid %2 "
946 "transportid %3 serviceid %4")
947 .arg(sourceid).arg(networkid).arg(transportid).arg(serviceid));
961 uint db_sourceid = 0;
966 "SELECT c1.chanid, c1.useonairguide, c1.sourceid "
967 "FROM channel c1, dtv_multiplex m, channel c2 "
968 "WHERE c1.deleted IS NULL AND "
969 " c1.serviceid = :SERVICEID AND "
970 " c1.mplexid = m.mplexid AND "
971 " m.mplexid = c2.mplexid AND "
972 " c2.chanid = :CHANID";
975 query.
bindValue(
":SERVICEID", serviceid);
988 bool useOnAirGuide = query.
value(1).toBool();
989 db_sourceid = query.
value(2).toUInt();
990 if (sourceid == db_sourceid)
991 return useOnAirGuide ? chanid : 0;
994 if (query.
size() > 0)
996 LOG(VB_EIT, LOG_DEBUG,
997 LOC + QString(
"Found %1 channels for multiplex of chanid %2, "
998 "serviceid %3, sourceid %4 in database but none "
999 "for current sourceid %5.")
1000 .arg(query.
size()).arg(tunedchanid)
1001 .arg(serviceid).arg(db_sourceid).arg(sourceid));
1031 for (
int i = 2001; i <= 2035; ++i)
1036 for (
int i = 2037; i <= 2057; ++i)
1040 for (
int i = 2063; i <= 2069; ++i)
1045 for (
int i = 2089; i <= 2092; ++i)
1047 for (
int i = 2094; i <= 2099; ++i)
1049 for (
int i = 2102; i <= 2110; ++i)
1065 for (
int i = 2401; i <= 2413; ++i)
1109 fix[ 1089LL << 32 | 1 << 16] =
1110 fix[ 1041LL << 32 | 1 << 16] =
1111 fix[ 1057LL << 32 | 1 << 16] =
1112 fix[ 773LL << 32 | 8468U << 16] =
1113 fix[ 2819LL << 32 | 8468U << 16] =
1114 fix[ 8706LL << 32 | 8468U << 16] =
1115 fix[ 12801LL << 32 | 8468U << 16] =
1184 fix[ 42249U << 16] =
1237 fix[ 8707LL << 32 | 8468U << 16 | 16426 ] =
1253 fix[10004LL<<32 | 61441U << 16 | 50403] =
1254 fix[10004LL<<32 | 61441U << 16 | 53101] =
1255 fix[10004LL<<32 | 61441U << 16 | 53108] =
1256 fix[10004LL<<32 | 61441U << 16 | 53109] =
1257 fix[10004LL<<32 | 61441U << 16 | 53406] =
1258 fix[10004LL<<32 | 61441U << 16 | 53407] =
1259 fix[10004LL<<32 | 61441U << 16 | 53404] =
1260 fix[10004LL<<32 | 61441U << 16 | 53408] =
1261 fix[10004LL<<32 | 61441U << 16 | 53409] =
1262 fix[10004LL<<32 | 61441U << 16 | 53410] =
1263 fix[10004LL<<32 | 61441U << 16 | 53503] =
1264 fix[10004LL<<32 | 61441U << 16 | 53411] =
1265 fix[10004LL<<32 | 61441U << 16 | 53412] =
1266 fix[10004LL<<32 | 61441U << 16 | 53112] =
1267 fix[10004LL<<32 | 61441U << 16 | 53513] =
1268 fix[10004LL<<32 | 61441U << 16 | 53618] =
1269 fix[10004LL<<32 | 61441U << 16 | 53619] =
1272 fix[10005LL<<32 | 61441U << 16 | 50104] =
1273 fix[10005LL<<32 | 61441U << 16 | 50107] =
1274 fix[10005LL<<32 | 61441U << 16 | 50301] =
1275 fix[10005LL<<32 | 61441U << 16 | 50302] =
1276 fix[10005LL<<32 | 61441U << 16 | 50303] =
1277 fix[10005LL<<32 | 61441U << 16 | 50304] =
1278 fix[10005LL<<32 | 61441U << 16 | 50305] =
1279 fix[10005LL<<32 | 61441U << 16 | 50306] =
1280 fix[10005LL<<32 | 61441U << 16 | 50307] =
1281 fix[10005LL<<32 | 61441U << 16 | 53105] =
1282 fix[10005LL<<32 | 61441U << 16 | 53115] =
1283 fix[10005LL<<32 | 61441U << 16 | 53405] =
1284 fix[10005LL<<32 | 61441U << 16 | 53402] =
1285 fix[10005LL<<32 | 61441U << 16 | 53613] =
1286 fix[10005LL<<32 | 61441U << 16 | 53516] =
1287 fix[10005LL<<32 | 61441U << 16 | 53611] =
1288 fix[10005LL<<32 | 61441U << 16 | 53104] =
1291 fix[10007LL<<32| 61441U << 16 | 53607] =
1292 fix[10007LL<<32| 61441U << 16 | 53608] =
1293 fix[10007LL<<32| 61441U << 16 | 53609] =
1294 fix[10007LL<<32| 61441U << 16 | 53628] =
1297 fix[10007LL<<32| 61441U << 16 | 53601] =
1298 fix[10007LL<<32| 61441U << 16 | 53602] =
1299 fix[10007LL<<32| 61441U << 16 | 53604] =
1300 fix[10007LL<<32| 61441U << 16 | 53606] =
1303 fix[ 10008LL<<32 | 61441U << 16 | 53002] =
1307 fix[ 9999 << 16 | 161LL << 32 | 12101 ] =
1308 fix[ 9999 << 16 | 161LL << 32 | 12104 ] =
1309 fix[ 9999 << 16 | 161LL << 32 | 12107 ] =
1310 fix[ 9999 << 16 | 161LL << 32 | 12109 ] =
1311 fix[ 9999 << 16 | 301LL << 32 | 30114 ] =
1313 fix[ 9999 << 16 | 191LL << 32 | 11102 ] =
1316 fix[ 9999 << 16 | 401LL << 32 | 29109 ] =
1319 fix[ 9999 << 16 | 121LL << 32 | 12107 ] =
1320 fix[ 9999 << 16 | 151LL << 32 | 15110 ] =
1321 fix[ 9999 << 16 | 161LL << 32 | 12107 ] =
1322 fix[ 9999 << 16 | 161LL << 32 | 12109 ] =
1323 fix[ 9999 << 16 | 171LL << 32 | 17119 ] =
1324 fix[ 9999 << 16 | 171LL << 32 | 27102 ] =
1325 fix[ 9999 << 16 | 181LL << 32 | 24108 ] =
1326 fix[ 9999 << 16 | 181LL << 32 | 25102 ] =
1327 fix[ 9999 << 16 | 191LL << 32 | 11102 ] =
1328 fix[ 9999 << 16 | 191LL << 32 | 12110 ] =
1329 fix[ 9999 << 16 | 191LL << 32 | 12111 ] =
1330 fix[ 9999 << 16 | 201LL << 32 | 27103 ] =
1331 fix[ 9999 << 16 | 211LL << 32 | 29108 ] =
1332 fix[ 9999 << 16 | 231LL << 32 | 23117 ] =
1333 fix[ 9999 << 16 | 231LL << 32 | 23115 ] =
1334 fix[ 9999 << 16 | 271LL << 32 | 27101 ] =
1335 fix[ 9999 << 16 | 541LL << 32 | 54101 ] =
1345 fix[ 1022LL << 32 | 1 << 16 | 6901 ] =
1346 fix[ 1022LL << 32 | 1 << 16 | 6905 ] =
1347 fix[ 1022LL << 32 | 1 << 16 | 6911 ] =
1348 fix[ 1072LL << 32 | 1 << 16 | 8201 ] =
1349 fix[ 1070LL << 32 | 1 << 16 | 8004 ] =
1350 fix[ 1091LL << 32 | 1 << 16 | 31220 ] =
1351 fix[ 1094LL << 32 | 1 << 16 | 17027 ] =
1352 fix[ 1094LL << 32 | 1 << 16 | 17028 ] =
1353 fix[ 1100LL << 32 | 1 << 16 | 8710 ] =
1363 fix[ 100LL << 32 | 8492LL << 16 ] =
1364 fix[ 102LL << 32 | 8492LL << 16 ] =
1365 fix[ 320LL << 32 | 8492LL << 16 ] =
1369 fix[ 2LL << 32 | 8492LL << 16 ] =