summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY2
-rw-r--r--HISTORY.DE2
-rw-r--r--doc-src/en/epgsearch.4.txt7
-rw-r--r--epgsearchext.c19
-rw-r--r--epgsearchext.h1
-rw-r--r--epgsearchtools.c10
-rw-r--r--epgsearchtools.h1
-rw-r--r--searchtimer_thread.c1
8 files changed, 40 insertions, 3 deletions
diff --git a/HISTORY b/HISTORY
index 90c0fc6..57169b9 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3,6 +3,8 @@ VDR Plugin 'epgsearch' Revision History
2011-xx-xx; Version 1.0.1
new:
+- search timers are now processed by their descending timer priority. Search timers with the same priority
+ are sorted by their search term. Thanks to Anonym for providing a patch
- new bugtracker at http://projects.vdr-developer.org/projects/plg-epgsearch - thanks to Tobias Grimm
- dropped old code for vdr < 1.6.0, thanks to Ville Skyttä for whole pile of patches
- updated MainMenuHooks patch to 1.0.1
diff --git a/HISTORY.DE b/HISTORY.DE
index 5090083..f1a7d4f 100644
--- a/HISTORY.DE
+++ b/HISTORY.DE
@@ -3,6 +3,8 @@ VDR Plugin 'epgsearch' Revision History
2011-xx-xx: Version 1.0.1
neu:
+- Suchtimer werden jetzt anhand absteigender Timer-Priorität abgearbeitet. Bei
+ gleicher Priorität wird nach dem Suchbegriff sortiert. Danke an Anonym für den Patch.
- Neuer Bugtracker unter http://projects.vdr-developer.org/projects/plg-epgsearch - Danke an Tobias Grimm
- alten Code für vdr < 1.6.0 entfernt, Danke an Ville Skyttä für einen ganzen Haufen Patches
- MainMenuHooks-Patch auf 1.0.1 aktualisiert
diff --git a/doc-src/en/epgsearch.4.txt b/doc-src/en/epgsearch.4.txt
index d588d94..72628be 100644
--- a/doc-src/en/epgsearch.4.txt
+++ b/doc-src/en/epgsearch.4.txt
@@ -207,9 +207,10 @@ time, duration, week day) are checked.
=head1 4. How do Search Timers work?
-With each update, the plugin searches for new matches of your search
-timers. If a new match is found then a new timer is created. For
-serial recordings, the subtitle is appended to the recording
+With each update, the plugin first sorts the search timers by timer
+priority (descending) and search term and then searches for new matches
+of your search timers. If a new match is found then a new timer is created.
+For serial recordings, the subtitle is appended to the recording
directory. Many providers deliver the subtitle just 1-2 days before
the event. The plugin uses then a date/time string for the subtitle,
but replaces this one later if the subtitle is present.
diff --git a/epgsearchext.c b/epgsearchext.c
index 8f71241..ba58b3b 100644
--- a/epgsearchext.c
+++ b/epgsearchext.c
@@ -1663,6 +1663,25 @@ bool cSearchExts::CheckForAutoDelete(cSearchExt* SearchExt)
return delSearch;
}
+void cSearchExts::SortBy(int(*compar)(const void *, const void *))
+{
+ int n = Count();
+ cListObject *a[n];
+ cListObject *object = objects;
+ int i = 0;
+ while (object && i < n) {
+ a[i++] = object;
+ object = object->Next();
+ }
+ qsort(a, n, sizeof(cListObject *), compar);
+ objects = lastObject = NULL;
+ for (i = 0; i < n; i++) {
+ a[i]->Unlink();
+ count--;
+ Add(a[i]);
+ }
+}
+
cSearchResult::cSearchResult(const cEvent* Event, int searchID) : event(Event), blacklist(NULL), needsTimer(true)
{
search = SearchExts.GetSearchFromID(searchID);
diff --git a/epgsearchext.h b/epgsearchext.h
index 7303d66..cfdd131 100644
--- a/epgsearchext.h
+++ b/epgsearchext.h
@@ -234,6 +234,7 @@ public:
bool Exists(const cSearchExt* SearchExt);
cSearchExts* Clone();
bool CheckForAutoDelete(cSearchExt* SearchExt);
+ void SortBy(int(*compar)(const void *, const void *));
};
extern cSearchExts SearchExts;
diff --git a/epgsearchtools.c b/epgsearchtools.c
index c2cfb1b..e1b7fd7 100644
--- a/epgsearchtools.c
+++ b/epgsearchtools.c
@@ -76,6 +76,16 @@ int CompareEventChannel(const void *p1, const void *p2)
return ch1 - ch2;
}
+int CompareSearchExtPrioDescTerm(const void *p1, const void *p2)
+{
+ int prio1 = (*(cSearchExt **)p1)->Priority;
+ int prio2 = (*(cSearchExt **)p2)->Priority;
+ if (prio2 != prio1)
+ return prio2 - prio1;
+ else
+ return strcmp((*(cSearchExt **)p1)->search, (*(cSearchExt **)p2)->search);
+}
+
char* IndentMenuItem(const char* szString, int indentions)
{
char* szIndented = NULL;
diff --git a/epgsearchtools.h b/epgsearchtools.h
index 1220cda..2ad1d35 100644
--- a/epgsearchtools.h
+++ b/epgsearchtools.h
@@ -151,6 +151,7 @@ char* GetRawDescription(const char* descr);
void PrepareTimerFile(const cEvent* event, cTimer* timer);
int CompareEventTime(const void *p1, const void *p2);
int CompareEventChannel(const void *p1, const void *p2);
+int CompareSearchExtPrioDescTerm(const void *p1, const void *p2);
bool EventsMatch(const cEvent* event1, const cEvent* event2, bool compareTitle, int compareSubtitle, bool compareSummary, int compareDate, unsigned long catvaluesAvoidRepeat, int matchLimit=90);
int ChannelNrFromEvent(const cEvent* pEvent);
void DelTimer(int index);
diff --git a/searchtimer_thread.c b/searchtimer_thread.c
index cd73cae..af67988 100644
--- a/searchtimer_thread.c
+++ b/searchtimer_thread.c
@@ -241,6 +241,7 @@ void cSearchTimerThread::Action(void)
// for thread safeness we work with a copy of the current searches,
// because SVDRP would not work if the main thread would be locked
cSearchExts* localSearchExts = SearchExts.Clone();
+ localSearchExts->SortBy(CompareSearchExtPrioDescTerm);
cSearchExt *searchExt = localSearchExts->First();
// reset announcelist
announceList.Clear();