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 #if QT_VERSION < QT_VERSION_CHECK(6,5,0)
1188 auto dmatch = comHemDirector.match(pmatch.capturedView(1));
1189 auto amatch = comHemActor.match(pmatch.capturedView(1));
1190 auto hmatch = comHemHost.match(pmatch.capturedView(1));
1192 auto dmatch = comHemDirector.matchView(pmatch.capturedView(1));
1193 auto amatch = comHemActor.matchView(pmatch.capturedView(1));
1194 auto hmatch = comHemHost.matchView(pmatch.capturedView(1));
1196 if (dmatch.hasMatch())
1198 else if (amatch.hasMatch())
1200 else if (hmatch.hasMatch())
1204 event.m_description.remove(pmatch.capturedStart(), pmatch.capturedLength());
1208 const QStringList actors =
1209 pmatch.captured(2).split(comHemPersSeparator, Qt::SkipEmptyParts);
1212 for (
const auto & actor : std::as_const(actors))
1213 event.AddPerson(role, actor);
1216 event.m_description=
event.m_description.replace(pmatch.captured(0),
"");
1223 if (process_subtitle)
1225 static const QRegularExpression comHemSub { R
"([.\?\!] )" };
1226 int pos2 =
event.m_description.indexOf(comHemSub);
1227 bool pvalid = pos2 != -1 && pos2 <= 55;
1228 if (pvalid && (event.
m_description.length() - (pos2 + 2)) > 0)
1230 event.m_subtitle =
event.m_description.left(
1232 event.m_description =
event.m_description.mid(pos2 + 2);
1237 static const QRegularExpression comHemTT {
"[Tt]ext-[Tt][Vv]" };
1239 event.m_subtitleType |= SUB_NORMAL;
1242 static const QRegularExpression comHemRerun1 { R
"([Rr]epris\sfrån\s([^\.]+)(?:\.|$))" };
1243 static const QRegularExpression comHemRerun2 { R
"(([0-9]+)/([0-9]+)(?:\s-\s([0-9]{4}))?)" };
1245 if (!match.hasMatch())
1249 if (match.captured(1) ==
"i dag")
1251 event.m_originalairdate =
event.m_starttime.date();
1256 if (match.captured(1) ==
"eftermiddagen")
1258 event.m_originalairdate =
event.m_starttime.date().addDays(-1);
1263 #if QT_VERSION < QT_VERSION_CHECK(6,5,0)
1264 match2 = comHemRerun2.match(match.capturedView(1));
1266 match2 = comHemRerun2.matchView(match.capturedView(1));
1268 if (match2.hasMatch())
1270 int day = match2.capturedView(1).toInt();
1271 int month = match2.capturedView(2).toInt();
1278 if (day > 0 && month > 0)
1280 QDate date(event.
m_starttime.date().year(), month, day);
1283 date = date.addYears(-1);
1284 event.m_originalairdate = date;
1295 event.m_category =
event.m_subtitle;
1297 int position =
event.m_description.indexOf(
':');
1300 const QString stmp =
event.m_description;
1301 event.m_subtitle = stmp.left(position);
1302 event.m_description = stmp.right(stmp.length() - position - 2);
1313 event.m_description =
"";
1315 if (event.
m_description.endsWith(
"Copyright West TV Ltd. 2011)"))
1316 event.m_description.resize(event.
m_description.length()-40);
1320 event.m_description =
event.m_subtitle;
1321 event.m_subtitle.clear();
1324 event.m_description.remove(0,event.
m_title.length()+3);
1325 if (event.
m_title.startsWith(
"LIVE: ", Qt::CaseInsensitive))
1327 event.m_title.remove(0, 6);
1328 event.m_description.prepend(
"(Live) ");
1337 static const QRegularExpression
rating {
"\\((G|PG|M|MA)\\)" };
1339 if (match.hasMatch())
1343 event.m_ratings.push_back(prograting);
1344 event.m_description.remove(0,match.capturedLength()+1);
1348 event.m_videoProps |= VID_HDTV;
1349 event.m_description.remove(0,5);
1353 event.m_subtitleType |= SUB_NORMAL;
1354 event.m_description.remove(0,5);
1358 event.m_subtitle.clear();
1362 event.m_description.remove(0,event.
m_title.length()+1);
1372 event.m_previouslyshown =
true;
1375 static const QRegularExpression year {
"(\\d{4})$" };
1377 if (match.hasMatch())
1379 event.m_airdate = match.capturedView(1).toUInt();
1384 event.m_subtitleType |= SUB_NORMAL;
1388 static const QRegularExpression adv {
"(\\([A-Z,]+\\))$" };
1390 if (match.hasMatch())
1392 advisories = match.captured(1);
1393 event.m_description.remove(match.capturedStart()-1, match.capturedLength()+1);
1395 static const QRegularExpression
rating {
"(C|G|PG|M|MA)$" };
1397 if (match.hasMatch())
1401 if (!advisories.isEmpty())
1402 prograting.
m_rating.append(
" ").append(advisories);
1403 event.m_ratings.push_back(prograting);
1404 event.m_description.remove(match.capturedStart()-1, match.capturedLength()+1);
1416 event.m_description =
event.m_description.trimmed();
1418 static const QRegularExpression auFreeviewSY { R
"((.*) \((.+)\) \(([12][0-9][0-9][0-9])\)$)" };
1420 if (match.hasMatch())
1423 event.m_subtitle = match.captured(2);
1424 event.m_airdate = match.capturedView(3).toUInt();
1425 event.m_description = match.captured(1);
1428 static const QRegularExpression auFreeviewY {
"(.*) \\(([12][0-9][0-9][0-9])\\)$" };
1430 if (match.hasMatch())
1432 event.m_airdate = match.capturedView(2).toUInt();
1433 event.m_description = match.captured(1);
1436 static const QRegularExpression auFreeviewSYC { R
"((.*) \((.+)\) \(([12][0-9][0-9][0-9])\) \((.+)\)$)" };
1438 if (match.hasMatch())
1441 event.m_subtitle = match.captured(2);
1442 event.m_airdate = match.capturedView(3).toUInt();
1443 QStringList actors = match.captured(4).split(
"/");
1446 for (
const QString& actor : std::as_const(actors))
1448 event.m_description = match.captured(1);
1451 static const QRegularExpression auFreeviewYC { R
"((.*) \(([12][0-9][0-9][0-9])\) \((.+)\)$)" };
1453 if (match.hasMatch())
1455 event.m_airdate = match.capturedView(2).toUInt();
1456 QStringList actors = match.captured(3).split(
"/");
1459 for (
const QString& actor : std::as_const(actors))
1461 event.m_description = match.captured(1);
1470 const uint SUBTITLE_PCT = 60;
1471 const uint lSUBTITLE_MAX_LEN = 128;
1474 event.m_subtitle = QString(
"");
1481 static const QRegularExpression mcaIncompleteTitle { R
"((.*).\.\.\.$)" };
1482 auto match = mcaIncompleteTitle.match(event.
m_title);
1483 if (match.hasMatch())
1485 static const QString mcaCompleteTitlea {
"^'?(" };
1486 static const QString mcaCompleteTitleb { R
"([^\.\?]+[^\'])'?[\.\?]\s+(.+))" };
1487 static const QRegularExpression mcaCompleteTitle
1488 { mcaCompleteTitlea + match.captured(1) + mcaCompleteTitleb,
1489 QRegularExpression::CaseInsensitiveOption};
1491 if (match.hasMatch())
1493 event.m_title = match.captured(1).trimmed();
1494 event.m_description = match.captured(2).trimmed();
1499 static const QRegularExpression mcaSubtitle { R
"(^'([^\.]+)'\.\s+(.+))" };
1501 if (match.hasMatch())
1503 uint matchLen = match.capturedLength(1);
1504 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1510 if ((matchLen < lSUBTITLE_MAX_LEN) &&
1511 ((matchLen * 100 / evDescLen) < SUBTITLE_PCT))
1513 event.m_subtitle = match.captured(1);
1514 event.m_description = match.captured(2);
1519 static const QRegularExpression mcaSeries { R
"(^S?(\d+)\/E?(\d+)\s-\s(.*)$)" };
1521 if (match.hasMatch())
1523 uint season = match.capturedView(1).toUInt();
1524 uint episode = match.capturedView(2).toUInt();
1525 event.m_subtitle = match.captured(3).trimmed();
1526 event.m_syndicatedepisodenumber =
1527 QString(
"S%1E%2").arg(season).arg(episode);
1528 event.m_season = season;
1529 event.m_episode = episode;
1534 static const QRegularExpression mcaCC { R
"(,?\s(HI|English) Subtitles\.?)" };
1535 int position =
event.m_description.indexOf(mcaCC);
1538 event.m_subtitleType |= SUB_HARDHEAR;
1539 event.m_description.remove(mcaCC);
1543 static const QRegularExpression mcaDD { R
"(,?\sDD\.?)" };
1544 position = event.m_description.indexOf(mcaDD);
1545 if ((position > 0) && (position > event.
m_description.length() - 7))
1547 event.m_audioProps |= AUD_DOLBY;
1548 event.m_description.remove(mcaDD);
1552 static const QRegularExpression mcaAvail { R
"(\s(Only available on [^\.]*bouquet|Not available in RSA [^\.]*)\.?)" };
1553 event.m_description.remove(mcaAvail);
1556 bool isMovie =
false;
1557 static const QRegularExpression mcaCredits { R
"((.*)\s\((\d{4})\)\s*([^\.]+)\.?\s*$)" };
1559 if (match.hasMatch())
1562 event.m_description = match.captured(1).trimmed();
1564 uint y = match.captured(2).trimmed().toUInt(&ok);
1566 event.m_airdate = y;
1572 static const QRegularExpression mcaYear { R
"((.*)\s\((\d{4})\)\s*$)" };
1574 if (match.hasMatch())
1577 event.m_description = match.captured(1).trimmed();
1579 uint y = match.captured(2).trimmed().toUInt(&ok);
1581 event.m_airdate = y;
1587 static const QRegularExpression mcaActors { R
"((.*\.)\s+([^\.]+\s[A-Z][^\.]+)\.\s*)" };
1589 if (match.hasMatch())
1591 static const QRegularExpression mcaActorsSeparator {
"(,\\s+)" };
1592 const QStringList actors = match.captured(2).split(
1593 mcaActorsSeparator, Qt::SkipEmptyParts);
1596 for (
const auto & actor : std::as_const(actors))
1598 event.m_description = match.captured(1).trimmed();
1610 static const QRegularExpression superRTLSubtitle { R
"(^Folge\s(\d{1,3}):\s'(.*)')" };
1611 auto match = superRTLSubtitle.match(event.
m_subtitle);
1612 if (match.hasMatch())
1615 event.m_episode = match.capturedView(1).toUInt();
1616 event.m_subtitle = match.captured(2);
1624 static const QRegularExpression rtlRepeat
1625 { R
"([\s\(]?Wiederholung.+vo[m|n].+(\d{2}\.\d{2}\.\d{4}|\d{2}[:\.]\d{2}\sUhr)\)?)" };
1627 if (match.hasMatch())
1630 int pos = match.capturedStart(0);
1631 int length = match.capturedLength(0) + (pos ? 0 : 1);
1632 event.m_description =
event.m_description.remove(pos, length).trimmed();
1636 static const QRegularExpression rtlSubtitle1 { R
"(^Folge\s(\d{1,4})\s*:\s+'(.*)'(?:\s|\.\s*|$))" };
1637 static const QRegularExpression rtlSubtitle2 { R
"(^Folge\s(\d{1,4})\s+(.{0,5}[^\?!\.]{0,120})[\?!\.]\s*)" };
1638 static const QRegularExpression rtlSubtitle3 { R
"(^(?:Folge\s)?(\d{1,4}(?:\/[IVX]+)?)\s+(.{0,5}[^\?!\.]{0,120})[\?!\.]\s*)" };
1639 static const QRegularExpression rtlSubtitle4 { R
"(^Thema.{0,5}:\s([^\.]+)\.\s*)" };
1640 static const QRegularExpression rtlSubtitle5 {
"^'(.+)'\\.\\s*" };
1641 static const QRegularExpression rtlEpisodeNo1 { R
"(^(Folge\s\d{1,4})\.*\s*)" };
1642 static const QRegularExpression rtlEpisodeNo2 { R
"(^(\d{1,2}\/[IVX]+)\.*\s*)" };
1653 if (match1.hasMatch())
1655 event.m_syndicatedepisodenumber = match1.captured(1);
1656 event.m_subtitle = match1.captured(2);
1657 event.m_description =
1658 event.m_description.remove(0, match1.capturedLength());
1661 else if (match2.hasMatch())
1663 event.m_syndicatedepisodenumber = match2.captured(1);
1664 event.m_subtitle = match2.captured(2);
1665 event.m_description =
1666 event.m_description.remove(0, match2.capturedLength());
1669 else if (match3.hasMatch())
1671 event.m_syndicatedepisodenumber = match3.captured(1);
1672 event.m_subtitle = match3.captured(2);
1673 event.m_description =
1674 event.m_description.remove(0, match3.capturedLength());
1677 else if (match4.hasMatch())
1679 event.m_subtitle = match4.captured(1);
1680 event.m_description =
1681 event.m_description.remove(0, match4.capturedLength());
1684 else if (match5.hasMatch())
1686 event.m_subtitle = match5.captured(1);
1687 event.m_description =
1688 event.m_description.remove(0, match5.capturedLength());
1691 else if (match6.hasMatch())
1693 event.m_syndicatedepisodenumber = match6.captured(2);
1694 event.m_subtitle = match6.captured(1);
1695 event.m_description =
1696 event.m_description.remove(0, match6.capturedLength());
1699 else if (match7.hasMatch())
1701 event.m_syndicatedepisodenumber = match7.captured(2);
1702 event.m_subtitle = match7.captured(1);
1703 event.m_description =
1704 event.m_description.remove(0, match7.capturedLength());
1714 const uint SUBTITLE_PCT = 35;
1715 const uint lSUBTITLE_MAX_LEN = 50;
1717 static const QRegularExpression rtlSubtitle { R
"(^([^\.]{3,})\.\s+(.+))" };
1719 if (match.hasMatch())
1721 uint matchLen = match.capturedLength(1);
1722 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1728 if ((matchLen < lSUBTITLE_MAX_LEN) &&
1729 (matchLen * 100 / evDescLen < SUBTITLE_PCT))
1731 event.m_subtitle = match.captured(1);
1732 event.m_description = match.captured(2);
1751 static const QRegularExpression pro7Repeat
1752 { R
"((?<=\s|^)\(WH vom \w+, \d{2}\.\d{2}\.\d{4}, \d{2}:\d{2} Uhr\)$)" };
1753 auto match = pro7Repeat.match(event.
m_subtitle);
1754 if (match.hasMatch())
1756 event.m_previouslyshown =
true;
1757 event.m_subtitle.remove(match.capturedStart(0),
1758 match.capturedLength(0));
1759 event.m_subtitle =
event.m_subtitle.trimmed();
1763 static const QRegularExpression pro7signLanguage
1764 { R
"((?<=\s|^)Mit Gebärdensprache \(Online\-Stream\)$)" };
1765 match = pro7signLanguage.match(event.m_subtitle);
1766 if (match.hasMatch())
1768 event.m_subtitle.remove(match.capturedStart(0),
1769 match.capturedLength(0));
1770 event.m_subtitle =
event.m_subtitle.trimmed();
1774 static const QRegularExpression pro7ratingAllAges
1775 { R
"((?<=\s|^)Altersfreigabe: Ohne Altersbeschränkung$)" };
1776 match = pro7ratingAllAges.match(event.m_subtitle);
1777 if (match.hasMatch())
1782 event.m_ratings.push_back(prograting);
1784 event.m_subtitle.remove(match.capturedStart(0),
1785 match.capturedLength(0));
1786 event.m_subtitle =
event.m_subtitle.trimmed();
1788 static const QRegularExpression pro7rating
1789 { R
"((?<=\s|^)Altersfreigabe: ab (\d+)$)" };
1791 if (match.hasMatch())
1795 prograting.
m_rating = match.captured(1);
1796 event.m_ratings.push_back(prograting);
1798 event.m_subtitle.remove(match.capturedStart(0),
1799 match.capturedLength(0));
1800 event.m_subtitle =
event.m_subtitle.trimmed();
1804 static const QRegularExpression pro7CategoryOriginalairdate
1805 { R
"((?<=\s|^)(Late Night Show|Live Shopping|Real Crime|Real Life Doku|Romantic Comedy|Scripted Reality|\S+), ([A-Z]+(?:\/[A-Z]+)*) (\d{4})$)" };
1806 match = pro7CategoryOriginalairdate.match(event.m_subtitle);
1807 if (match.hasMatch())
1809 event.m_category = match.captured(1);
1811 event.m_description.append(
" (").append(match.captured(2)).append(
" ").append(match.captured(3)).append(
")");
1813 uint y = match.captured(3).toUInt();
1814 event.m_originalairdate = QDate(y, 1, 1);
1817 event.m_airdate = y;
1820 event.m_subtitle.remove(match.capturedStart(0),
1821 match.capturedLength(0));
1822 event.m_subtitle =
event.m_subtitle.trimmed();
1827 event.m_subtitle =
"";
1836 static const QRegularExpression deDisneyChannelSubtitle { R
"(,([^,]+?)\s{0,1}(\d{4})$)" };
1837 auto match = deDisneyChannelSubtitle.match(event.
m_subtitle);
1838 if (match.hasMatch())
1842 event.m_airdate = match.captured(3).toUInt();
1844 event.m_subtitle.remove(match.capturedStart(0),
1845 match.capturedLength(0));
1847 static const QRegularExpression
tmp { R
"(\s[^\s]+?-(Serie))" };
1849 if (match.hasMatch())
1852 event.m_category=match.captured(0).trimmed();
1853 event.m_subtitle.remove(match.capturedStart(0),
1854 match.capturedLength(0));
1863 static const QRegularExpression atvSubtitle { R
"(,{0,1}\sFolge\s(\d{1,3})$)" };
1864 event.m_subtitle.replace(atvSubtitle,
"");
1873 static const QRegularExpression fiRerun { R
"(\s?Uusinta[a-zA-Z\s]*\.?)" };
1875 if (match.hasMatch())
1877 event.m_previouslyshown =
true;
1878 event.m_description.remove(match.capturedStart(), match.capturedLength());
1881 static const QRegularExpression fiRerun2 { R
"(\([Uu]\))" };
1883 if (match.hasMatch())
1885 event.m_previouslyshown =
true;
1886 event.m_description.remove(match.capturedStart(), match.capturedLength());
1891 if (match.hasMatch())
1893 event.m_audioProps |= AUD_STEREO;
1894 event.m_description.remove(match.capturedStart(), match.capturedLength());
1898 static const QRegularExpression fiAgeLimit { R
"(\((\d{1,2}|[ST])\)$)" };
1899 match = fiAgeLimit.match(event.m_title);
1900 if (match.hasMatch())
1904 event.m_ratings.push_back(prograting);
1905 event.m_title.remove(match.capturedStart(), match.capturedLength());
1909 static const QRegularExpression fiFilm {
"^(Film|Elokuva): " };
1910 match = fiFilm.match(event.
m_title);
1911 if (match.hasMatch())
1913 event.m_category =
"Film";
1915 event.m_title.remove(match.capturedStart(), match.capturedLength());
1925 QString country =
"";
1927 static const QRegularExpression dePremiereLength { R
"(\s?[0-9]+\sMin\.)" };
1928 event.m_description =
event.m_description.replace(dePremiereLength,
"");
1930 static const QRegularExpression dePremiereAirdate { R
"(\s?([^\s^\.]+)\s((?:1|2)[0-9]{3})\.)" };
1932 if ( match.hasMatch())
1934 country = match.captured(1).trimmed();
1936 uint y = match.captured(2).toUInt(&ok);
1938 event.m_airdate = y;
1939 event.m_description.remove(match.capturedStart(0),
1940 match.capturedLength(0));
1943 static const QRegularExpression dePremiereCredits { R
"(\sVon\s([^,]+)(?:,|\su\.\sa\.)\smit\s([^\.]*)\.)" };
1945 if (match.hasMatch())
1948 const QStringList actors = match.captured(2).split(
1949 ", ", Qt::SkipEmptyParts);
1952 for (
const auto & actor : std::as_const(actors))
1954 event.m_description.remove(match.capturedStart(0),
1955 match.capturedLength(0));
1958 event.m_description =
event.m_description.replace(
"\u000A$",
"");
1959 event.m_description =
event.m_description.replace(
"\u000A",
" ");
1962 static const QRegularExpression dePremiereOTitle { R
"(\s*\(([^\)]*)\)$)" };
1963 match = dePremiereOTitle.match(event.m_title);
1964 if (match.hasMatch())
1966 event.m_subtitle = QString(
"%1, %2").arg(match.captured(1), country);
1967 event.m_title.remove(match.capturedStart(0),
1968 match.capturedLength(0));
1972 static const QRegularExpression deSkyDescriptionSeasonEpisode { R
"(^(\d{1,2}).\sStaffel,\sFolge\s(\d{1,2}):\s)" };
1973 match = deSkyDescriptionSeasonEpisode.match(event.m_description);
1974 if (match.hasMatch())
1976 event.m_season = match.captured(1).trimmed().toUInt();
1977 event.m_episode = match.captured(2).trimmed().toUInt();
1978 event.m_description.remove(match.capturedStart(0),
1979 match.capturedLength(0));
2000 {
"Movie - Soap/melodrama/folkloric",
2015 QString fullinfo =
event.m_subtitle +
event.m_description;
2016 event.m_subtitle =
"";
2024 event.m_category = name;
2025 event.m_categoryType =
type;
2033 auto match =
kStereo.match(fullinfo);
2034 if (match.hasMatch())
2036 event.m_audioProps |= AUD_STEREO;
2037 fullinfo.remove(match.capturedStart(), match.capturedLength());
2041 static const QRegularExpression nlWide {
"breedbeeld" };
2042 match = nlWide.match(fullinfo);
2043 if (match.hasMatch())
2045 event.m_videoProps |= VID_WIDESCREEN;
2046 fullinfo = fullinfo.replace(
"breedbeeld",
".");
2050 static const QRegularExpression nlRepeat {
"herh." };
2051 match = nlRepeat.match(fullinfo);
2052 if (match.hasMatch())
2053 fullinfo = fullinfo.replace(
"herh.",
".");
2056 static const QRegularExpression nlTxt {
"txt" };
2057 match = nlTxt.match(fullinfo);
2058 if (match.hasMatch())
2060 event.m_subtitleType |= SUB_NORMAL;
2061 fullinfo = fullinfo.replace(
"txt",
".");
2065 static const QRegularExpression nlHD { R
"(\sHD$)" };
2066 match = nlHD.match(event.m_title);
2067 if (match.hasMatch())
2069 event.m_videoProps |= VID_HDTV;
2070 event.m_title.remove(match.capturedStart(), match.capturedLength());
2074 static const QRegularExpression nlSub { R
"(\sAfl\.:\s([^\.]+)\.)" };
2075 match = nlSub.match(fullinfo);
2076 if (match.hasMatch())
2078 QString tmpSubString = match.captured(0);
2079 tmpSubString = tmpSubString.right(match.capturedLength() - 7);
2080 event.m_subtitle = tmpSubString.left(tmpSubString.length() -1);
2081 fullinfo.remove(match.capturedStart(), match.capturedLength());
2085 static const QRegularExpression nlSub2 { R
"(\s\"([^\"]+)\")" };
2086 match = nlSub2.match(fullinfo);
2087 if (match.hasMatch())
2089 QString tmpSubString = match.captured(0);
2090 tmpSubString = tmpSubString.right(match.capturedLength() - 2);
2091 event.m_subtitle = tmpSubString.left(tmpSubString.length() -1);
2092 fullinfo.remove(match.capturedStart(), match.capturedLength());
2098 int position =
event.m_title.indexOf(
":");
2099 if ((position != -1) &&
2100 (event.
m_title[position + 1].toUpper() == event.
m_title[position + 1]) &&
2103 event.m_subtitle =
event.m_title.mid(position + 1);
2104 event.m_title =
event.m_title.left(position);
2109 static const QRegularExpression nlActors { R
"(\sMet:\s.+e\.a\.)" };
2110 static const QRegularExpression nlPersSeparator { R
"((, |\sen\s))" };
2111 match = nlActors.match(fullinfo);
2112 if (match.hasMatch())
2114 QString tmpActorsString = match.captured(0);
2115 tmpActorsString = tmpActorsString.right(tmpActorsString.length() - 6);
2116 tmpActorsString = tmpActorsString.left(tmpActorsString.length() - 5);
2117 const QStringList actors =
2118 tmpActorsString.split(nlPersSeparator, Qt::SkipEmptyParts);
2121 for (
const auto & actor : std::as_const(actors))
2123 fullinfo.remove(match.capturedStart(), match.capturedLength());
2127 static const QRegularExpression nlPres { R
"(\sPresentatie:\s([^\.]+)\.)" };
2128 match = nlPres.match(fullinfo);
2129 if (match.hasMatch())
2131 QString tmpPresString = match.captured(0);
2132 tmpPresString = tmpPresString.right(tmpPresString.length() - 14);
2133 tmpPresString = tmpPresString.left(tmpPresString.length() -1);
2134 const QStringList presenters =
2135 tmpPresString.split(nlPersSeparator, Qt::SkipEmptyParts);
2136 for (
const auto & presenter : std::as_const(presenters))
2138 fullinfo.remove(match.capturedStart(), match.capturedLength());
2142 static const QRegularExpression nlYear1 { R
"(\suit\s([1-2][0-9]{3}))" };
2143 static const QRegularExpression nlYear2 { R
"((\s\([A-Z]{0,3}/?)([1-2][0-9]{3})\))",
2144 QRegularExpression::CaseInsensitiveOption };
2145 match = nlYear1.match(fullinfo);
2146 if (match.hasMatch())
2149 uint y = match.capturedView(1).toUInt(&ok);
2151 event.m_originalairdate = QDate(y, 1, 1);
2154 match = nlYear2.match(fullinfo);
2155 if (match.hasMatch())
2158 uint y = match.capturedView(2).toUInt(&ok);
2160 event.m_originalairdate = QDate(y, 1, 1);
2164 static const QRegularExpression nlDirector { R
"(\svan\s(([A-Z][a-z]+\s)|([A-Z]\.\s)))" };
2165 match = nlDirector.match(fullinfo);
2166 if (match.hasMatch())
2170 static const QRegularExpression nlRub { R
"(\s?\(\W+\)\s?)" };
2171 fullinfo.remove(nlRub);
2174 static const QRegularExpression nlCat {
"^(Amusement|Muziek|Informatief|Nieuws/actualiteiten|Jeugd|Animatie|Sport|Serie/soap|Kunst/Cultuur|Documentaire|Film|Natuur|Erotiek|Comedy|Misdaad|Religieus)\\.\\s" };
2175 fullinfo.remove(nlCat);
2178 static const QRegularExpression nlOmroep { R
"(\s\(([A-Z]+/?)+\)$)" };
2179 event.m_title.remove(nlOmroep);
2183 event.m_description = fullinfo;
2203 static const QRegularExpression noRerun {
"\\(R\\)" };
2204 auto match = noRerun.match(event.
m_title);
2205 if (match.hasMatch())
2207 event.m_previouslyshown =
true;
2208 event.m_title.remove(match.capturedStart(), match.capturedLength());
2211 static const QRegularExpression noHD { R
"([\(\[]HD[\)\]])" };
2213 if (match.hasMatch())
2215 event.m_videoProps |= VID_HDTV;
2216 event.m_subtitle.remove(match.capturedStart(), match.capturedLength());
2220 if (match.hasMatch())
2222 event.m_videoProps |= VID_HDTV;
2223 event.m_description.remove(match.capturedStart(), match.capturedLength());
2233 static const QRegularExpression noRerun {
"\\(R\\)" };
2234 auto match = noRerun.match(event.
m_title);
2235 if (match.hasMatch())
2237 event.m_previouslyshown =
true;
2238 event.m_title.remove(match.capturedStart(), match.capturedLength());
2242 if (match.hasMatch())
2244 event.m_previouslyshown =
true;
2249 static const QRegularExpression noNRKCategories
2250 {
"^(Superstrek[ea]r|Supersomm[ea]r|Superjul|Barne-tv|Fantorangen|Kuraffen|Supermorg[eo]n|Julemorg[eo]n|Sommermorg[eo]n|"
2251 "Kuraffen-TV|Sport i dag|NRKs sportsl.rdag|NRKs sportss.ndag|Dagens dokumentar|"
2252 "NRK2s historiekveld|Detektimen|Nattkino|Filmklassiker|Film|Kortfilm|P.skemorg[eo]n|"
2253 "Radioteatret|Opera|P2-Akademiet|Nyhetsmorg[eo]n i P2 og Alltid Nyheter:): (.+)" };
2254 match = noNRKCategories.match(event.
m_title);
2255 if (match.hasMatch() && (match.capturedLength(2) > 1))
2257 event.m_title = match.captured(2);
2258 event.m_description =
"(" + match.captured(1) +
") " +
event.m_description;
2262 static const QRegularExpression noPremiere {
"\\s+-\\s+(Sesongpremiere|Premiere|premiere)!?$" };
2263 match = noPremiere.match(event.
m_title);
2264 if (match.hasMatch() && (match.capturedStart() >= 3))
2265 event.m_title.remove(match.capturedStart(), match.capturedLength());
2268 if (!event.
m_title.startsWith(
"CSI:") &&
2269 !event.
m_title.startsWith(
"CD:") &&
2270 !event.
m_title.startsWith(
"Distriktsnyheter: fra"))
2272 static const QRegularExpression noColonSubtitle {
"^([^:]+): (.+)" };
2273 match = noColonSubtitle.match(event.
m_title);
2274 if (match.hasMatch())
2278 event.m_title = match.captured(1);
2279 event.m_subtitle = match.captured(2);
2281 else if (event.
m_subtitle == match.captured(2))
2283 event.m_title = match.captured(1);
2301 static const QRegularExpression dkEpisode { R
"(\(([0-9]+)\))" };
2302 auto match = dkEpisode.match(event.
m_title);
2303 if (match.hasMatch())
2305 episode = match.capturedView(1).toInt();
2306 event.m_partnumber = match.capturedView(1).toInt();
2307 event.m_title.remove(match.capturedStart(), match.capturedLength());
2310 static const QRegularExpression dkPart { R
"(\(([0-9]+):([0-9]+)\))" };
2311 match = dkPart.match(event.m_title);
2312 if (match.hasMatch())
2314 episode = match.capturedView(1).toInt();
2315 event.m_partnumber = match.capturedView(1).toInt();
2316 event.m_parttotal = match.capturedView(2).toInt();
2317 event.m_title.remove(match.capturedStart(), match.capturedLength());
2321 static const QRegularExpression dkSubtitle1 {
"^([^:]+): (.+)" };
2322 match = dkSubtitle1.match(event.
m_title);
2323 if (match.hasMatch())
2325 event.m_title = match.captured(1);
2326 event.m_subtitle = match.captured(2);
2330 static const QRegularExpression dkSubtitle2 {
"^([^:]+) - (.+)" };
2331 match = dkSubtitle2.match(event.
m_title);
2332 if (match.hasMatch())
2334 event.m_title = match.captured(1);
2335 event.m_subtitle = match.captured(2);
2342 static const QRegularExpression dkSeason1 {
"Sæson ([0-9]+)\\." };
2344 if (match.hasMatch())
2346 season = match.capturedView(1).toInt();
2350 static const QRegularExpression dkSeason2 {
"- år ([0-9]+) :" };
2352 if (match.hasMatch())
2354 season = match.capturedView(1).toInt();
2359 event.m_episode = episode;
2362 event.m_season = season;
2365 static const QRegularExpression dkFeatures {
"Features:(.+)" };
2367 if (match.hasMatch())
2369 QString features = match.captured(1);
2370 event.m_description.remove(match.capturedStart(),
2371 match.capturedLength());
2373 static const QRegularExpression dkWidescreen {
" 16:9" };
2374 if (features.indexOf(dkWidescreen) != -1)
2375 event.m_videoProps |= VID_WIDESCREEN;
2377 static const QRegularExpression dkHD {
" HD" };
2378 if (features.indexOf(dkHD) != -1)
2379 event.m_videoProps |= VID_HDTV;
2381 static const QRegularExpression dkDolby {
" 5:1" };
2382 if (features.indexOf(dkDolby) != -1)
2383 event.m_audioProps |= AUD_DOLBY;
2385 static const QRegularExpression dkSurround { R
"( \(\(S\)\))" };
2386 if (features.indexOf(dkSurround) != -1)
2387 event.m_audioProps |= AUD_SURROUND;
2389 static const QRegularExpression dkStereo {
" S" };
2390 if (features.indexOf(dkStereo) != -1)
2391 event.m_audioProps |= AUD_STEREO;
2393 static const QRegularExpression dkReplay {
" \\(G\\)" };
2394 if (features.indexOf(dkReplay) != -1)
2395 event.m_previouslyshown =
true;
2397 static const QRegularExpression dkTxt {
" TTV" };
2398 if (features.indexOf(dkTxt) != -1)
2399 event.m_subtitleType |= SUB_NORMAL;
2412 newid = QString(
"%1%2").arg(event.
m_chanid).
2417 newid =
event.m_seriesId.mid(2,8);
2419 event.m_seriesId = newid;
2423 event.m_programId[0]=
'_';
2428 event.m_subtitle = QString(
"%1 (%2").arg(event.
m_subtitle).arg(episode);
2430 event.m_subtitle = QString(
"%1:%2").arg(event.
m_subtitle).
2434 event.m_season = season;
2435 event.m_episode = episode;
2436 event.m_syndicatedepisodenumber =
2437 QString(
"S%1E%2").arg(season).arg(episode);
2438 event.m_subtitle = QString(
"%1 Sæson %2").arg(event.
m_subtitle).
2441 event.m_subtitle = QString(
"%1)").arg(event.
m_subtitle);
2445 static const QRegularExpression dkDirector {
"(?:Instr.: |Instrukt.r: )(.+)$" };
2446 static const QRegularExpression dkPersonsSeparator {
"(, )|(og )" };
2447 QStringList directors {};
2449 if (match.hasMatch())
2451 QString tmpDirectorsString = match.captured(1);
2452 directors = tmpDirectorsString.split(dkPersonsSeparator, Qt::SkipEmptyParts);
2453 for (
const auto & director : std::as_const(directors))
2455 tmpDirectorsString = director.split(
":").last().trimmed().
2457 if (tmpDirectorsString !=
"")
2463 static const QRegularExpression dkActors {
"(?:Medvirkende: |Medv\\.: )(.+)" };
2465 if (match.hasMatch())
2467 QString tmpActorsString = match.captured(1);
2468 const QStringList actors =
2469 tmpActorsString.split(dkPersonsSeparator, Qt::SkipEmptyParts);
2470 for (
const auto & actor : std::as_const(actors))
2472 tmpActorsString = actor.split(
":").last().trimmed().remove(
kDotAtEnd);
2473 if (!tmpActorsString.isEmpty() && !directors.contains(tmpActorsString))
2480 static const QRegularExpression dkYear {
" fra ([0-9]{4})[ \\.]" };
2482 if (match.hasMatch())
2485 uint y = match.capturedView(1).toUInt(&ok);
2487 event.m_originalairdate = QDate(y, 1, 1);
2496 LOG(VB_EIT, LOG_INFO, QString(
"Applying html strip to %1").arg(event.
m_title));
2497 static const QRegularExpression html {
"</?EM>", QRegularExpression::CaseInsensitiveOption };
2498 event.m_title.remove(html);
2509 event.m_description = QString(
"");
2513 if (event.
m_subtitle.trimmed().right(1) !=
".'" )
2514 event.m_subtitle =
event.m_subtitle.trimmed() +
".";
2515 event.m_description =
event.m_subtitle.trimmed() + QString(
" ") +
event.m_description;
2516 event.m_subtitle = QString(
"");
2523 static const QRegularExpression grRating { R
"(\[(K|Κ|8|12|16|18)\]\s*)",
2524 QRegularExpression::CaseInsensitiveOption };
2525 auto match = grRating.match(event.
m_title);
2526 if (match.hasMatch())
2530 event.m_ratings.push_back(prograting);
2531 event.m_title.remove(match.capturedStart(), match.capturedLength());
2532 event.m_title =
event.m_title.trimmed();
2536 int position =
event.m_title.indexOf(
"(Ζ)");
2539 event.m_title =
event.m_title.replace(
"(Ζ)",
"");
2540 event.m_description.prepend(
"Ζωντανή Μετάδοση. ");
2544 static const QRegularExpression grNotPreviouslyShown {
2545 R
"(\W?(?:-\s*)*(?:\b[Α1]['΄η]?\s*(?:τηλεοπτικ[ηή]\s*)?(?:μετ[αά]δοση|προβολ[ηή]))\W?)",
2546 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2547 match = grNotPreviouslyShown.match(event.m_title);
2548 if (match.hasMatch())
2550 event.m_previouslyshown =
false;
2551 event.m_title.remove(match.capturedStart(), match.capturedLength());
2557 static const QRegularExpression grReplay { R
"(\([ΕE]\))" };
2558 match = grReplay.match(event.m_title);
2559 if (match.hasMatch())
2561 event.m_previouslyshown =
true;
2562 event.m_title.remove(match.capturedStart(), match.capturedLength());
2566 position =
event.m_description.indexOf(
"(HD)");
2569 event.m_description =
event.m_description.replace(
"(HD)",
"");
2570 event.m_videoProps |= VID_HDTV;
2574 position =
event.m_description.indexOf(
"(Full HD)");
2577 event.m_description =
event.m_description.replace(
"(Full HD)",
"");
2578 event.m_videoProps |= VID_HDTV;
2581 static const QRegularExpression grFixnofullstopActors { R
"(\w\s(Παίζουν:|Πρωταγων))" };
2583 if (match.hasMatch())
2584 event.m_description.insert(match.capturedStart() + 1,
".");
2587 static const QRegularExpression grFixnofullstopDirectors { R
"(\w\s(Σκηνοθ[εέ]))" };
2588 match = grFixnofullstopDirectors.match(event.m_description);
2589 if (match.hasMatch())
2590 event.m_description.insert(match.capturedStart() + 1,
".");
2598 static const QRegularExpression grActors { R
"((?:[Ππ]α[ιί]ζουν:|[ΜMμ]ε τους:|Πρωταγωνιστο[υύ]ν:|Πρωταγωνιστε[ιί]:?)(?:\s+στο ρόλο(?: του| της)?\s(?:\w+\s[οη]\s))?([-\w\s']+(?:,[-\w\s']+)*)(?:κ\.[αά])?\W?)" };
2600 static const QRegularExpression grPeopleSeparator { R
"(([,-]\s+))" };
2602 if (match.hasMatch())
2604 QString tmpActorsString = match.captured(1);
2605 const QStringList actors =
2606 tmpActorsString.split(grPeopleSeparator, Qt::SkipEmptyParts);
2607 for (
const auto & actor : std::as_const(actors))
2609 tmpActorsString = actor.split(
":").last().trimmed().remove(
kDotAtEnd);
2610 if (tmpActorsString !=
"")
2613 event.m_description.remove(match.capturedStart(), match.capturedLength());
2617 static const QRegularExpression grDirector { R
"((?:Σκηνοθεσία: |Σκηνοθέτης: |Σκηνοθέτης - Επιμέλεια: )(\w+\s\w+\s?)(?:\W?))" };
2619 if (match.hasMatch())
2621 QString tmpDirectorsString = match.captured(1);
2622 const QStringList directors =
2623 tmpDirectorsString.split(grPeopleSeparator, Qt::SkipEmptyParts);
2624 for (
const auto & director : std::as_const(directors))
2626 tmpDirectorsString = director.split(
":").last().trimmed().
2628 if (tmpDirectorsString !=
"")
2633 event.m_description.remove(match.capturedStart(), match.capturedLength());
2637 static const QRegularExpression grPres { R
"((?:Παρουσ[ιί]αση:(?:\b)*|Παρουσι[αά]ζ(?:ουν|ει)(?::|\sο|\sη)|Παρουσι[αά]στ(?:[ηή]ς|ρια|ριες|[εέ]ς)(?::|\sο|\sη)|Με τ(?:ον |ην )(?:[\s|:|ο|η])*(?:\b)*)([-\w\s]+(?:,[-\w\s]+)*)\W?)",
2638 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2640 if (match.hasMatch())
2642 QString tmpPresentersString = match.captured(1);
2643 const QStringList presenters =
2644 tmpPresentersString.split(grPeopleSeparator, Qt::SkipEmptyParts);
2645 for (
const auto & presenter : std::as_const(presenters))
2647 tmpPresentersString = presenter.split(
":").last().trimmed().
2649 if (tmpPresentersString !=
"")
2654 event.m_description.remove(match.capturedStart(), match.capturedLength());
2659 static const QRegularExpression grYear { R
"(\W?(?:\s?παραγωγ[ηή]ς|\s?-|,)\s*([1-2][0-9]{3})(?:-\d{1,4})?)",
2660 QRegularExpression::CaseInsensitiveOption };
2662 if (match.hasMatch())
2665 uint y = match.capturedView(1).toUInt(&ok);
2668 event.m_originalairdate = QDate(y, 1, 1);
2669 event.m_description.remove(match.capturedStart(), match.capturedLength());
2673 event.m_description =
event.m_description.replace(
" .",
".").trimmed();
2676 static const QRegularExpression grCountry {
2677 R
"((?:\W|\b)(?:(ελλην|τουρκ|αμερικ[αά]ν|γαλλ|αγγλ|βρεττ?αν|γερμαν|ρωσσ?|ιταλ|ελβετ|σουηδ|ισπαν|πορτογαλ|μεξικ[αά]ν|κιν[εέ]ζικ|ιαπων|καναδ|βραζιλι[αά]ν)(ικ[ηή][ςσ])))",
2678 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2680 if (match.hasMatch())
2681 event.m_description.remove(match.capturedStart(), match.capturedLength());
2685 bool series =
false;
2686 static const QRegularExpression grSeason {
2687 R
"((?:\W-?)*(?:\(-\s*)?\b(([Α-Ω|A|B|E|Z|H|I|K|M|N]{1,2})(?:'|΄)?|(\d{1,2})(?:ος|ου|oς|os)?)(?:\s*[ΚκKk][υύ]κλο(?:[σς]|υ))\s?)",
2688 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2691 match = grSeason.match(event.
m_title);
2692 if (match.hasMatch())
2694 if (!match.capturedView(2).isEmpty())
2698 int tmpinteger = match.capturedView(2).toUInt();
2701 if (match.captured(2) ==
"ΣΤ")
2705 static const QString LettToNumber =
"0ΑΒΓΔΕ6ΖΗΘΙΚΛΜΝ";
2706 tmpinteger = LettToNumber.indexOf(match.capturedView(2));
2707 if (tmpinteger != -1)
2708 event.m_season = tmpinteger;
2712 static const QString LettToNumber2 =
"0ABΓΔE6ZHΘIKΛMN";
2713 tmpinteger = LettToNumber2.indexOf(match.capturedView(2));
2714 if (tmpinteger != -1)
2715 event.m_season = tmpinteger;
2720 else if (!match.capturedView(3).isEmpty())
2722 event.m_season = match.capturedView(3).toUInt();
2725 event.m_title.remove(match.capturedStart(), match.capturedLength());
2730 if (match.hasMatch())
2732 if (!match.capturedView(2).isEmpty())
2736 int tmpinteger = match.capturedView(2).toUInt();
2739 if (match.captured(2) ==
"ΣΤ")
2743 static const QString LettToNumber =
"0ΑΒΓΔΕ6ΖΗΘΙΚΛΜΝ";
2744 tmpinteger = LettToNumber.indexOf(match.capturedView(2));
2745 if (tmpinteger != -1)
2746 event.m_season = tmpinteger;
2750 else if (!match.capturedView(3).isEmpty())
2752 event.m_season = match.capturedView(3).toUInt();
2755 event.m_description.remove(match.capturedStart(), match.capturedLength());
2760 static const QRegularExpression grSeasonAsRomanNumerals {
",\\s*([MDCLXVIΙΧ]+)$",
2761 QRegularExpression::CaseInsensitiveOption };
2762 match = grSeasonAsRomanNumerals.match(event.
m_title);
2763 auto match2 = grSeasonAsRomanNumerals.match(event.
m_description);
2764 if (match.hasMatch())
2766 if (!match.capturedView(1).isEmpty())
2767 event.m_season =
parseRoman(match.captured(1).toUpper());
2769 event.m_title.remove(match.capturedStart(), match.capturedLength());
2770 event.m_title =
event.m_title.trimmed();
2771 if (event.
m_title.right(1) ==
",")
2772 event.m_title.chop(1);
2774 else if (match2.hasMatch())
2776 if (!match2.capturedView(1).isEmpty())
2777 event.m_season =
parseRoman(match2.captured(1).toUpper());
2779 event.m_description.remove(match2.capturedStart(), match2.capturedLength());
2780 event.m_description =
event.m_description.trimmed();
2782 event.m_description.chop(1);
2785 static const QRegularExpression grlongEp { R
"(\b(?:Επ.|επεισ[οό]διο:?)\s*(\d+)\W?)",
2786 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2788 match = grlongEp.match(event.
m_title);
2790 if (match.hasMatch() || match2.hasMatch())
2792 if (!match.capturedView(1).isEmpty())
2794 event.m_episode = match.capturedView(1).toUInt();
2796 event.m_title.remove(match.capturedStart(), match.capturedLength());
2798 else if (!match2.capturedView(1).isEmpty())
2800 event.m_episode = match2.capturedView(1).toUInt();
2802 event.m_description.remove(match2.capturedStart(), match2.capturedLength());
2813 static const QRegularExpression grCommentsinTitle { R
"(\(([Α-Ωα-ω\s\d-]+)\)(?:\s*$)*)" };
2816 match = grCommentsinTitle.match(event.
m_title);
2817 if (match.hasMatch())
2818 event.m_title.remove(match.capturedStart(), match.capturedLength());
2826 static const QRegularExpression grRealTitleInDescription { R
"(^\(([A-Za-z\s\d-]+)\)\s*)" };
2829 match = grRealTitleInDescription.match(event.
m_description);
2830 if (match.hasMatch())
2832 event.m_description.remove(0, match.capturedLength());
2833 if (match.captured(0) != event.
m_title.trimmed())
2835 event.m_description =
"(" +
event.m_title.trimmed() +
"). " +
event.m_description;
2837 event.m_title = match.captured(1);
2842 static const QRegularExpression grRealTitleInTitle { R
"(\(([A-Za-z\s\d-]+)\)(?:\s*$)?)" };
2845 match = grRealTitleInTitle.match(event.
m_title);
2846 if (match.hasMatch())
2848 event.m_title.remove(match.capturedStart(), match.capturedLength());
2849 QString tmpTranslTitle =
event.m_title;
2851 event.m_title = match.captured(1);
2852 event.m_description =
"(" + tmpTranslTitle.trimmed() +
"). " +
event.m_description;
2857 static const QRegularExpression grEpisodeAsSubtitle { R
"(^Επεισ[οό]διο:\s?([\w\s\-,']+)\.\s?)" };
2859 if (match.hasMatch())
2861 event.m_subtitle = match.captured(1).trimmed();
2862 event.m_description.remove(match.capturedStart(), match.capturedLength());
2864 static const QRegularExpression grMovie { R
"(\bταιν[ιί]α\b)",
2865 QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
2866 bool isMovie = (
event.m_description.indexOf(grMovie) !=-1) ;
2872 event.m_description.replace(
",,",
",");
2879 struct grCategoryEntry {
2880 QRegularExpression expr;
2883 static const QRegularExpression grCategFood {
"\\W?(?:εκπομπ[ηή]\\W)?(Γαστρονομ[ιί]α[σς]?|μαγειρικ[ηή][σς]?|chef|συνταγ[εέηή]|διατροφ|wine|μ[αά]γειρα[σς]?)\\W?",
2884 QRegularExpression::CaseInsensitiveOption };
2885 static const QRegularExpression grCategDrama {
"\\W?(κοινωνικ[ηήό]|δραματικ[ηή]|δρ[αά]μα)\\W(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2886 QRegularExpression::CaseInsensitiveOption};
2887 static const QRegularExpression grCategComedy {
"\\W?(κωμικ[ηήοό]|χιουμοριστικ[ηήοό]|κωμωδ[ιί]α)\\W(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2888 QRegularExpression::CaseInsensitiveOption};
2889 static const QRegularExpression grCategChildren {
"\\W?(παιδικ[ηήοό]|κινο[υύ]μ[εέ]ν(ων|α)\\sσχ[εέ]δ[ιί](ων|α))\\W(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2890 QRegularExpression::CaseInsensitiveOption};
2891 static const QRegularExpression grCategMystery {
"(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?\\W?(μυστηρ[ιί]ου)\\W?",
2892 QRegularExpression::CaseInsensitiveOption};
2893 static const QRegularExpression grCategFantasy {
"(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?\\W?(φαντασ[ιί]ας)\\W?",
2894 QRegularExpression::CaseInsensitiveOption};
2895 static const QRegularExpression grCategHistory {
"\\W?(ιστορικ[ηήοό])\\W?(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2896 QRegularExpression::CaseInsensitiveOption};
2897 static const QRegularExpression grCategTeleMag {
"\\W?(ενημερωτικ[ηή]|ψυχαγωγικ[ηή]|τηλεπεριοδικ[οό]|μαγκαζ[ιί]νο)\\W?(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2898 QRegularExpression::CaseInsensitiveOption};
2899 static const QRegularExpression grCategTeleShop {
"\\W?(οδηγ[οό][σς]?\\sαγορ[ωώ]ν|τηλεπ[ωώ]λ[ηή]σ|τηλεαγορ|τηλεμ[αά]ρκετ|telemarket)\\W?(?:(?:εκπομπ[ηή]|σειρ[αά]|ταιν[ιί]α)\\W)?",
2900 QRegularExpression::CaseInsensitiveOption};
2901 static const QRegularExpression grCategGameShow {
"\\W?(τηλεπαιχν[ιί]δι|quiz)\\W?",
2902 QRegularExpression::CaseInsensitiveOption};
2903 static const QRegularExpression grCategDocumentary {
"\\W?(ντοκ[ιυ]μαντ[εέ]ρ)\\W?",
2904 QRegularExpression::CaseInsensitiveOption};
2905 static const QRegularExpression grCategBiography {
"\\W?(βιογραφ[ιί]α|βιογραφικ[οό][σς]?)\\W?",
2906 QRegularExpression::CaseInsensitiveOption};
2907 static const QRegularExpression grCategNews {
"\\W?(δελτ[ιί]ο\\W?|ειδ[ηή]σε(ι[σς]|ων))\\W?",
2908 QRegularExpression::CaseInsensitiveOption};
2909 static const QRegularExpression grCategSports {
"\\W?(champion|αθλητικ[αάοόηή]|πρωτ[αά]θλημα|ποδ[οό]σφαιρο(ου)?|κολ[υύ]μβηση|πατιν[αά]ζ|formula|μπ[αά]σκετ|β[οό]λε[ιϊ])\\W?",
2910 QRegularExpression::CaseInsensitiveOption};
2911 static const QRegularExpression grCategMusic {
"\\W?(μουσικ[οόηή]|eurovision|τραγο[υύ]δι)\\W?",
2912 QRegularExpression::CaseInsensitiveOption};
2913 static const QRegularExpression grCategReality {
"\\W?(ρι[αά]λιτι|reality)\\W?",
2914 QRegularExpression::CaseInsensitiveOption};
2915 static const QRegularExpression grCategReligion {
"\\W?(θρησκε[ιί]α|θρησκευτικ|να[οό][σς]?|θε[ιί]α λειτουργ[ιί]α)\\W?",
2916 QRegularExpression::CaseInsensitiveOption};
2917 static const QRegularExpression grCategCulture {
"\\W?(τ[εέ]χν(η|ε[σς])|πολιτισμ)\\W?",
2918 QRegularExpression::CaseInsensitiveOption};
2919 static const QRegularExpression grCategNature {
"\\W?(φ[υύ]ση|περιβ[αά]λλο|κατασκευ|επιστ[ηή]μ(?!ονικ[ηή]ς φαντασ[ιί]ας))\\W?",
2920 QRegularExpression::CaseInsensitiveOption};
2921 static const QRegularExpression grCategSciFi {
"\\W?(επιστ(.|ημονικ[ηή]ς)\\s?φαντασ[ιί]ας)\\W?",
2922 QRegularExpression::CaseInsensitiveOption};
2923 static const QRegularExpression grCategHealth {
"\\W?(υγε[ιί]α|υγειιν|ιατρικ|διατροφ)\\W?",
2924 QRegularExpression::CaseInsensitiveOption};
2925 static const QRegularExpression grCategSpecial {
"\\W?(αφι[εέ]ρωμα)\\W?",
2926 QRegularExpression::CaseInsensitiveOption};
2927 static const QList<grCategoryEntry> grCategoryDescData = {
2928 { grCategComedy,
"Κωμωδία" },
2929 { grCategTeleMag,
"Τηλεπεριοδικό" },
2930 { grCategNature,
"Επιστήμη/Φύση" },
2931 { grCategHealth,
"Υγεία" },
2932 { grCategReality,
"Ριάλιτι" },
2933 { grCategDrama,
"Κοινωνικό" },
2934 { grCategChildren,
"Παιδικό" },
2935 { grCategSciFi,
"Επιστ.Φαντασίας" },
2936 { grCategMystery,
"Μυστηρίου" },
2937 { grCategFantasy,
"Φαντασίας" },
2938 { grCategHistory,
"Ιστορικό" },
2939 { grCategTeleShop,
"Τηλεπωλήσεις" },
2940 { grCategFood,
"Γαστρονομία" },
2941 { grCategGameShow,
"Τηλεπαιχνίδι" },
2942 { grCategBiography,
"Βιογραφία" },
2943 { grCategSports,
"Αθλητικά" },
2944 { grCategMusic,
"Μουσική" },
2945 { grCategDocumentary,
"Ντοκιμαντέρ" },
2946 { grCategReligion,
"Θρησκεία" },
2947 { grCategCulture,
"Τέχνες/Πολιτισμός" },
2948 { grCategSpecial,
"Αφιέρωμα" },
2950 static const QList<grCategoryEntry> grCategoryTitleData = {
2951 { grCategTeleShop,
"Τηλεπωλήσεις" },
2952 { grCategGameShow,
"Τηλεπαιχνίδι" },
2953 { grCategMusic,
"Μουσική" },
2954 { grCategNews,
"Ειδήσεις" },
2961 event.m_category =
"Φαντασίας/Μυστηρίου";
2966 for (
const auto& [expression, category] : grCategoryDescData)
2969 event.m_category = category;
2975 for (
const auto& [expression, category] : grCategoryTitleData)
2977 if (event.
m_title.indexOf(expression) != -1) {
2978 event.m_category = category;
2992 event.m_subtitle =
"";
2997 auto i =
event.m_items.begin();
2998 while (i != event.
m_items.end())
3002 if ((QString::compare (i.key(),
"Role Player") == 0) ||
3003 (QString::compare (i.key(),
"Performing Artist") == 0))
3006 i =
event.m_items.erase (i);
3008 else if (QString::compare (i.key(),
"Director") == 0)
3011 i =
event.m_items.erase (i);
3013 else if (QString::compare (i.key(),
"Commentary or Commentator") == 0)
3016 i =
event.m_items.erase (i);
3018 else if (QString::compare (i.key(),
"Presenter") == 0)
3021 i =
event.m_items.erase (i);
3023 else if (QString::compare (i.key(),
"Producer") == 0)
3026 i =
event.m_items.erase (i);
3028 else if (QString::compare (i.key(),
"Scriptwriter") == 0)
3031 i =
event.m_items.erase (i);
3040 static const QRegularExpression unitymediaImdbrating { R
"(\s*IMDb Rating: (\d\.\d)\s?/10$)" };
3041 auto match = unitymediaImdbrating.match(event.
m_description);
3042 if (match.hasMatch())
3044 float stars = match.captured(1).toFloat();
3045 event.m_stars = stars / 10.0F;
3046 event.m_description.remove(match.capturedStart(0),
3047 match.capturedLength(0));