From 9b84e128ddebfbd003dd9fc52e4ebd432860aec1 Mon Sep 17 00:00:00 2001 From: bittor7x0 <76845083+bittor7x0@users.noreply.github.com> Date: Sun, 28 Jan 2024 18:05:35 +0100 Subject: [PATCH] [vdr-plugin] Add backported changes for EPGSearch Git snapshot --- vdr-m7x0-plugins/epgsearch-git/HISTORY | 19 ++++++ vdr-m7x0-plugins/epgsearch-git/HISTORY.DE | 20 +++++++ vdr-m7x0-plugins/epgsearch-git/Makefile | 4 -- vdr-m7x0-plugins/epgsearch-git/README.m7x0 | 4 +- .../epgsearch-git/conflictcheck.c | 1 + vdr-m7x0-plugins/epgsearch-git/epgsearch.c | 2 +- vdr-m7x0-plugins/epgsearch-git/epgsearchext.c | 24 ++------ .../epgsearch-git/i18n-generated.h | 2 +- vdr-m7x0-plugins/epgsearch-git/menu_whatson.c | 5 +- vdr-m7x0-plugins/epgsearch-git/po/de_DE.po | 2 +- .../epgsearch-git/searchtimer_thread.c | 60 ++++++++++++++++++- .../epgsearch-git/searchtimer_thread.h | 2 + 12 files changed, 116 insertions(+), 29 deletions(-) diff --git a/vdr-m7x0-plugins/epgsearch-git/HISTORY b/vdr-m7x0-plugins/epgsearch-git/HISTORY index ea4e41fdb..c5921a281 100644 --- a/vdr-m7x0-plugins/epgsearch-git/HISTORY +++ b/vdr-m7x0-plugins/epgsearch-git/HISTORY @@ -1,5 +1,24 @@ VDR Plugin 'epgsearch' Revision History --------------------------------------- +2023-06-08 +fixes: +- removed subtitle limit (firefly) +- fix title containing more than one colon (firefly) + +2023-05-28 +fixes: +- Changed wenig to Wenig in German messages +- Avoid division by zero if StopTime-Starttime=0 + +2023-01-09; Version 2.4.2 +new: +- Use perlregex-library pcre2 if available +fixes: +- timers not marked as done if 2 recordings stop same time +- remove dead code +- update spanish translation +- fix memory leaks +- do not lose recordingtime at change to winter time (kfb77) 2022-02-01 new: diff --git a/vdr-m7x0-plugins/epgsearch-git/HISTORY.DE b/vdr-m7x0-plugins/epgsearch-git/HISTORY.DE index 2ccaf9977..4a18525cc 100644 --- a/vdr-m7x0-plugins/epgsearch-git/HISTORY.DE +++ b/vdr-m7x0-plugins/epgsearch-git/HISTORY.DE @@ -1,5 +1,25 @@ VDR Plugin 'epgsearch' Revision History --------------------------------------- +2023-06-08 +fixes: +- Begrenzung Untertitellänge aufgehoben (firefly) +- Titel kann mehrere : enthalten (firefly) + +2023-05-28 +fixes: +- deutsche Messages Satzanfang gross +- Vermeide Division durch Null wenn Stopzeit-Startzeit=0 + +2023-01-09; Version 2.4.2 +neu: +- Nutze perlregex-library pcre2 falls installiert +fixes: +- timer wieder als done markiert wenn 2 Aufnahmen gleichzeitig aufhören +- toten Code entfernt +- Update spanische Ãœbersetzung +- Speicherlecks gestopft +- Ausreichend Zeitpuffer für Aufnahmen ohne VPS bei Umstellung + auf Winterzeit (kfb77) 2022-02-01 neu: diff --git a/vdr-m7x0-plugins/epgsearch-git/Makefile b/vdr-m7x0-plugins/epgsearch-git/Makefile index fbe047700..ea0e75bc0 100644 --- a/vdr-m7x0-plugins/epgsearch-git/Makefile +++ b/vdr-m7x0-plugins/epgsearch-git/Makefile @@ -167,10 +167,6 @@ ifdef DEBUG_CONFL DEFINES += -DDEBUG_CONFL endif -ifdef PLUGIN_EPGSEARCH_MAX_SUBTITLE_LENGTH -DEFINES += -DMAX_SUBTITLE_LENGTH='$(PLUGIN_EPGSEARCH_MAX_SUBTITLE_LENGTH)' -endif - ### length of the filling '-' in the channel separators, defaults to ### "----------------------------------------" ### overwrite this with PLUGIN_EPGSEARCH_SEP_ITEMS=--- in your Make.config diff --git a/vdr-m7x0-plugins/epgsearch-git/README.m7x0 b/vdr-m7x0-plugins/epgsearch-git/README.m7x0 index b17cc22ac..0374bcbb8 100644 --- a/vdr-m7x0-plugins/epgsearch-git/README.m7x0 +++ b/vdr-m7x0-plugins/epgsearch-git/README.m7x0 @@ -1,4 +1,4 @@ This version is based in git revision: -a868a52e89caa0e3f099eb6875c8cfe4cd2a6ac7 +696a99bb2cc651557515810f87477360ea1dde94 -https://github.com/vdr-projects/vdr-plugin-epgsearch/commit/a868a52e89caa0e3f099eb6875c8cfe4cd2a6ac7 +https://github.com/vdr-projects/vdr-plugin-epgsearch/commit/696a99bb2cc651557515810f87477360ea1dde94 diff --git a/vdr-m7x0-plugins/epgsearch-git/conflictcheck.c b/vdr-m7x0-plugins/epgsearch-git/conflictcheck.c index b823fe3b6..e92c0a4f0 100644 --- a/vdr-m7x0-plugins/epgsearch-git/conflictcheck.c +++ b/vdr-m7x0-plugins/epgsearch-git/conflictcheck.c @@ -266,6 +266,7 @@ cList* cConflictCheck::CreateCurrentTimerList() for (ti = Timers.First(); ti; ti = Timers.Next(ti)) { tMax = std::max(tMax, ti->StartTime()); + if (ti->StopTime() - ti->StartTime() == 0) continue; // avoid division by zero in computing recPart if (!ti->IsSingleEvent()) continue; // already recording? int deviceNr = gl_recStatusMonitor->TimerRecDevice(ti)-1; diff --git a/vdr-m7x0-plugins/epgsearch-git/epgsearch.c b/vdr-m7x0-plugins/epgsearch-git/epgsearch.c index 5c23ebb08..077ea90c9 100644 --- a/vdr-m7x0-plugins/epgsearch-git/epgsearch.c +++ b/vdr-m7x0-plugins/epgsearch-git/epgsearch.c @@ -72,7 +72,7 @@ The project's page is at http://winni.vdr-developer.org/epgsearch #include "confdloader.h" #include "pending_notifications.h" -static const char VERSION[] = "2.4.1"; +static const char VERSION[] = "2.4.2"; static const char DESCRIPTION[] = trNOOP("search the EPG for repeats and more"); // globals diff --git a/vdr-m7x0-plugins/epgsearch-git/epgsearchext.c b/vdr-m7x0-plugins/epgsearch-git/epgsearchext.c index eecf18197..babe9a0ec 100644 --- a/vdr-m7x0-plugins/epgsearch-git/epgsearchext.c +++ b/vdr-m7x0-plugins/epgsearch-git/epgsearchext.c @@ -42,10 +42,6 @@ The project's page is at http://winni.vdr-developer.org/epgsearch cSearchExts SearchExts; cSearchExts SearchTemplates; -#ifndef MAX_SUBTITLE_LENGTH - #define MAX_SUBTITLE_LENGTH 40 -#endif - // -- cSearchExt ----------------------------------------------------------------- char *cSearchExt::buffer = NULL; @@ -661,27 +657,19 @@ char* cSearchExt::BuildFile(const cEvent* pEvent) const if (!pEvent) return file; - const char *Subtitle = pEvent->ShortText(); - char SubtitleBuffer[Utf8BufSize(MAX_SUBTITLE_LENGTH)]; - if (isempty(Subtitle)) + const char *ShortText = pEvent->ShortText(); + if (isempty(ShortText)) { + char ShortTextBuffer[Utf8BufSize(40)]; time_t Start = pEvent->StartTime(); struct tm tm_r; - strftime(SubtitleBuffer, sizeof(SubtitleBuffer), "%Y.%m.%d-%R-%a", localtime_r(&Start, &tm_r)); - Subtitle = SubtitleBuffer; - } - else if (Utf8StrLen(Subtitle) > MAX_SUBTITLE_LENGTH) - { - Utf8Strn0Cpy(SubtitleBuffer, Subtitle, sizeof(SubtitleBuffer)); -#if APIVERSNUM >= 10503 - SubtitleBuffer[Utf8SymChars(SubtitleBuffer, MAX_SUBTITLE_LENGTH)] = 0; -#endif - Subtitle = SubtitleBuffer; + strftime(ShortTextBuffer, sizeof(ShortTextBuffer), "%Y.%m.%d-%R-%a", localtime_r(&Start, &tm_r)); + ShortText = ShortTextBuffer; } if (useEpisode) { - cString pFile = cString::sprintf("%s~%s", pEvent->Title(), Subtitle); + cString pFile = cString::sprintf("%s~%s", pEvent->Title(), ShortText); file = strdup(pFile); } else if (pEvent->Title()) diff --git a/vdr-m7x0-plugins/epgsearch-git/i18n-generated.h b/vdr-m7x0-plugins/epgsearch-git/i18n-generated.h index daaffbc66..61523209b 100644 --- a/vdr-m7x0-plugins/epgsearch-git/i18n-generated.h +++ b/vdr-m7x0-plugins/epgsearch-git/i18n-generated.h @@ -13684,7 +13684,7 @@ const tI18nPhrase Phrases[] = { #endif }, { "small EPG content on:%s", - "wenig EPG Inhalt für:%s", + "Wenig EPG Inhalt für:%s", "", "", "", diff --git a/vdr-m7x0-plugins/epgsearch-git/menu_whatson.c b/vdr-m7x0-plugins/epgsearch-git/menu_whatson.c index 9f8ca81fd..7fd01d197 100644 --- a/vdr-m7x0-plugins/epgsearch-git/menu_whatson.c +++ b/vdr-m7x0-plugins/epgsearch-git/menu_whatson.c @@ -200,7 +200,10 @@ bool cMenuMyScheduleItem::Update(bool Force) strreplace(buffer, '|', '\t'); char* title = NULL; - title = strreplacei(strdup((event && event->Title()) ? event->Title() : tr(">>> no info! <<<")), ":", "%colon%"); // assume a title has the form "a?b:c", + title = strdup((event && event->Title()) ? event->Title() : tr(">>> no info! <<<")); + + while ( strchr(title, ':') != NULL ) + title = strreplacei(title, ":", "%colon%"); // assume a title has the form "a?b:c", // we need to replace the colon to avoid misinterpretation of the expression as a condition buffer = strreplacei(buffer, "%title%", title); free(title); diff --git a/vdr-m7x0-plugins/epgsearch-git/po/de_DE.po b/vdr-m7x0-plugins/epgsearch-git/po/de_DE.po index 0c3b0df8f..a81b8bf37 100644 --- a/vdr-m7x0-plugins/epgsearch-git/po/de_DE.po +++ b/vdr-m7x0-plugins/epgsearch-git/po/de_DE.po @@ -1291,7 +1291,7 @@ msgstr "Suchtimer-Update durchgef #, c-format msgid "small EPG content on:%s" -msgstr "wenig EPG Inhalt für:%s" +msgstr "Wenig EPG Inhalt für:%s" msgid "VDR EPG check warning" msgstr "VDR EPG Check Warnung" diff --git a/vdr-m7x0-plugins/epgsearch-git/searchtimer_thread.c b/vdr-m7x0-plugins/epgsearch-git/searchtimer_thread.c index 9008d3861..40386ef08 100644 --- a/vdr-m7x0-plugins/epgsearch-git/searchtimer_thread.c +++ b/vdr-m7x0-plugins/epgsearch-git/searchtimer_thread.c @@ -98,6 +98,45 @@ void cSearchTimerThread::Stop(void) { Cancel(6); } +void cSearchTimerThread::FixSummerWinterStartTime(const char* text, time_t* time) { +// bring timer and events start out of the double hour from sommertime to wintertime +// if timer or event starts in the last hour of the summertime, subtract 1h + time_t time_tmp = *time +60*60; +// LogFile.Log(2,"time %d", *time); +// LogFile.Log(2,"time_tmp %d", time_tmp); + if ( localtime(time)->tm_hour == localtime(&time_tmp)->tm_hour ) { + LogFile.Log(2, "time from %s starts in the last hour of summetime, subtract 1h", text); + *time = *time - 60*60; +// LogFile.Log(2,"time %d", *time); + } else { +// if timer or event starts in the first hour after wintertime begins, subtract 2h + time_tmp = *time -60*60; + if ( localtime(time)->tm_hour == localtime(&time_tmp)->tm_hour ) { + LogFile.Log(2, "time from %s starts in the first hour of wintertime, subtract 2h", text); + *time = *time - 2*60*60; + } + } +} + +void cSearchTimerThread::FixSummerWinterStopTime(const char* text, time_t* time) { +// bring timer and events stop out of the double hour from sommertime to wintertime +// if timer or event ends in the last hour of the summertime, add 2h + time_t time_tmp = *time +60*60; +// LogFile.Log(2,"time %d", *time); +// LogFile.Log(2,"time_tmp %d", time_tmp); + if ( localtime(time)->tm_hour == localtime(&time_tmp)->tm_hour ) { + LogFile.Log(2, "time from %s ends in the last hour of summetime, add 2h", text); + *time = *time + 2*60*60; +// LogFile.Log(2,"time %d", *time); + } else { +// if timer or event ends in the first hour after wintertime begins, add 1h + time_tmp = *time -60*60; + if ( localtime(time)->tm_hour == localtime(&time_tmp)->tm_hour ) { + LogFile.Log(2, "time from %s ends in the first hour of wintertime, add 1h", text); + *time = *time + 60*60; + } + } +} cTimer *cSearchTimerThread::GetTimer(cSearchExt *searchExt, const cEvent *pEvent, bool& bTimesMatchExactly) { @@ -157,9 +196,21 @@ cTimer *cSearchTimerThread::GetTimer(cSearchExt *searchExt, const cEvent *pEvent { time_t tStart = ti->StartTime() + searchExt->MarginStart * 60; time_t tStop = ti->StopTime() - searchExt->MarginStop * 60; + tm *tmStartTi = localtime_r(&tStart, &tm_r); if (tmStartEv->tm_mday != tmStartTi->tm_mday) continue; + if (!UseVPS) { + eStart = eStart - searchExt->MarginStart * 60; // event - MarginStart can be before summertime to wintertime double hour + FixSummerWinterStartTime(pEvent->Title(), &eStart); + eStart = eStart + searchExt->MarginStart * 60; + + eStop = eStop + searchExt->MarginStop * 60; // event + MarginStop can be after summertime to wintertime double hour + FixSummerWinterStopTime(pEvent->Title(), &eStop); + eStop = eStop - searchExt->MarginStop * 60; + } +// LogFile.Log(2,"eStop %d", eStop); +// LogFile.Log(2,"eStop %d", eStop); // some providers change EPG times only for a few seconds // ignore this to avoid search timer mails because of such changes @@ -184,7 +235,9 @@ bool cSearchTimerThread::TimerWasModified(cTimer* t) { time_t StartTime = time_t(atol(start)); time_t StopTime = time_t(atol(stop)); - if (abs(t->StartTime() - StartTime) >= 60 || abs(t->StopTime() -StopTime) >= 60) + FixSummerWinterStartTime(t->File(), &StartTime); + FixSummerWinterStopTime(t->File(), &StopTime); + if (abs(t->StartTime() - StartTime) >= 60 || abs(t->StopTime() - StopTime) >= 60) bMod = true; } if (start) free(start); @@ -673,13 +726,18 @@ bool cSearchTimerThread::AddModTimer(cTimer* Timer, int index, cSearchExt* searc time_t start = eStart - (searchExt->MarginStart * 60); time_t stop = eStop + (searchExt->MarginStop * 60); int Flags = Timer->Flags(); + if (searchExt->useVPS && pEvent->Vps() && Setup.UseVps) { start = pEvent->Vps(); stop = start + pEvent->Duration(); } else + { Flags &= ~tfVps; // don't use VPS, if not set in this search + FixSummerWinterStartTime(Timer->File(), &start); + FixSummerWinterStopTime(Timer->File(), &stop); + } // already done the same timer? if (!EPGSearchConfig.TimerProgRepeat && index == 0 && TimersDone.InList(start, stop, pEvent, -1)) diff --git a/vdr-m7x0-plugins/epgsearch-git/searchtimer_thread.h b/vdr-m7x0-plugins/epgsearch-git/searchtimer_thread.h index 91476ac6c..bb7b27819 100644 --- a/vdr-m7x0-plugins/epgsearch-git/searchtimer_thread.h +++ b/vdr-m7x0-plugins/epgsearch-git/searchtimer_thread.h @@ -57,6 +57,8 @@ class cSearchTimerThread: public cThread { void Stop(void); bool NeedUpdate(); bool TimerWasModified(cTimer* t); + static void FixSummerWinterStartTime(const char* text, time_t* time); + static void FixSummerWinterStopTime(const char* text, time_t* time); public: static cSearchResults announceList; static char* SummaryExtended(cSearchExt* searchExt, cTimer* Timer, const cEvent* pEvent);