6 #include <QRegularExpression>
20 static const QRegularExpression
kStereo { R
"(\b\(?[sS]tereo\)?\b)" };
22 static const QRegularExpression
kDotAtEnd {
"\\.$" };
24 static const QMap<QChar,quint16>
r2v = {
25 {
'I' , 1}, {
'V' , 5}, {
'X' , 10}, {
'L' , 50},
26 {
'C' , 100}, {
'D' , 500}, {
'M' , 1000},
36 for (
int i = 0; i < roman.size() - 1; i++)
38 int v1 =
r2v[roman.at(i)];
39 int v2 =
r2v[roman.at(i+1)];
40 result += (v1 >= v2) ? v1 : -v1;
42 return result +
r2v[roman.back()];
51 event.m_subtitle = QString(
"");
55 event.m_description =
event.m_subtitle;
56 event.m_subtitle = QString(
"");
64 event.m_videoProps |= VID_HDTV;
147 static const QRegularExpression emptyParens { R
"(\(\s*\))" };
150 event.m_title.remove(QChar(
'\0')).remove(emptyParens);
151 event.m_title =
event.m_title.simplified();
156 event.m_subtitle.remove(QChar(
'\0'));
157 event.m_subtitle.remove(emptyParens);
158 event.m_subtitle =
event.m_subtitle.simplified();
163 event.m_description.remove(QChar(
'\0'));
164 event.m_description.remove(emptyParens);
165 event.m_description =
event.m_description.simplified();
178 for (
auto i = event.
m_items.begin(); i != event.
m_items.end(); ++i)
180 LOG(VB_EIT, LOG_DEBUG, QString(
"Unhandled item in EIT for"
181 " channel id \"%1\", \"%2\": %3").arg(event.
m_chanid)
182 .arg(i.key(), i.value()));
208 QString crid =
id.toLower();
211 if (crid.startsWith(
"crid://"))
215 if (crid.length() >= 1 && crid[0] !=
'/')
219 if (authority.isEmpty())
222 return authority + crid;
233 int position =
event.m_description.indexOf(
'\r');
239 event.m_subtitle =
event.m_description.left(position);
240 event.m_description =
event.m_description.right(
246 position =
event.m_description.indexOf(
".");
254 event.m_category =
"Unknown";
263 position =
event.m_description.indexOf(
".");
265 position =
event.m_description.indexOf(
". ");
268 if ((position > -1) && position < 20)
270 const QString stmp =
event.m_description;
271 event.m_description = stmp.right(stmp.length() - position - 2);
272 event.m_category = stmp.left(position);
274 int position_p =
event.m_category.indexOf(
"(");
275 if (position_p == -1)
276 event.m_description = stmp.right(stmp.length() - position - 2);
278 event.m_category =
"Unknown";
282 event.m_category =
"Unknown";
288 event.m_category =
"OffAir";
291 event.m_category =
"Unknown";
296 event.m_description =
event.m_description.replace(theme,
"");
298 event.m_description =
event.m_description.right(event.
m_description.length() - 1);
300 event.m_description =
event.m_description.right(event.
m_description.length() - 1);
304 static const QRegularExpression bellYear { R
"(\([0-9]{4}\))" };
305 position = event.m_description.indexOf(bellYear);
306 if (position != -1 && !event.
m_category.isEmpty())
310 uint y =
event.m_description.mid(position + 1, 4).toUInt(&ok);
313 event.m_originalairdate = QDate(y, 1, 1);
315 event.m_previouslyshown =
true;
321 static const QRegularExpression bellActors { R
"(\set\s|,)" };
322 QString tmp = event.m_description.left(position-3);
324 tmp.split(bellActors, Qt::SkipEmptyParts);
328 for (
const auto & actor : std::as_const(actors))
332 event.m_description =
event.m_description.right(
338 position =
event.m_description.indexOf(
"(CC)");
341 event.m_subtitleType |= SUB_HARDHEAR;
342 event.m_description =
event.m_description.replace(
"(CC)",
"");
347 if (match.hasMatch())
349 event.m_audioProps |= AUD_STEREO;
350 event.m_description.remove(match.capturedStart(0),
351 match.capturedLength(0));
355 static const QRegularExpression bellPPVTitleAllDayHD { R
"(\s*\(All Day\, HD\)\s*$)" };
356 match = bellPPVTitleAllDayHD.match(event.m_title);
357 if (match.hasMatch())
359 event.m_title.remove(match.capturedStart(), match.capturedLength());
360 event.m_videoProps |= VID_HDTV;
364 static const QRegularExpression bellPPVTitleAllDay { R
"(\s*\(All Day.*\)\s*$)" };
365 match = bellPPVTitleAllDay.match(event.m_title);
366 if (match.hasMatch())
367 event.m_title.remove(match.capturedStart(), match.capturedLength());
370 static const QRegularExpression bellPPVTitleHD { R
"(^HD\s?-\s?)" };
371 match = bellPPVTitleHD.match(event.m_title);
372 if (match.hasMatch())
374 event.m_title.remove(match.capturedStart(), match.capturedLength());
375 event.m_videoProps |= VID_HDTV;
379 position =
event.m_description.indexOf(
"(HD)");
382 event.m_description =
event.m_description.replace(
"(HD)",
"");
383 event.m_videoProps |= VID_HDTV;
387 position =
event.m_title.indexOf(
"(HD)");
390 event.m_title =
event.m_title.replace(
"(HD)",
"");
391 event.m_videoProps |= VID_HDTV;
395 static const QRegularExpression dishPPVTitleHD { R
"(\sHD\s*$)" };
396 match = dishPPVTitleHD.match(event.m_title);
397 if (match.hasMatch())
399 event.m_title.remove(match.capturedStart(), match.capturedLength());
400 event.m_videoProps |= VID_HDTV;
404 position =
event.m_description.indexOf(
"(DD)");
407 event.m_description =
event.m_description.replace(
"(DD)",
"");
408 event.m_audioProps |= AUD_DOLBY;
409 event.m_audioProps |= AUD_STEREO;
413 position =
event.m_description.indexOf(
"(SAP)");
416 event.m_description =
event.m_description.replace(
"(SAP",
"");
417 event.m_subtitleType |= SUB_HARDHEAR;
421 static const QRegularExpression dishPPVTitleColon { R
"(\:\s*$)" };
422 match = dishPPVTitleColon.match(event.m_title);
423 if (match.hasMatch())
424 event.m_title.remove(match.capturedStart(), match.capturedLength());
427 static const QRegularExpression dishDescriptionNew { R
"(\s*New\.\s*)" };
429 if (match.hasMatch())
431 event.m_previouslyshown =
false;
432 event.m_description.remove(match.capturedStart(), match.capturedLength());
436 static const QRegularExpression dishDescriptionFinale { R
"(\s*(Series|Season)\sFinale\.\s*)" };
438 if (match.hasMatch())
440 event.m_previouslyshown =
false;
441 event.m_description.remove(match.capturedStart(), match.capturedLength());
445 static const QRegularExpression dishDescriptionFinale2 { R
"(\s*Finale\.\s*)" };
447 if (match.hasMatch())
449 event.m_previouslyshown =
false;
450 event.m_description.remove(match.capturedStart(), match.capturedLength());
454 static const QRegularExpression dishDescriptionPremiere { R
"(\s*(Series|Season)\s(Premier|Premiere)\.\s*)" };
456 if (match.hasMatch())
458 event.m_previouslyshown =
false;
459 event.m_description.remove(match.capturedStart(), match.capturedLength());
463 static const QRegularExpression dishDescriptionPremiere2 { R
"(\s*(Premier|Premiere)\.\s*)" };
465 if (match.hasMatch())
467 event.m_previouslyshown =
false;
468 event.m_description.remove(match.capturedStart(), match.capturedLength());
472 static const QRegularExpression ppvcode { R
"(\s*\(([A-Z]|[0-9]){5}\)\s*$)",
473 QRegularExpression::CaseInsensitiveOption };
475 if (match.hasMatch())
476 event.m_description.remove(match.capturedStart(), match.capturedLength());
479 static const QRegularExpression dishPPVSpacePerenEnd { R
"(\s\)\s*$)" };
481 if (match.hasMatch())
482 event.m_description.remove(match.capturedStart(), match.capturedLength());
485 static const QRegularExpression bellPPVSubtitleAllDay { R
"(^All Day \(.*\sEastern\)\s*$)" };
486 match = bellPPVSubtitleAllDay.match(event.m_subtitle);
487 if (match.hasMatch())
488 event.m_subtitle.remove(match.capturedStart(), match.capturedLength());
491 static const QRegularExpression bellPPVDescriptionAllDay { R
"(^\(.*\sEastern\))" };
493 if (match.hasMatch())
494 event.m_description.remove(match.capturedStart(), match.capturedLength());
497 static const QRegularExpression bellPPVDescriptionAllDay2 { R
"(^\([0-9].*am-[0-9].*am\sET\))" };
498 match = bellPPVDescriptionAllDay2.match(event.m_description);
499 if (match.hasMatch())
500 event.m_description.remove(match.capturedStart(), match.capturedLength());
503 static const QRegularExpression bellPPVDescriptionEventId { R
"(\([0-9]{5}\))" };
504 match = bellPPVDescriptionEventId.match(event.m_description);
505 if (match.hasMatch())
506 event.m_description.remove(match.capturedStart(), match.capturedLength());
514 QStringList strListColon =
event.m_description.split(
":");
515 QStringList strListEnd;
518 bool fQuotedSubtitle =
false;
520 if (strListColon.count()>1)
522 bool fDoubleDot =
false;
523 bool fSingleDot =
true;
524 int nLength = strListColon[0].length();
526 int nPosition1 =
event.m_description.indexOf(
"..");
527 if ((nPosition1 < nLength) && (nPosition1 >= 0))
529 nPosition1 =
event.m_description.indexOf(
".");
532 if (nPosition1 > nLength)
536 QString strTmp =
event.m_description.mid(nPosition1+1,
539 QStringList
tmp = strTmp.split(
" ");
546 strListEnd = strListColon;
549 else if (!fSingleDot)
551 QStringList strListTmp;
554 for (
int i =0; (i<strListColon.count()) && (nTitleMax==-1);i++)
556 const QStringList
tmp = strListColon[i].split(
" ");
558 nTitle +=
tmp.size();
561 strListTmp.push_back(strListColon[i]);
566 for (
int i=0;i<(nTitleMax-1);i++)
567 strPartial+=strListTmp[i]+
":";
570 strPartial+=strListTmp[nTitleMax-1];
571 strListEnd.push_back(strPartial);
573 for (
int i=nTitleMax+1;i<strListColon.count();i++)
574 strListEnd.push_back(strListColon[i]);
578 static const QRegularExpression ukQuotedSubtitle { R
"(^'([\w\s\-,]+?)\.' )" };
580 if (match.hasMatch())
582 event.m_subtitle = match.captured(1);
583 event.m_description.remove(match.capturedStart(0),
584 match.capturedLength(0));
585 fQuotedSubtitle =
true;
587 QStringList strListPeriod;
588 QStringList strListQuestion;
589 QStringList strListExcl;
590 if (!(fColon || fQuotedSubtitle))
592 strListPeriod =
event.m_description.split(
".");
593 if (strListPeriod.count() >1)
595 int nPosition1 =
event.m_description.indexOf(
".");
596 int nPosition2 =
event.m_description.indexOf(
"..");
597 if ((nPosition1 < nPosition2) || (nPosition2==-1))
598 strListEnd = strListPeriod;
601 strListQuestion =
event.m_description.split(
"?");
602 strListExcl =
event.m_description.split(
"!");
603 if ((strListQuestion.size() > 1) &&
606 strListEnd = strListQuestion;
609 else if ((strListExcl.size() > 1) &&
612 strListEnd = strListExcl;
621 if (!strListEnd.empty())
623 QStringList strListSpace = strListEnd[0].split(
624 " ", Qt::SkipEmptyParts);
629 static const QRegularExpression ukExclusionFromSubtitle {
630 "(starring|stars\\s|drama|seres|sitcom)",
631 QRegularExpression::CaseInsensitiveOption };
632 if (strListSpace.filter(ukExclusionFromSubtitle).empty())
634 event.m_subtitle = strListEnd[0]+strEnd;
637 event.m_description.mid(strListEnd[0].length()+1);
649 static const QRegularExpression uk24ep { R
"(^\d{1,2}:00[ap]m to \d{1,2}:00[ap]m: )" };
650 static const QRegularExpression ukTime { R
"(\d{1,2}[\.:]\d{1,2}\s*(am|pm|))" };
653 bool isMovie =
event.m_category.startsWith(
"Movie",Qt::CaseInsensitive) ||
654 event.m_category.startsWith(
"Film",Qt::CaseInsensitive);
656 static const QRegularExpression ukThen { R
"(\s*?(Then|Followed by) 60 Seconds\.)",
657 QRegularExpression::CaseInsensitiveOption };
658 static const QRegularExpression ukNew { R
"((New\.|\s*?(Brand New|New)\s*?(Series|Episode)\s*?[:\.\-]))",
659 QRegularExpression::CaseInsensitiveOption };
660 static const QRegularExpression ukNewTitle { R
"(^(Brand New|New:)\s*)",
661 QRegularExpression::CaseInsensitiveOption };
662 event.m_description =
event.m_description.remove(ukThen);
663 event.m_description =
event.m_description.remove(ukNew);
664 event.m_title =
event.m_title.remove(ukNewTitle);
667 static const QRegularExpression ukTitleRemove {
"^(?:[tT]4:|Schools\\s*?:)" };
668 static const QRegularExpression ukDescriptionRemove { R
"(^(?:CBBC\s*?\.|CBeebies\s*?\.|Class TV\s*?:|BBC Switch\.))" };
669 event.m_title =
event.m_title.remove(ukTitleRemove);
670 event.m_description =
event.m_description.remove(ukDescriptionRemove);
673 static const QRegularExpression ukBBC34 { R
"(BBC (?:THREE|FOUR) on BBC (?:ONE|TWO)\.)",
674 QRegularExpression::CaseInsensitiveOption };
675 event.m_description =
event.m_description.remove(ukBBC34);
678 static const QRegularExpression ukBBC7rpt { R
"(\[Rptd?[^]]+?\d{1,2}\.\d{1,2}[ap]m\]\.)" };
679 event.m_description =
event.m_description.remove(ukBBC7rpt);
682 static const QRegularExpression ukAllNew { R
"(All New To 4Music!\s?)" };
683 event.m_description =
event.m_description.remove(ukAllNew);
686 static const QRegularExpression ukAlsoInHD { R
"(\s*Also in HD\.)",
687 QRegularExpression::CaseInsensitiveOption };
688 event.m_description =
event.m_description.remove(ukAlsoInHD);
691 static const QRegularExpression ukCC { R
"(\[(?:(AD|SL|S|W|HD),?)+\])" };
693 while (match.hasMatch())
695 QStringList tmpCCitems = match.captured(0).remove(
"[").remove(
"]").split(
",");
696 if (tmpCCitems.contains(
"AD"))
697 event.m_audioProps |= AUD_VISUALIMPAIR;
698 if (tmpCCitems.contains(
"HD"))
699 event.m_videoProps |= VID_HDTV;
700 if (tmpCCitems.contains(
"S"))
701 event.m_subtitleType |= SUB_NORMAL;
702 if (tmpCCitems.contains(
"SL"))
703 event.m_subtitleType |= SUB_SIGNED;
704 if (tmpCCitems.contains(
"W"))
705 event.m_videoProps |= VID_WIDESCREEN;
706 event.m_description.remove(match.capturedStart(0),
707 match.capturedLength(0));
708 match = ukCC.match(event.
m_description, match.capturedStart(0));
711 event.m_title =
event.m_title.trimmed();
712 event.m_description =
event.m_description.trimmed();
718 static const QString seasonStr = R
"(\b(?:Season|Series|S)\s*(\d+)\s*,?)";
725 static const QString longEp = R
"(\b(?:Ep|Episode)\s*(\d+)\s*(?:(?:/|of)\s*(\d*))?)";
729 static const QString longSeasEp = QString(
"\\(?(?:%1)?\\s*%2").arg(seasonStr, longEp);
733 static const QString longContext = QString(R
"(\(*%1\s*\)?\s*\.?)").arg(longSeasEp);
737 static const QString shortEp = R
"((\d+)\s*(?:/|of)\s*(\d+))";
744 static const QString shortContext =
745 QString(R
"((?:^|\.)(\s*\(*\s*%1[\s)]*(?:[).:]|$)))").arg(shortEp);
750 static const QRegularExpression ukSeries {
"(?:" + longContext +
"|" + shortContext +
")",
751 QRegularExpression::CaseInsensitiveOption };
754 bool fromTitle =
true;
755 match = ukSeries.match(event.
m_title);
756 if (!match.hasMatch())
761 if (match.hasMatch())
763 if (!match.captured(1).isEmpty())
765 event.m_season = match.captured(1).toUInt();
769 if (!match.captured(2).isEmpty())
771 event.m_episode = match.captured(2).toUInt();
774 else if (!match.captured(5).isEmpty())
776 event.m_episode = match.captured(5).toUInt();
780 if (!match.captured(3).isEmpty())
782 event.m_totalepisodes = match.captured(3).toUInt();
785 else if (!match.captured(6).isEmpty())
787 event.m_totalepisodes = match.captured(6).toUInt();
792 int form = match.captured(4).isEmpty() ? 0 : 4;
796 LOG(VB_EIT, LOG_DEBUG, QString(
"Extracted S%1E%2/%3 from title (%4) \"%5\"")
800 event.m_title.remove(match.capturedStart(form),
801 match.capturedLength(form));
805 LOG(VB_EIT, LOG_DEBUG, QString(
"Extracted S%1E%2/%3 from description (%4) \"%5\"")
809 if (match.capturedStart(form) == 0)
813 event.m_description.remove(match.capturedStart(form),
814 match.capturedLength(form));
826 static const QRegularExpression ukPart { R
"([-(\:,.]\s*(?:Part|Pt)\s*(\d+)\s*(?:(?:of|/)\s*(\d+))?\s*[-):,.])",
827 QRegularExpression::CaseInsensitiveOption };
828 match = ukPart.match(event.m_title);
830 if (match.hasMatch())
832 event.m_partnumber = match.captured(1).toUInt();
833 event.m_parttotal = match.captured(2).toUInt();
835 LOG(VB_EIT, LOG_DEBUG, QString(
"Extracted Part %1/%2 from title (%3)")
839 event.m_title.remove(match.capturedStart(0),
840 match.capturedLength(0));
842 else if (match2.hasMatch())
844 event.m_partnumber = match2.captured(1).toUInt();
845 event.m_parttotal = match2.captured(2).toUInt();
847 LOG(VB_EIT, LOG_DEBUG, QString(
"Extracted Part %1/%2 from description (%3) \"%4\"")
853 if (match2.capturedStart(0) == 0)
856 QString sub = match2.captured(0).contains(
":") ?
":" :
"";
857 event.m_description =
event.m_description.replace(match2.captured(0), sub);
861 static const QRegularExpression ukStarring { R
"((?:Western\s)?[Ss]tarring ([\w\s\-']+?)[Aa]nd\s([\w\s\-']+?)[\.|,]\s*(\d{4})?(?:\.\s)?)" };
863 if (match.hasMatch())
870 if (match.captured(3).length() > 0)
873 uint y = match.captured(3).toUInt(&ok);
877 event.m_originalairdate = QDate(y, 1, 1);
882 static const QRegularExpression ukLaONoSplit {
"^Law & Order: (?:Criminal Intent|LA|"
883 "Special Victims Unit|Trial by Jury|UK|You the Jury)" };
884 if (!event.
m_title.startsWith(
"CSI:") && !event.
m_title.startsWith(
"CD:") &&
885 !event.
m_title.contains(ukLaONoSplit) &&
886 !event.
m_title.startsWith(
"Mission: Impossible"))
888 static const QRegularExpression ukDoubleDotStart { R
"(^\.\.+)" };
889 static const QRegularExpression ukDoubleDotEnd { R
"(\.\.+$)" };
890 if ((event.
m_title.indexOf(ukDoubleDotEnd) != -1) &&
893 QString strPart=
event.m_title.remove(ukDoubleDotEnd)+
" ";
894 strFull = strPart +
event.m_description.remove(ukDoubleDotStart);
895 static const QRegularExpression ukCEPQ { R
"([:\!\.\?]\s)" };
896 static const QRegularExpression ukSpaceStart {
"^ " };
897 int position1 = strFull.indexOf(ukCEPQ,strPart.length());
898 if (isMovie && (position1 != -1))
900 if (strFull[position1] ==
'!' || strFull[position1] ==
'?'
901 || (position1>2 && strFull[position1] ==
'.' && strFull[position1-2] ==
'.'))
903 event.m_title = strFull.left(position1);
904 event.m_description = strFull.mid(position1 + 1);
905 event.m_description.remove(ukSpaceStart);
909 position1 = strFull.indexOf(ukCEPQ);
912 if (strFull[position1] ==
'!' || strFull[position1] ==
'?'
913 || (position1>2 && strFull[position1] ==
'.' && strFull[position1-2] ==
'.'))
915 event.m_title = strFull.left(position1);
916 event.m_description = strFull.mid(position1 + 1);
917 event.m_description.remove(ukSpaceStart);
925 if (match24.hasMatch())
929 event.m_subtitle =
event.m_description.mid(match24.capturedStart(0),
930 match24.captured(0).length() - 2);
931 event.m_description =
event.m_description.remove(match24.captured(0));
936 static const QRegularExpression ukYearColon { R
"(^[\d]{4}:)" };
937 if (!isMovie && (event.
m_title.indexOf(ukYearColon) < 0))
939 int position1 =
event.m_title.indexOf(
":");
940 if ((position1 != -1) &&
943 static const QRegularExpression ukCompleteDots { R
"(^\.\.+$)" };
944 if (event.
m_title.mid(position1+1).indexOf(ukCompleteDots)==0)
947 QString strTmp =
event.m_title.mid(position1+1);
948 event.m_title.resize(position1);
949 event.m_subtitle = strTmp+
event.m_subtitle;
953 event.m_subtitle =
event.m_title.mid(position1 + 1);
954 event.m_title =
event.m_title.left(position1);
966 !event.
m_title.startsWith(
"The X-Files"))
968 int position1 =
event.m_description.indexOf(ukTime);
971 static const QRegularExpression ukColonPeriod { R
"([:\.])" };
972 int position2 =
event.m_description.indexOf(ukColonPeriod);
973 if ((position2>=0) && (position2 < (position1-2)))
978 position1 =
event.m_title.indexOf(
"-");
983 event.m_subtitle =
event.m_title.mid(position1 + 1);
985 event.m_title =
event.m_title.left(position1);
996 static const QRegularExpression ukYear { R
"([\[\(]([\d]{4})[\)\]])" };
998 if (match.hasMatch())
1000 event.m_description.remove(match.capturedStart(0),
1001 match.capturedLength(0));
1003 uint y = match.captured(1).toUInt(&ok);
1006 event.m_airdate = y;
1007 event.m_originalairdate = QDate(y, 1, 1);
1012 static const QRegularExpression ukDotSpaceStart { R
"(^\. )" };
1013 static const QRegularExpression ukDotEnd { R
"(\.$)" };
1014 event.m_subtitle.remove(ukDotSpaceStart);
1016 event.m_subtitle.remove(ukDotEnd);
1021 event.m_description=
event.m_subtitle;
1022 event.m_subtitle.clear();
1032 int position =
event.m_description.indexOf(
':');
1035 const QString stmp =
event.m_description;
1036 event.m_subtitle = stmp.left(position);
1037 event.m_description = stmp.right(stmp.length() - position - 2);
1046 static const QRegularExpression comHemPersSeparator { R
"((, |\soch\s))" };
1051 event.m_subtitle =
event.m_description;
1052 event.m_description =
"";
1056 event.m_subtitle =
"";
1058 bool isSeries =
false;
1060 static const QRegularExpression comHemSeries1
1061 { R
"(\s?(?:[dD]el|[eE]pisode)\s([0-9]+)(?:\s?(?:/|:|av)\s?([0-9]+))?\.)" };
1062 static const QRegularExpression comHemSeries2 { R
"(\s?-?\s?([Dd]el\s+([0-9]+)))" };
1064 auto match2 = comHemSeries2.match(event.
m_title);
1065 if (match2.hasMatch())
1067 event.m_partnumber = match2.capturedView(2).toUInt();
1068 event.m_title.remove(match2.capturedStart(), match2.capturedLength());
1070 else if (match.hasMatch())
1072 if (match.capturedStart(1) != -1)
1073 event.m_partnumber = match.capturedView(1).toUInt();
1074 if (match.capturedStart(2) != -1)
1075 event.m_parttotal = match.capturedView(2).toUInt();
1079 if (match.capturedStart() > 0)
1080 event.m_description.remove(match.capturedStart(),
1081 match.capturedLength());
1089 event.m_subtitle = QString(
"Del %1").arg(event.
m_partnumber);
1091 event.m_subtitle += QString(
" av %1").arg(event.
m_parttotal);
1095 static const QRegularExpression comHemTSub { R
"(\s+-\s+([^\-]+))" };
1096 match = comHemTSub.match(event.m_title);
1097 if (match.hasMatch())
1099 event.m_subtitle = match.captured(1);
1100 event.m_title.remove(match.capturedStart(), match.capturedLength());
1109 static const QRegularExpression comHemCountry
1110 { R
"(^(\(.+\))?\s?([^ ]+)\s([^\.0-9]+)\sfrån\s([0-9]{4})(?:\smed\s([^\.]+))?\.?)" };
1112 if (match.hasMatch())
1114 QString replacement;
1118 if (!match.capturedView(1).isEmpty())
1120 replacement = match.captured(1) +
" ";
1125 if (!match.capturedView(2).isEmpty())
1127 replacement += match.captured(2) +
" ";
1132 if (!match.capturedView(3).isEmpty())
1134 replacement += match.captured(3) +
".";
1137 event.m_category = match.captured(3);
1140 if(match.captured(3).indexOf(
"serie")!=-1)
1147 if (!match.capturedView(4).isEmpty())
1150 uint y = match.capturedView(4).trimmed().toUInt(&ok);
1152 event.m_airdate = y;
1156 if (!match.capturedView(5).isEmpty())
1158 const QStringList actors =
1159 match.captured(5).split(comHemPersSeparator, Qt::SkipEmptyParts);
1162 for (
const auto & actor : std::as_const(actors))
1169 event.m_description =
event.m_description.replace(match.captured(0),replacement);
1176 static const QRegularExpression comHemPersons
1177 { R
"(\s?([Rr]egi|[Ss]kådespelare|[Pp]rogramledare|[Ii] rollerna):\s([^\.]+)\.)" };
1179 while (iter.hasNext())
1181 auto pmatch = iter.next();
1184 static const QRegularExpression comHemDirector {
"[Rr]egi" };
1185 static const QRegularExpression comHemActor {
"[Ss]kådespelare|[Ii] rollerna" };
1186 static const QRegularExpression comHemHost {
"[Pp]rogramledare" };
1187 auto dmatch = comHemDirector.match(pmatch.capturedView(1));
1188 auto amatch = comHemActor.match(pmatch.capturedView(1));
1189 auto hmatch = comHemHost.match(pmatch.capturedView(1));
1190 if (dmatch.hasMatch())
1192 else if (amatch.hasMatch())
1194 else if (hmatch.hasMatch())
1198 event.m_description.remove(pmatch.capturedStart(), pmatch.capturedLength());
1202 const QStringList actors =
1203 pmatch.captured(2).split(comHemPersSeparator, Qt::SkipEmptyParts);
1206 for (
const auto & actor : std::as_const(actors))
1207 event.AddPerson(role, actor);
1210 event.m_description=
event.m_description.replace(pmatch.captured(0),
"");
1217 if (process_subtitle)
1219 static const QRegularExpression comHemSub { R
"([.\?\!] )" };
1220 int pos2 =
event.m_description.indexOf(comHemSub);
1221 bool pvalid = pos2 != -1 && pos2 <= 55;
1222 if (pvalid && (event.
m_description.length() - (pos2 + 2)) > 0)
1224 event.m_subtitle =
event.m_description.left(
1226 event.m_description =
event.m_description.mid(pos2 + 2);
1231 static const QRegularExpression comHemTT {
"[Tt]ext-[Tt][Vv]" };
1233 event.m_subtitleType |= SUB_NORMAL;
1236 static const QRegularExpression comHemRerun1 { R
"([Rr]epris\sfrån\s([^\.]+)(?:\.|$))" };
1237 static const QRegularExpression comHemRerun2 { R
"(([0-9]+)/([0-9]+)(?:\s-\s([0-9]{4}))?)" };
1239 if (!match.hasMatch())
1243 if (match.captured(1) ==
"i dag")
1245 event.m_originalairdate =
event.m_starttime.date();
1250 if (match.captured(1) ==
"eftermiddagen")
1252 event.m_originalairdate =
event.m_starttime.date().addDays(-1);
1257 match2 = comHemRerun2.match(match.capturedView(1));
1258 if (match2.hasMatch())
1260 int day = match2.capturedView(1).toInt();
1261 int month = match2.capturedView(2).toInt();
1268 if (day > 0 && month > 0)
1270 QDate date(event.
m_starttime.date().year(), month, day);
1273 date = date.addYears(-1);
1274 event.m_originalairdate = date;
1285 event.m_category =
event.m_subtitle;
1287 int position =
event.m_description.indexOf(
':');
1290 const QString stmp =
event.m_description;
1291 event.m_subtitle = stmp.left(position);
1292 event.m_description = stmp.right(stmp.length() - position - 2);
1303 event.m_description =
"";
1305 if (event.
m_description.endsWith(
"Copyright West TV Ltd. 2011)"))
1306 event.m_description.resize(event.
m_description.length()-40);
1310 event.m_description =
event.m_subtitle;
1311 event.m_subtitle.clear();
1314 event.m_description.remove(0,event.
m_title.length()+3);
1315 if (event.
m_title.startsWith(
"LIVE: ", Qt::CaseInsensitive))
1317 event.m_title.remove(0, 6);
1318 event.m_description.prepend(
"(Live) ");
1327 static const QRegularExpression
rating {
"\\((G|PG|M|MA)\\)" };
1329 if (match.hasMatch())
1333 event.m_ratings.push_back(prograting);
1334 event.m_description.remove(0,match.capturedLength()+1);
1338 event.m_videoProps |= VID_HDTV;
1339 event.m_description.remove(0,5);
1343 event.m_subtitleType |= SUB_NORMAL;
1344 event.m_description.remove(0,5);
1348 event.m_subtitle.clear();
1352 event.m_description.remove(0,event.
m_title.length()+1);
1362 event.m_previouslyshown =
true;
1365 static const QRegularExpression year {
"(\\d{4})$" };
1367 if (match.hasMatch())
1369 event.m_airdate = match.capturedView(1).toUInt();
1374 event.m_subtitleType |= SUB_NORMAL;
1378 static const QRegularExpression adv {
"(\\([A-Z,]+\\))$" };
1380 if (match.hasMatch())
1382 advisories = match.captured(1);
1383 event.m_description.remove(match.capturedStart()-1, match.capturedLength()+1);
1385 static const QRegularExpression
rating {
"(C|G|PG|M|MA)$" };
1387 if (match.hasMatch())
1391 if (!advisories.isEmpty())
1392 prograting.
m_rating.append(
" ").append(advisories);
1393 event.m_ratings.push_back(prograting);
1394 event.m_description.remove(match.capturedStart()-1, match.capturedLength()+1);
1406 event.m_description =
event.m_description.trimmed();
1408 static const QRegularExpression auFreeviewSY { R
"((.*) \((.+)\) \(([12][0-9][0-9][0-9])\)$)" };
1410 if (match.hasMatch())
1413 event.m_subtitle = match.captured(2);
1414 event.m_airdate = match.capturedView(3).toUInt();
1415 event.m_description = match.captured(1);
1418 static const QRegularExpression auFreeviewY {
"(.*) \\(([12][0-9][0-9][0-9])\\)$" };
1420 if (match.hasMatch())
1422 event.m_airdate = match.capturedView(2).toUInt();
1423 event.m_description = match.captured(1);
1426 static const QRegularExpression auFreeviewSYC { R
"((.*) \((.+)\) \(([12][0-9][0-9][0-9])\) \((.+)\)$)" };
1428 if (match.hasMatch())
1431 event.m_subtitle = match.captured(2);
1432 event.m_airdate = match.capturedView(3).toUInt();
1433 QStringList actors = match.captured(4).split(
"/");
1436 for (
const QString& actor : std::as_const(actors))
1438 event.m_description = match.captured(1);
1441 static const QRegularExpression auFreeviewYC { R
"((.*) \(([12][0-9][0-9][0-9])\) \((.+)\)$)" };
1443 if (match.hasMatch())
1445 event.m_airdate = match.capturedView(2).toUInt();
1446 QStringList actors = match.captured(3).split(
"/");
1449 for (
const QString& actor : std::as_const(actors))
1451 event.m_description = match.captured(1);
1460 const uint SUBTITLE_PCT = 60;
1461 const uint lSUBTITLE_MAX_LEN = 128;
1464 event.m_subtitle = QString(
"");
1471 static const QRegularExpression mcaIncompleteTitle { R
"((.*).\.\.\.$)" };
1472 auto match = mcaIncompleteTitle.match(event.
m_title);
1473 if (match.hasMatch())
1475 static const QString mcaCompleteTitlea {
"^'?(" };
1476 static const QString mcaCompleteTitleb { R
"([^\.\?]+[^\'])'?[\.\?]\s+(.+))" };
1477 static const QRegularExpression mcaCompleteTitle
1478 { mcaCompleteTitlea + match.captured(1) + mcaCompleteTitleb,
1479 QRegularExpression::CaseInsensitiveOption};
1481 if (match.hasMatch())
1483 event.m_title = match.captured(1).trimmed();
1484 event.m_description = match.captured(2).trimmed();
1489 static const QRegularExpression mcaSubtitle { R
"(^'([^\.]+)'\.\s+(.+))" };
1491 if (match.hasMatch())
1493 uint matchLen = match.capturedLength(1);
1494 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1500 if ((matchLen < lSUBTITLE_MAX_LEN) &&
1501 ((matchLen * 100 / evDescLen) < SUBTITLE_PCT))
1503 event.m_subtitle = match.captured(1);
1504 event.m_description = match.captured(2);
1509 static const QRegularExpression mcaSeries { R
"(^S?(\d+)\/E?(\d+)\s-\s(.*)$)" };
1511 if (match.hasMatch())
1513 uint season = match.capturedView(1).toUInt();
1514 uint episode = match.capturedView(2).toUInt();
1515 event.m_subtitle = match.captured(3).trimmed();
1516 event.m_syndicatedepisodenumber =
1517 QString(
"S%1E%2").arg(season).arg(episode);
1518 event.m_season = season;
1519 event.m_episode = episode;
1524 static const QRegularExpression mcaCC { R
"(,?\s(HI|English) Subtitles\.?)" };
1525 int position =
event.m_description.indexOf(mcaCC);
1528 event.m_subtitleType |= SUB_HARDHEAR;
1529 event.m_description.remove(mcaCC);
1533 static const QRegularExpression mcaDD { R
"(,?\sDD\.?)" };
1534 position = event.m_description.indexOf(mcaDD);
1535 if ((position > 0) && (position > event.
m_description.length() - 7))
1537 event.m_audioProps |= AUD_DOLBY;
1538 event.m_description.remove(mcaDD);
1542 static const QRegularExpression mcaAvail { R
"(\s(Only available on [^\.]*bouquet|Not available in RSA [^\.]*)\.?)" };
1543 event.m_description.remove(mcaAvail);
1546 bool isMovie =
false;
1547 static const QRegularExpression mcaCredits { R
"((.*)\s\((\d{4})\)\s*([^\.]+)\.?\s*$)" };
1549 if (match.hasMatch())
1552 event.m_description = match.captured(1).trimmed();
1554 uint y = match.captured(2).trimmed().toUInt(&ok);
1556 event.m_airdate = y;
1562 static const QRegularExpression mcaYear { R
"((.*)\s\((\d{4})\)\s*$)" };
1564 if (match.hasMatch())
1567 event.m_description = match.captured(1).trimmed();
1569 uint y = match.captured(2).trimmed().toUInt(&ok);
1571 event.m_airdate = y;
1577 static const QRegularExpression mcaActors { R
"((.*\.)\s+([^\.]+\s[A-Z][^\.]+)\.\s*)" };
1579 if (match.hasMatch())
1581 static const QRegularExpression mcaActorsSeparator {
"(,\\s+)" };
1582 const QStringList actors = match.captured(2).split(
1583 mcaActorsSeparator, Qt::SkipEmptyParts);
1586 for (
const auto & actor : std::as_const(actors))
1588 event.m_description = match.captured(1).trimmed();
1600 static const QRegularExpression superRTLSubtitle { R
"(^Folge\s(\d{1,3}):\s'(.*)')" };
1601 auto match = superRTLSubtitle.match(event.
m_subtitle);
1602 if (match.hasMatch())
1605 event.m_episode = match.capturedView(1).toUInt();
1606 event.m_subtitle = match.captured(2);
1614 static const QRegularExpression rtlRepeat
1615 { R
"([\s\(]?Wiederholung.+vo[m|n].+(\d{2}\.\d{2}\.\d{4}|\d{2}[:\.]\d{2}\sUhr)\)?)" };
1617 if (match.hasMatch())
1620 int pos = match.capturedStart(0);
1621 int length = match.capturedLength(0) + (pos ? 0 : 1);
1622 event.m_description =
event.m_description.remove(pos, length).trimmed();
1626 static const QRegularExpression rtlSubtitle1 { R
"(^Folge\s(\d{1,4})\s*:\s+'(.*)'(?:\s|\.\s*|$))" };
1627 static const QRegularExpression rtlSubtitle2 { R
"(^Folge\s(\d{1,4})\s+(.{0,5}[^\?!\.]{0,120})[\?!\.]\s*)" };
1628 static const QRegularExpression rtlSubtitle3 { R
"(^(?:Folge\s)?(\d{1,4}(?:\/[IVX]+)?)\s+(.{0,5}[^\?!\.]{0,120})[\?!\.]\s*)" };
1629 static const QRegularExpression rtlSubtitle4 { R
"(^Thema.{0,5}:\s([^\.]+)\.\s*)" };
1630 static const QRegularExpression rtlSubtitle5 {
"^'(.+)'\\.\\s*" };
1631 static const QRegularExpression rtlEpisodeNo1 { R
"(^(Folge\s\d{1,4})\.*\s*)" };
1632 static const QRegularExpression rtlEpisodeNo2 { R
"(^(\d{1,2}\/[IVX]+)\.*\s*)" };
1643 if (match1.hasMatch())
1645 event.m_syndicatedepisodenumber = match1.captured(1);
1646 event.m_subtitle = match1.captured(2);
1647 event.m_description =
1648 event.m_description.remove(0, match1.capturedLength());
1651 else if (match2.hasMatch())
1653 event.m_syndicatedepisodenumber = match2.captured(1);
1654 event.m_subtitle = match2.captured(2);
1655 event.m_description =
1656 event.m_description.remove(0, match2.capturedLength());
1659 else if (match3.hasMatch())
1661 event.m_syndicatedepisodenumber = match3.captured(1);
1662 event.m_subtitle = match3.captured(2);
1663 event.m_description =
1664 event.m_description.remove(0, match3.capturedLength());
1667 else if (match4.hasMatch())
1669 event.m_subtitle = match4.captured(1);
1670 event.m_description =
1671 event.m_description.remove(0, match4.capturedLength());
1674 else if (match5.hasMatch())
1676 event.m_subtitle = match5.captured(1);
1677 event.m_description =
1678 event.m_description.remove(0, match5.capturedLength());
1681 else if (match6.hasMatch())
1683 event.m_syndicatedepisodenumber = match6.captured(2);
1684 event.m_subtitle = match6.captured(1);
1685 event.m_description =
1686 event.m_description.remove(0, match6.capturedLength());
1689 else if (match7.hasMatch())
1691 event.m_syndicatedepisodenumber = match7.captured(2);
1692 event.m_subtitle = match7.captured(1);
1693 event.m_description =
1694 event.m_description.remove(0, match7.capturedLength());
1704 const uint SUBTITLE_PCT = 35;
1705 const uint lSUBTITLE_MAX_LEN = 50;
1707 static const QRegularExpression rtlSubtitle { R
"(^([^\.]{3,})\.\s+(.+))" };
1709 if (match.hasMatch())
1711 uint matchLen = match.capturedLength(1);
1712 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1718 if ((matchLen < lSUBTITLE_MAX_LEN) &&
1719 (matchLen * 100 / evDescLen < SUBTITLE_PCT))
1721 event.m_subtitle = match.captured(1);
1722 event.m_description = match.captured(2);
1740 static const QRegularExpression pro7Subtitle { R
"(,{0,1}([^,]*?),([^,]+?)\s{0,1}(\d{4})$)" };
1741 auto match = pro7Subtitle.match(event.
m_subtitle);
1742 if (match.hasMatch())
1746 event.m_airdate = match.captured(3).toUInt();
1748 event.m_subtitle.remove(match.capturedStart(0),
1749 match.capturedLength(0));
1753 static const QRegularExpression pro7Cast {
"\n\nDarsteller:\n(.*)$",
1754 QRegularExpression::DotMatchesEverythingOption };
1756 if (match.hasMatch())
1758 QStringList cast = match.captured(1).split(
"\n");
1759 for (
const auto& line : std::as_const(cast))
1761 static const QRegularExpression pro7CastOne { R
"(^([^\(]*?)\((.*)\)$)" };
1762 auto match2 = pro7CastOne.match(line);
1763 if (match2.hasMatch())
1770 event.m_description.remove(match.capturedStart(0),
1771 match.capturedLength(0));
1777 static const QRegularExpression pro7Crew {
"\n\n(Regie:.*)$",
1778 QRegularExpression::DotMatchesEverythingOption };
1780 if (match.hasMatch())
1782 QStringList crew = match.captured(1).split(
"\n");
1783 for (
const auto& line : std::as_const(crew))
1785 static const QRegularExpression pro7CrewOne { R
"(^(.*?):\s+(.*)$)" };
1786 auto match2 = pro7CrewOne.match(line);
1787 if (match2.hasMatch())
1792 QStringList names = match2.captured(2).simplified().split(R
"(\s*,\s*)");
1793 for (
const auto & name : std::as_const(names))
1798 event.AddPerson (role, name);
1802 event.m_description.remove(match.capturedStart(0),
1803 match.capturedLength(0));
1816 static const QRegularExpression deDisneyChannelSubtitle { R
"(,([^,]+?)\s{0,1}(\d{4})$)" };
1817 auto match = deDisneyChannelSubtitle.match(event.
m_subtitle);
1818 if (match.hasMatch())
1822 event.m_airdate = match.captured(3).toUInt();
1824 event.m_subtitle.remove(match.capturedStart(0),
1825 match.capturedLength(0));
1827 static const QRegularExpression
tmp { R
"(\s[^\s]+?-(Serie))" };
1829 if (match.hasMatch())
1832 event.m_category=match.captured(0).trimmed();
1833 event.m_subtitle.remove(match.capturedStart(0),
1834 match.capturedLength(0));
1843 static const QRegularExpression atvSubtitle { R
"(,{0,1}\sFolge\s(\d{1,3})$)" };
1844 event.m_subtitle.replace(atvSubtitle,
"");
1853 static const QRegularExpression fiRerun { R
"(\s?Uusinta[a-zA-Z\s]*\.?)" };
1855 if (match.hasMatch())
1857 event.m_previouslyshown =
true;
1858 event.m_description.remove(match.capturedStart(), match.capturedLength());
1861 static const QRegularExpression fiRerun2 { R
"(\([Uu]\))" };
1863 if (match.hasMatch())
1865 event.m_previouslyshown =
true;
1866 event.m_description.remove(match.capturedStart(), match.capturedLength());
1871 if (match.hasMatch())
1873 event.m_audioProps |= AUD_STEREO;
1874 event.m_description.remove(match.capturedStart(), match.capturedLength());
1878 static const QRegularExpression fiAgeLimit { R
"(\((\d{1,2}|[ST])\)$)" };
1879 match = fiAgeLimit.match(event.m_title);
1880 if (match.hasMatch())
1884 event.m_ratings.push_back(prograting);
1885 event.m_title.remove(match.capturedStart(), match.capturedLength());
1889 static const QRegularExpression fiFilm {
"^(Film|Elokuva): " };
1890 match = fiFilm.match(event.
m_title);
1891 if (match.hasMatch())
1893 event.m_category =
"Film";
1895 event.m_title.remove(match.capturedStart(), match.capturedLength());
1905 QString country =
"";
1907 static const QRegularExpression dePremiereLength { R
"(\s?[0-9]+\sMin\.)" };
1908 event.m_description =
event.m_description.replace(dePremiereLength,
"");
1910 static const QRegularExpression dePremiereAirdate { R
"(\s?([^\s^\.]+)\s((?:1|2)[0-9]{3})\.)" };
1912 if ( match.hasMatch())
1914 country = match.captured(1).trimmed();
1916 uint y = match.captured(2).toUInt(&ok);
1918 event.m_airdate = y;
1919 event.m_description.remove(match.capturedStart(0),
1920 match.capturedLength(0));
1923 static const QRegularExpression dePremiereCredits { R
"(\sVon\s([^,]+)(?:,|\su\.\sa\.)\smit\s([^\.]*)\.)" };
1925 if (match.hasMatch())
1928 const QStringList actors = match.captured(2).split(
1929 ", ", Qt::SkipEmptyParts);
1932 for (
const auto & actor : std::as_const(actors))
1934 event.m_description.remove(match.capturedStart(0),
1935 match.capturedLength(0));
1938 event.m_description =
event.m_description.replace(
"\u000A$",
"");
1939 event.m_description =
event.m_description.replace(
"\u000A",
" ");
1942 static const QRegularExpression dePremiereOTitle { R
"(\s*\(([^\)]*)\)$)" };
1943 match = dePremiereOTitle.match(event.m_title);
1944 if (match.hasMatch())
1946 event.m_subtitle = QString(
"%1, %2").arg(match.captured(1), country);
1947 event.m_title.remove(match.capturedStart(0),
1948 match.capturedLength(0));
1952 static const QRegularExpression deSkyDescriptionSeasonEpisode { R
"(^(\d{1,2}).\sStaffel,\sFolge\s(\d{1,2}):\s)" };
1953 match = deSkyDescriptionSeasonEpisode.match(event.m_description);
1954 if (match.hasMatch())
1956 event.m_season = match.captured(1).trimmed().toUInt();
1957 event.m_episode = match.captured(2).trimmed().toUInt();
1958 event.m_description.remove(match.capturedStart(0),
1959 match.capturedLength(0));
1980 {
"Movie - Soap/melodrama/folkloric",
1995 QString fullinfo =
event.m_subtitle +
event.m_description;
1996 event.m_subtitle =
"";
2004 event.m_category = name;
2005 event.m_categoryType =
type;
2013 auto match =
kStereo.match(fullinfo);
2014 if (match.hasMatch())
2016 event.m_audioProps |= AUD_STEREO;
2017 fullinfo.remove(match.capturedStart(), match.capturedLength());
2021 static const QRegularExpression nlWide {
"breedbeeld" };
2022 match = nlWide.match(fullinfo);
2023 if (match.hasMatch())
2025 event.m_videoProps |= VID_WIDESCREEN;
2026 fullinfo = fullinfo.replace(
"breedbeeld",
".");
2030 static const QRegularExpression nlRepeat {
"herh." };
2031 match = nlRepeat.match(fullinfo);
2032 if (match.hasMatch())
2033 fullinfo = fullinfo.replace(
"herh.",
".");
2036 static const QRegularExpression nlTxt {
"txt" };
2037 match = nlTxt.match(fullinfo);
2038 if (match.hasMatch())
2040 event.m_subtitleType |= SUB_NORMAL;
2041 fullinfo = fullinfo.replace(
"txt",
".");
2045 static const QRegularExpression nlHD { R
"(\sHD$)" };
2046 match = nlHD.match(event.m_title);
2047 if (match.hasMatch())
2049 event.m_videoProps |= VID_HDTV;
2050 event.m_title.remove(match.capturedStart(), match.capturedLength());
2054 static const QRegularExpression nlSub { R
"(\sAfl\.:\s([^\.]+)\.)" };
2055 match = nlSub.match(fullinfo);
2056 if (match.hasMatch())
2058 QString tmpSubString = match.captured(0);
2059 tmpSubString = tmpSubString.right(match.capturedLength() - 7);
2060 event.m_subtitle = tmpSubString.left(tmpSubString.length() -1);
2061 fullinfo.remove(match.capturedStart(), match.capturedLength());
2065 static const QRegularExpression nlSub2 { R
"(\s\"([^\"]+)\")" };
2066 match = nlSub2.match(fullinfo);
2067 if (match.hasMatch())
2069 QString tmpSubString = match.captured(0);
2070 tmpSubString = tmpSubString.right(match.capturedLength() - 2);
2071 event.m_subtitle = tmpSubString.left(tmpSubString.length() -1);
2072 fullinfo.remove(match.capturedStart(), match.capturedLength());
2078 int position =
event.m_title.indexOf(
":");
2079 if ((position != -1) &&
2080 (event.
m_title[position + 1].toUpper() == event.
m_title[position + 1]) &&
2083 event.m_subtitle =
event.m_title.mid(position + 1);
2084 event.m_title =
event.m_title.left(position);
2089 static const QRegularExpression nlActors { R
"(\sMet:\s.+e\.a\.)" };
2090 static const QRegularExpression nlPersSeparator { R
"((, |\sen\s))" };
2091 match = nlActors.match(fullinfo);
2092 if (match.hasMatch())
2094 QString tmpActorsString = match.captured(0);
2095 tmpActorsString = tmpActorsString.right(tmpActorsString.length() - 6);
2096 tmpActorsString = tmpActorsString.left(tmpActorsString.length() - 5);
2097 const QStringList actors =
2098 tmpActorsString.split(nlPersSeparator, Qt::SkipEmptyParts);
2101 for (
const auto & actor : std::as_const(actors))
2103 fullinfo.remove(match.capturedStart(), match.capturedLength());
2107 static const QRegularExpression nlPres { R
"(\sPresentatie:\s([^\.]+)\.)" };
2108 match = nlPres.match(fullinfo);
2109 if (match.hasMatch())
2111 QString tmpPresString = match.captured(0);
2112 tmpPresString = tmpPresString.right(tmpPresString.length() - 14);
2113 tmpPresString = tmpPresString.left(tmpPresString.length() -1);
2114 const QStringList presenters =
2115 tmpPresString.split(nlPersSeparator, Qt::SkipEmptyParts);
2116 for (
const auto & presenter : std::as_const(presenters))
2118 fullinfo.remove(match.capturedStart(), match.capturedLength());
2122 static const QRegularExpression nlYear1 { R
"(\suit\s([1-2][0-9]{3}))" };
2123 static const QRegularExpression nlYear2 { R
"((\s\([A-Z]{0,3}/?)([1-2][0-9]{3})\))",
2124 QRegularExpression::CaseInsensitiveOption };
2125 match = nlYear1.match(fullinfo);
2126 if (match.hasMatch())
2129 uint y = match.capturedView(1).toUInt(&ok);
2131 event.m_originalairdate = QDate(y, 1, 1);
2134 match = nlYear2.match(fullinfo);
2135 if (match.hasMatch())
2138 uint y = match.capturedView(2).toUInt(&ok);
2140 event.m_originalairdate = QDate(y, 1, 1);
2144 static const QRegularExpression nlDirector { R
"(\svan\s(([A-Z][a-z]+\s)|([A-Z]\.\s)))" };
2145 match = nlDirector.match(fullinfo);
2146 if (match.hasMatch())
2150 static const QRegularExpression nlRub { R
"(\s?\(\W+\)\s?)" };
2151 fullinfo.remove(nlRub);
2154 static const QRegularExpression nlCat {
"^(Amusement|Muziek|Informatief|Nieuws/actualiteiten|Jeugd|Animatie|Sport|Serie/soap|Kunst/Cultuur|Documentaire|Film|Natuur|Erotiek|Comedy|Misdaad|Religieus)\\.\\s" };
2155 fullinfo.remove(nlCat);
2158 static const QRegularExpression nlOmroep { R
"(\s\(([A-Z]+/?)+\)$)" };
2159 event.m_title.remove(nlOmroep);
2163 event.m_description = fullinfo;
2183 static const QRegularExpression noRerun {
"\\(R\\)" };
2184 auto match = noRerun.match(event.
m_title);
2185 if (match.hasMatch())
2187 event.m_previouslyshown =
true;
2188 event.m_title.remove(match.capturedStart(), match.capturedLength());
2191 static const QRegularExpression noHD { R
"([\(\[]HD[\)\]])" };
2193 if (match.hasMatch())
2195 event.m_videoProps |= VID_HDTV;
2196 event.m_subtitle.remove(match.capturedStart(), match.capturedLength());
2200 if (match.hasMatch())
2202 event.m_videoProps |= VID_HDTV;
2203 event.m_description.remove(match.capturedStart(), match.capturedLength());
2213 static const QRegularExpression noRerun {
"\\(R\\)" };
2214 auto match = noRerun.match(event.
m_title);
2215 if (match.hasMatch())
2217 event.m_previouslyshown =
true;
2218 event.m_title.remove(match.capturedStart(), match.capturedLength());
2222 if (match.hasMatch())
2224 event.m_previouslyshown =
true;
2229 static const QRegularExpression noNRKCategories
2230 {
"^(Superstrek[ea]r|Supersomm[ea]r|Superjul|Barne-tv|Fantorangen|Kuraffen|Supermorg[eo]n|Julemorg[eo]n|Sommermorg[eo]n|"
2231 "Kuraffen-TV|Sport i dag|NRKs sportsl.rdag|NRKs sportss.ndag|Dagens dokumentar|"
2232 "NRK2s historiekveld|Detektimen|Nattkino|Filmklassiker|Film|Kortfilm|P.skemorg[eo]n|"
2233 "Radioteatret|Opera|P2-Akademiet|Nyhetsmorg[eo]n i P2 og Alltid Nyheter:): (.+)" };
2234 match = noNRKCategories.match(event.
m_title);
2235 if (match.hasMatch() && (match.capturedLength(2) > 1))
2237 event.m_title = match.captured(2);
2238 event.m_description =
"(" + match.captured(1) +
") " +
event.m_description;
2242 static const QRegularExpression noPremiere {
"\\s+-\\s+(Sesongpremiere|Premiere|premiere)!?$" };
2243 match = noPremiere.match(event.
m_title);
2244 if (match.hasMatch() && (match.capturedStart() >= 3))
2245 event.m_title.remove(match.capturedStart(), match.capturedLength());
2248 if (!event.
m_title.startsWith(
"CSI:") &&
2249 !event.
m_title.startsWith(
"CD:") &&
2250 !event.
m_title.startsWith(
"Distriktsnyheter: fra"))
2252 static const QRegularExpression noColonSubtitle {
"^([^:]+): (.+)" };
2253 match = noColonSubtitle.match(event.
m_title);
2254 if (match.hasMatch())
2258 event.m_title = match.captured(1);
2259 event.m_subtitle = match.captured(2);
2261 else if (event.
m_subtitle == match.captured(2))
2263 event.m_title = match.captured(1);
2281 static const QRegularExpression dkEpisode { R
"(\(([0-9]+)\))" };
2282 auto match = dkEpisode.match(event.
m_title);
2283 if (match.hasMatch())
2285 episode = match.capturedView(1).toInt();
2286 event.m_partnumber = match.capturedView(1).toInt();
2287 event.m_title.remove(match.capturedStart(), match.capturedLength());
2290 static const QRegularExpression dkPart { R
"(\(([0-9]+):([0-9]+)\))" };
2291 match = dkPart.match(event.m_title);
2292 if (match.hasMatch())
2294 episode = match.capturedView(1).toInt();
2295 event.m_partnumber = match.capturedView(1).toInt();
2296 event.m_parttotal = match.capturedView(2).toInt();
2297 event.m_title.remove(match.capturedStart(), match.capturedLength());
2301 static const QRegularExpression dkSubtitle1 {
"^([^:]+): (.+)" };
2302 match = dkSubtitle1.match(event.
m_title);
2303 if (match.hasMatch())
2305 event.m_title = match.captured(1);
2306 event.m_subtitle = match.captured(2);
2310 static const QRegularExpression dkSubtitle2 {
"^([^:]+) - (.+)" };
2311 match = dkSubtitle2.match(event.
m_title);
2312 if (match.hasMatch())
2314 event.m_title = match.captured(1);
2315 event.m_subtitle = match.captured(2);
2322 static const QRegularExpression dkSeason1 {
"Sæson ([0-9]+)\\." };
2324 if (match.hasMatch())
2326 season = match.capturedView(1).toInt();
2330 static const QRegularExpression dkSeason2 {
"- år ([0-9]+) :" };
2332 if (match.hasMatch())
2334 season = match.capturedView(1).toInt();
2339 event.m_episode = episode;
2342 event.m_season = season;
2345 static const QRegularExpression dkFeatures {
"Features:(.+)" };
2347 if (match.hasMatch())
2349 QString features = match.captured(1);
2350 event.m_description.remove(match.capturedStart(),
2351 match.capturedLength());
2353 static const QRegularExpression dkWidescreen {
" 16:9" };
2354 if (features.indexOf(dkWidescreen) != -1)
2355 event.m_videoProps |= VID_WIDESCREEN;
2357 static const QRegularExpression dkHD {
" HD" };
2358 if (features.indexOf(dkHD) != -1)
2359 event.m_videoProps |= VID_HDTV;
2361 static const QRegularExpression dkDolby {
" 5:1" };
2362 if (features.indexOf(dkDolby) != -1)
2363 event.m_audioProps |= AUD_DOLBY;
2365 static const QRegularExpression dkSurround { R
"( \(\(S\)\))" };
2366 if (features.indexOf(dkSurround) != -1)
2367 event.m_audioProps |= AUD_SURROUND;
2369 static const QRegularExpression dkStereo {
" S" };
2370 if (features.indexOf(dkStereo) != -1)
2371 event.m_audioProps |= AUD_STEREO;
2373 static const QRegularExpression dkReplay {
" \\(G\\)" };
2374 if (features.indexOf(dkReplay) != -1)
2375 event.m_previouslyshown =
true;
2377 static const QRegularExpression dkTxt {
" TTV" };
2378 if (features.indexOf(dkTxt) != -1)
2379 event.m_subtitleType |= SUB_NORMAL;
2392 newid = QString(
"%1%2").arg(event.
m_chanid).
2397 newid =
event.m_seriesId.mid(2,8);
2399 event.m_seriesId = newid;
2403 event.m_programId[0]=
'_';
2408 event.m_subtitle = QString(
"%1 (%2").arg(event.
m_subtitle).arg(episode);
2410 event.m_subtitle = QString(
"%1:%2").arg(event.
m_subtitle).
2414 event.m_season = season;
2415 event.m_episode = episode;
2416 event.m_syndicatedepisodenumber =
2417 QString(
"S%1E%2").arg(season).arg(episode);
2418 event.m_subtitle = QString(
"%1 Sæson %2").arg(event.
m_subtitle).
2421 event.m_subtitle = QString(
"%1)").arg(event.
m_subtitle);
2425 static const QRegularExpression dkDirector {
"(?:Instr.: |Instrukt.r: )(.+)$" };
2426 static const QRegularExpression dkPersonsSeparator {
"(, )|(og )" };
2427 QStringList directors {};
2429 if (match.hasMatch())
2431 QString tmpDirectorsString = match.captured(1);
2432 directors = tmpDirectorsString.split(dkPersonsSeparator, Qt::SkipEmptyParts);
2433 for (
const auto & director : std::as_const(directors))
2435 tmpDirectorsString = director.split(
":").last().trimmed().
2437 if (tmpDirectorsString !=
"")
2443 static const QRegularExpression dkActors {
"(?:Medvirkende: |Medv\\.: )(.+)" };
2445 if (match.hasMatch())
2447 QString tmpActorsString = match.captured(1);
2448 const QStringList actors =
2449 tmpActorsString.split(dkPersonsSeparator, Qt::SkipEmptyParts);
2450 for (
const auto & actor : std::as_const(actors))
2452 tmpActorsString = actor.split(
":").last().trimmed().remove(
kDotAtEnd);
2453 if (!tmpActorsString.isEmpty() && !directors.contains(tmpActorsString))
2460 static const QRegularExpression dkYear {
" fra ([0-9]{4})[ \\.]" };
2462 if (match.hasMatch())
2465 uint y = match.capturedView(1).toUInt(&ok);
2467 event.m_originalairdate = QDate(y, 1, 1);
2476 LOG(VB_EIT, LOG_INFO, QString(
"Applying html strip to %1").arg(event.
m_title));
2477 static const QRegularExpression html {
"</?EM>", QRegularExpression::CaseInsensitiveOption };
2478 event.m_title.remove(html);
2489 event.m_description = QString(
"");
2493 if (event.
m_subtitle.trimmed().right(1) !=
".'" )
2494 event.m_subtitle =
event.m_subtitle.trimmed() +
".";
2495 event.m_description =
event.m_subtitle.trimmed() + QString(
" ") +
event.m_description;
2496 event.m_subtitle = QString(
"");
2503 static const QRegularExpression grRating { R
"(\[(K|Κ|8|12|16|18)\]\s*)",
2504 QRegularExpression::CaseInsensitiveOption };
2505 auto match = grRating.match(event.
m_title);
2506 if (match.hasMatch())
2510 event.m_ratings.push_back(prograting);
2511 event.m_title.remove(match.capturedStart(), match.capturedLength());
2512 event.m_title =
event.m_title.trimmed();
2516 int position =
event.m_title.indexOf(
"(Ζ)");
2519 event.m_title =
event.m_title.replace(
"(Ζ)",
"");
2520 event.m_description.prepend(
"Ζωντανή Μετάδοση. ");
2524 static const QRegularExpression grNotPreviouslyShown {
2525 R
"(\W?(?:-\s*)*(?:\b[Α1]['΄η]?\s*(?:τηλεοπτικ[ηή]\s*)?(?:μετ[αά]δοση|προβολ[ηή]))\W?)",
2526 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2527 match = grNotPreviouslyShown.match(event.m_title);
2528 if (match.hasMatch())
2530 event.m_previouslyshown =
false;
2531 event.m_title.remove(match.capturedStart(), match.capturedLength());
2537 static const QRegularExpression grReplay { R
"(\([ΕE]\))" };
2538 match = grReplay.match(event.m_title);
2539 if (match.hasMatch())
2541 event.m_previouslyshown =
true;
2542 event.m_title.remove(match.capturedStart(), match.capturedLength());
2546 position =
event.m_description.indexOf(
"(HD)");
2549 event.m_description =
event.m_description.replace(
"(HD)",
"");
2550 event.m_videoProps |= VID_HDTV;
2554 position =
event.m_description.indexOf(
"(Full HD)");
2557 event.m_description =
event.m_description.replace(
"(Full HD)",
"");
2558 event.m_videoProps |= VID_HDTV;
2561 static const QRegularExpression grFixnofullstopActors { R
"(\w\s(Παίζουν:|Πρωταγων))" };
2563 if (match.hasMatch())
2564 event.m_description.insert(match.capturedStart() + 1,
".");
2567 static const QRegularExpression grFixnofullstopDirectors { R
"(\w\s(Σκηνοθ[εέ]))" };
2568 match = grFixnofullstopDirectors.match(event.m_description);
2569 if (match.hasMatch())
2570 event.m_description.insert(match.capturedStart() + 1,
".");
2578 static const QRegularExpression grActors { R
"((?:[Ππ]α[ιί]ζουν:|[ΜMμ]ε τους:|Πρωταγωνιστο[υύ]ν:|Πρωταγωνιστε[ιί]:?)(?:\s+στο ρόλο(?: του| της)?\s(?:\w+\s[οη]\s))?([-\w\s']+(?:,[-\w\s']+)*)(?:κ\.[αά])?\W?)" };
2580 static const QRegularExpression grPeopleSeparator { R
"(([,-]\s+))" };
2582 if (match.hasMatch())
2584 QString tmpActorsString = match.captured(1);
2585 const QStringList actors =
2586 tmpActorsString.split(grPeopleSeparator, Qt::SkipEmptyParts);
2587 for (
const auto & actor : std::as_const(actors))
2589 tmpActorsString = actor.split(
":").last().trimmed().remove(
kDotAtEnd);
2590 if (tmpActorsString !=
"")
2593 event.m_description.remove(match.capturedStart(), match.capturedLength());
2597 static const QRegularExpression grDirector { R
"((?:Σκηνοθεσία: |Σκηνοθέτης: |Σκηνοθέτης - Επιμέλεια: )(\w+\s\w+\s?)(?:\W?))" };
2599 if (match.hasMatch())
2601 QString tmpDirectorsString = match.captured(1);
2602 const QStringList directors =
2603 tmpDirectorsString.split(grPeopleSeparator, Qt::SkipEmptyParts);
2604 for (
const auto & director : std::as_const(directors))
2606 tmpDirectorsString = director.split(
":").last().trimmed().
2608 if (tmpDirectorsString !=
"")
2613 event.m_description.remove(match.capturedStart(), match.capturedLength());
2617 static const QRegularExpression grPres { R
"((?:Παρουσ[ιί]αση:(?:\b)*|Παρουσι[αά]ζ(?:ουν|ει)(?::|\sο|\sη)|Παρουσι[αά]στ(?:[ηή]ς|ρια|ριες|[εέ]ς)(?::|\sο|\sη)|Με τ(?:ον |ην )(?:[\s|:|ο|η])*(?:\b)*)([-\w\s]+(?:,[-\w\s]+)*)\W?)",
2618 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2620 if (match.hasMatch())
2622 QString tmpPresentersString = match.captured(1);
2623 const QStringList presenters =
2624 tmpPresentersString.split(grPeopleSeparator, Qt::SkipEmptyParts);
2625 for (
const auto & presenter : std::as_const(presenters))
2627 tmpPresentersString = presenter.split(
":").last().trimmed().
2629 if (tmpPresentersString !=
"")
2634 event.m_description.remove(match.capturedStart(), match.capturedLength());
2639 static const QRegularExpression grYear { R
"(\W?(?:\s?παραγωγ[ηή]ς|\s?-|,)\s*([1-2][0-9]{3})(?:-\d{1,4})?)",
2640 QRegularExpression::CaseInsensitiveOption };
2642 if (match.hasMatch())
2645 uint y = match.capturedView(1).toUInt(&ok);
2648 event.m_originalairdate = QDate(y, 1, 1);
2649 event.m_description.remove(match.capturedStart(), match.capturedLength());
2653 event.m_description =
event.m_description.replace(
" .",
".").trimmed();
2656 static const QRegularExpression grCountry {
2657 R
"((?:\W|\b)(?:(ελλην|τουρκ|αμερικ[αά]ν|γαλλ|αγγλ|βρεττ?αν|γερμαν|ρωσσ?|ιταλ|ελβετ|σουηδ|ισπαν|πορτογαλ|μεξικ[αά]ν|κιν[εέ]ζικ|ιαπων|καναδ|βραζιλι[αά]ν)(ικ[ηή][ςσ])))",
2658 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2660 if (match.hasMatch())
2661 event.m_description.remove(match.capturedStart(), match.capturedLength());
2665 bool series =
false;
2666 static const QRegularExpression grSeason {
2667 R
"((?:\W-?)*(?:\(-\s*)?\b(([Α-Ω|A|B|E|Z|H|I|K|M|N]{1,2})(?:'|΄)?|(\d{1,2})(?:ος|ου|oς|os)?)(?:\s*[ΚκKk][υύ]κλο(?:[σς]|υ))\s?)",
2668 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2671 match = grSeason.match(event.
m_title);
2672 if (match.hasMatch())
2674 if (!match.capturedView(2).isEmpty())
2678 int tmpinteger = match.capturedView(2).toUInt();
2681 if (match.captured(2) ==
"ΣΤ")
2685 static const QString LettToNumber =
"0ΑΒΓΔΕ6ΖΗΘΙΚΛΜΝ";
2686 tmpinteger = LettToNumber.indexOf(match.capturedView(2));
2687 if (tmpinteger != -1)
2688 event.m_season = tmpinteger;
2692 static const QString LettToNumber2 =
"0ABΓΔE6ZHΘIKΛMN";
2693 tmpinteger = LettToNumber2.indexOf(match.capturedView(2));
2694 if (tmpinteger != -1)
2695 event.m_season = tmpinteger;
2700 else if (!match.capturedView(3).isEmpty())
2702 event.m_season = match.capturedView(3).toUInt();
2705 event.m_title.remove(match.capturedStart(), match.capturedLength());
2710 if (match.hasMatch())
2712 if (!match.capturedView(2).isEmpty())
2716 int tmpinteger = match.capturedView(2).toUInt();
2719 if (match.captured(2) ==
"ΣΤ")
2723 static const QString LettToNumber =
"0ΑΒΓΔΕ6ΖΗΘΙΚΛΜΝ";
2724 tmpinteger = LettToNumber.indexOf(match.capturedView(2));
2725 if (tmpinteger != -1)
2726 event.m_season = tmpinteger;
2730 else if (!match.capturedView(3).isEmpty())
2732 event.m_season = match.capturedView(3).toUInt();
2735 event.m_description.remove(match.capturedStart(), match.capturedLength());
2740 static const QRegularExpression grSeasonAsRomanNumerals {
",\\s*([MDCLXVIΙΧ]+)$",
2741 QRegularExpression::CaseInsensitiveOption };
2742 match = grSeasonAsRomanNumerals.match(event.
m_title);
2743 auto match2 = grSeasonAsRomanNumerals.match(event.
m_description);
2744 if (match.hasMatch())
2746 if (!match.capturedView(1).isEmpty())
2747 event.m_season =
parseRoman(match.captured(1).toUpper());
2749 event.m_title.remove(match.capturedStart(), match.capturedLength());
2750 event.m_title =
event.m_title.trimmed();
2751 if (event.
m_title.right(1) ==
",")
2752 event.m_title.chop(1);
2754 else if (match2.hasMatch())
2756 if (!match2.capturedView(1).isEmpty())
2757 event.m_season =
parseRoman(match2.captured(1).toUpper());
2759 event.m_description.remove(match2.capturedStart(), match2.capturedLength());
2760 event.m_description =
event.m_description.trimmed();
2762 event.m_description.chop(1);
2765 static const QRegularExpression grlongEp { R
"(\b(?:Επ.|επεισ[οό]διο:?)\s*(\d+)\W?)",
2766 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2768 match = grlongEp.match(event.
m_title);
2770 if (match.hasMatch() || match2.hasMatch())
2772 if (!match.capturedView(1).isEmpty())
2774 event.m_episode = match.capturedView(1).toUInt();
2776 event.m_title.remove(match.capturedStart(), match.capturedLength());
2778 else if (!match2.capturedView(1).isEmpty())
2780 event.m_episode = match2.capturedView(1).toUInt();
2782 event.m_description.remove(match2.capturedStart(), match2.capturedLength());
2793 static const QRegularExpression grCommentsinTitle { R
"(\(([Α-Ωα-ω\s\d-]+)\)(?:\s*$)*)" };
2796 match = grCommentsinTitle.match(event.
m_title);
2797 if (match.hasMatch())
2798 event.m_title.remove(match.capturedStart(), match.capturedLength());
2806 static const QRegularExpression grRealTitleInDescription { R
"(^\(([A-Za-z\s\d-]+)\)\s*)" };
2809 match = grRealTitleInDescription.match(event.
m_description);
2810 if (match.hasMatch())
2812 event.m_description.remove(0, match.capturedLength());
2813 if (match.captured(0) != event.
m_title.trimmed())
2815 event.m_description =
"(" +
event.m_title.trimmed() +
"). " +
event.m_description;
2817 event.m_title = match.captured(1);
2822 static const QRegularExpression grRealTitleInTitle { R
"(\(([A-Za-z\s\d-]+)\)(?:\s*$)?)" };
2825 match = grRealTitleInTitle.match(event.
m_title);
2826 if (match.hasMatch())
2828 event.m_title.remove(match.capturedStart(), match.capturedLength());
2829 QString tmpTranslTitle =
event.m_title;
2831 event.m_title = match.captured(1);
2832 event.m_description =
"(" + tmpTranslTitle.trimmed() +
"). " +
event.m_description;
2837 static const QRegularExpression grEpisodeAsSubtitle { R
"(^Επεισ[οό]διο:\s?([\w\s\-,']+)\.\s?)" };
2839 if (match.hasMatch())
2841 event.m_subtitle = match.captured(1).trimmed();
2842 event.m_description.remove(match.capturedStart(), match.capturedLength());
2844 static const QRegularExpression grMovie { R
"(\bταιν[ιί]α\b)",
2845 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2846 bool isMovie = (
event.m_description.indexOf(grMovie) !=-1) ;
2852 event.m_description.replace(
",,",
",");
2859 struct grCategoryEntry {
2860 QRegularExpression expr;
2863 static const QRegularExpression grCategFood {
"\\W?(?:εκπομπ[ηή]\\W)?(Γαστρονομ[ιί]α[σς]?|μαγειρικ[ηή][σς]?|chef|συνταγ[εέηή]|διατροφ|wine|μ[αά]γειρα[σς]?)\\W?",
2864 QRegularExpression::CaseInsensitiveOption };
2865 static const QRegularExpression grCategDrama {
"\\W?(κοινωνικ[ηήό]|δραματικ[ηή]|δρ[αά]μα)\\W(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2866 QRegularExpression::CaseInsensitiveOption};
2867 static const QRegularExpression grCategComedy {
"\\W?(κωμικ[ηήοό]|χιουμοριστικ[ηήοό]|κωμωδ[ιί]α)\\W(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2868 QRegularExpression::CaseInsensitiveOption};
2869 static const QRegularExpression grCategChildren {
"\\W?(παιδικ[ηήοό]|κινο[υύ]μ[εέ]ν(ων|α)\\sσχ[εέ]δ[ιί](ων|α))\\W(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2870 QRegularExpression::CaseInsensitiveOption};
2871 static const QRegularExpression grCategMystery {
"(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?\\W?(μυστηρ[ιί]ου)\\W?",
2872 QRegularExpression::CaseInsensitiveOption};
2873 static const QRegularExpression grCategFantasy {
"(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?\\W?(φαντασ[ιί]ας)\\W?",
2874 QRegularExpression::CaseInsensitiveOption};
2875 static const QRegularExpression grCategHistory {
"\\W?(ιστορικ[ηήοό])\\W?(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2876 QRegularExpression::CaseInsensitiveOption};
2877 static const QRegularExpression grCategTeleMag {
"\\W?(ενημερωτικ[ηή]|ψυχαγωγικ[ηή]|τηλεπεριοδικ[οό]|μαγκαζ[ιί]νο)\\W?(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2878 QRegularExpression::CaseInsensitiveOption};
2879 static const QRegularExpression grCategTeleShop {
"\\W?(οδηγ[οό][σς]?\\sαγορ[ωώ]ν|τηλεπ[ωώ]λ[ηή]σ|τηλεαγορ|τηλεμ[αά]ρκετ|telemarket)\\W?(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2880 QRegularExpression::CaseInsensitiveOption};
2881 static const QRegularExpression grCategGameShow {
"\\W?(τηλεπαιχν[ιί]δι|quiz)\\W?",
2882 QRegularExpression::CaseInsensitiveOption};
2883 static const QRegularExpression grCategDocumentary {
"\\W?(ντοκ[ιυ]μαντ[εέ]ρ)\\W?",
2884 QRegularExpression::CaseInsensitiveOption};
2885 static const QRegularExpression grCategBiography {
"\\W?(βιογραφ[ιί]α|βιογραφικ[οό][σς]?)\\W?",
2886 QRegularExpression::CaseInsensitiveOption};
2887 static const QRegularExpression grCategNews {
"\\W?(δελτ[ιί]ο\\W?|ειδ[ηή]σε(ι[σς]|ων))\\W?",
2888 QRegularExpression::CaseInsensitiveOption};
2889 static const QRegularExpression grCategSports {
"\\W?(champion|αθλητικ[αάοόηή]|πρωτ[αά]θλημα|ποδ[οό]σφαιρο(ου)?|κολ[υύ]μβηση|πατιν[αά]ζ|formula|μπ[αά]σκετ|β[οό]λε[ιϊ])\\W?",
2890 QRegularExpression::CaseInsensitiveOption};
2891 static const QRegularExpression grCategMusic {
"\\W?(μουσικ[οόηή]|eurovision|τραγο[υύ]δι)\\W?",
2892 QRegularExpression::CaseInsensitiveOption};
2893 static const QRegularExpression grCategReality {
"\\W?(ρι[αά]λιτι|reality)\\W?",
2894 QRegularExpression::CaseInsensitiveOption};
2895 static const QRegularExpression grCategReligion {
"\\W?(θρησκε[ιί]α|θρησκευτικ|να[οό][σς]?|θε[ιί]α λειτουργ[ιί]α)\\W?",
2896 QRegularExpression::CaseInsensitiveOption};
2897 static const QRegularExpression grCategCulture {
"\\W?(τ[εέ]χν(η|ε[σς])|πολιτισμ)\\W?",
2898 QRegularExpression::CaseInsensitiveOption};
2899 static const QRegularExpression grCategNature {
"\\W?(φ[υύ]ση|περιβ[αά]λλο|κατασκευ|επιστ[ηή]μ(?!ονικ[ηή]ς φαντασ[ιί]ας))\\W?",
2900 QRegularExpression::CaseInsensitiveOption};
2901 static const QRegularExpression grCategSciFi {
"\\W?(επιστ(.|ημονικ[ηή]ς)\\s?φαντασ[ιί]ας)\\W?",
2902 QRegularExpression::CaseInsensitiveOption};
2903 static const QRegularExpression grCategHealth {
"\\W?(υγε[ιί]α|υγειιν|ιατρικ|διατροφ)\\W?",
2904 QRegularExpression::CaseInsensitiveOption};
2905 static const QRegularExpression grCategSpecial {
"\\W?(αφι[εέ]ρωμα)\\W?",
2906 QRegularExpression::CaseInsensitiveOption};
2907 static const QList<grCategoryEntry> grCategoryDescData = {
2908 { grCategComedy,
"Κωμωδία" },
2909 { grCategTeleMag,
"Τηλεπεριοδικό" },
2910 { grCategNature,
"Επιστήμη/Φύση" },
2911 { grCategHealth,
"Υγεία" },
2912 { grCategReality,
"Ριάλιτι" },
2913 { grCategDrama,
"Κοινωνικό" },
2914 { grCategChildren,
"Παιδικό" },
2915 { grCategSciFi,
"Επιστ.Φαντασίας" },
2916 { grCategMystery,
"Μυστηρίου" },
2917 { grCategFantasy,
"Φαντασίας" },
2918 { grCategHistory,
"Ιστορικό" },
2919 { grCategTeleShop,
"Τηλεπωλήσεις" },
2920 { grCategFood,
"Γαστρονομία" },
2921 { grCategGameShow,
"Τηλεπαιχνίδι" },
2922 { grCategBiography,
"Βιογραφία" },
2923 { grCategSports,
"Αθλητικά" },
2924 { grCategMusic,
"Μουσική" },
2925 { grCategDocumentary,
"Ντοκιμαντέρ" },
2926 { grCategReligion,
"Θρησκεία" },
2927 { grCategCulture,
"Τέχνες/Πολιτισμός" },
2928 { grCategSpecial,
"Αφιέρωμα" },
2930 static const QList<grCategoryEntry> grCategoryTitleData = {
2931 { grCategTeleShop,
"Τηλεπωλήσεις" },
2932 { grCategGameShow,
"Τηλεπαιχνίδι" },
2933 { grCategMusic,
"Μουσική" },
2934 { grCategNews,
"Ειδήσεις" },
2941 event.m_category =
"Φαντασίας/Μυστηρίου";
2946 for (
const auto& [expression, category] : grCategoryDescData)
2949 event.m_category = category;
2955 for (
const auto& [expression, category] : grCategoryTitleData)
2957 if (event.
m_title.indexOf(expression) != -1) {
2958 event.m_category = category;
2972 event.m_subtitle =
"";
2977 auto i =
event.m_items.begin();
2978 while (i != event.
m_items.end())
2982 if ((QString::compare (i.key(),
"Role Player") == 0) ||
2983 (QString::compare (i.key(),
"Performing Artist") == 0))
2986 i =
event.m_items.erase (i);
2988 else if (QString::compare (i.key(),
"Director") == 0)
2991 i =
event.m_items.erase (i);
2993 else if (QString::compare (i.key(),
"Commentary or Commentator") == 0)
2996 i =
event.m_items.erase (i);
2998 else if (QString::compare (i.key(),
"Presenter") == 0)
3001 i =
event.m_items.erase (i);
3003 else if (QString::compare (i.key(),
"Producer") == 0)
3006 i =
event.m_items.erase (i);
3008 else if (QString::compare (i.key(),
"Scriptwriter") == 0)
3011 i =
event.m_items.erase (i);
3020 static const QRegularExpression unitymediaImdbrating { R
"(\s*IMDb Rating: (\d\.\d)\s?/10$)" };
3021 auto match = unitymediaImdbrating.match(event.
m_description);
3022 if (match.hasMatch())
3024 float stars = match.captured(1).toFloat();
3025 event.m_stars = stars / 10.0F;
3026 event.m_description.remove(match.capturedStart(0),
3027 match.capturedLength(0));