Skip to content

Commit

Permalink
[vdr-plugin] Add backported changes for EPGSearch Git snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
bittor7x0 committed Jan 28, 2024
1 parent ff3c7a9 commit 9b84e12
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 29 deletions.
19 changes: 19 additions & 0 deletions vdr-m7x0-plugins/epgsearch-git/HISTORY
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
20 changes: 20 additions & 0 deletions vdr-m7x0-plugins/epgsearch-git/HISTORY.DE
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 0 additions & 4 deletions vdr-m7x0-plugins/epgsearch-git/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions vdr-m7x0-plugins/epgsearch-git/README.m7x0
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions vdr-m7x0-plugins/epgsearch-git/conflictcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ cList<cConflictCheckTimerObj>* 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;
Expand Down
2 changes: 1 addition & 1 deletion vdr-m7x0-plugins/epgsearch-git/epgsearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 6 additions & 18 deletions vdr-m7x0-plugins/epgsearch-git/epgsearchext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion vdr-m7x0-plugins/epgsearch-git/i18n-generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"",
"",
"",
Expand Down
5 changes: 4 additions & 1 deletion vdr-m7x0-plugins/epgsearch-git/menu_whatson.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion vdr-m7x0-plugins/epgsearch-git/po/de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
60 changes: 59 additions & 1 deletion vdr-m7x0-plugins/epgsearch-git/searchtimer_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 2 additions & 0 deletions vdr-m7x0-plugins/epgsearch-git/searchtimer_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9b84e12

Please sign in to comment.