From be9c683e1bb190de3f52238bd698a3d90f6d1a97 Mon Sep 17 00:00:00 2001 From: Midas Date: Mon, 9 Aug 2010 04:33:36 +0200 Subject: Renewed dev branch to 0.0.4. Added blacklist sorting. --- block.c | 3 ++- event.c | 6 +++--- event.h | 11 ++++++++++- setup.c | 2 ++ status.c | 1 - 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/block.c b/block.c index be5c1ea..abf54fa 100644 --- a/block.c +++ b/block.c @@ -21,7 +21,7 @@ #include "common.h" #include -static const char *VERSION = "0.0.4"; +static const char *VERSION = "0.0.4+201008090412"; static const char *DESCRIPTION = trNOOP("Block unwanted shows by EPG title"); static const char *MAINMENUENTRY = trNOOP("(De)Block broadcast"); @@ -96,6 +96,7 @@ cOsdObject *cPluginBlock::MainMenuAction(void) if (EventsBlock.Acceptable(present->Title())) { EventsBlock.Add(new cEventBlock(present->Title())); + EventsBlock.Sort(); EventsBlock.Save(); } else diff --git a/event.c b/event.c index 4ec0b47..5e7fb80 100644 --- a/event.c +++ b/event.c @@ -9,7 +9,7 @@ #include -static char *duptolower(const char *s) { +char* cEventBlock::duptolower(const char *s) { char *c = strdup(s); char *p = c; for (; *p; ++p) @@ -65,8 +65,8 @@ bool cEventBlock::Acceptable(const char *Event) const if (mRegularExp) return regexec(&mExpression, Event, 0, NULL, 0) != 0; else if (mIgnoreCase) { - char *ev = duptolower(Event); - char *pa = duptolower(mPattern); + char *ev = cEventBlock::duptolower(Event); + char *pa = cEventBlock::duptolower(mPattern); printf("check for %s in %s\n", pa, ev); bool res = strstr(ev, pa) == NULL; free(ev); free(pa); diff --git a/event.h b/event.h index a205aab..bd8fa09 100644 --- a/event.h +++ b/event.h @@ -42,8 +42,17 @@ public: bool Save(FILE *f); static const char *LastTitle; static const bool *ReplayingRecording; - + + static char *duptolower(const char*); + const char *Pattern(void) const { return mPattern; } + + virtual int Compare(const cListObject &src) const + { + cEventBlock* rhs=(cEventBlock*)&src; + char* l=cEventBlock::duptolower(mPattern); + char* r=cEventBlock::duptolower(rhs->mPattern); + return strcmp(l,r); } }; class cEventsBlock : public cConfig { diff --git a/setup.c b/setup.c index 359e633..0b3eab2 100644 --- a/setup.c +++ b/setup.c @@ -80,6 +80,7 @@ void cMenuSetupBlock::SetHelpKeys(void) void cMenuSetupBlock::Store(void) { EventsBlock = mEventsData; + EventsBlock.Sort(); EventsBlock.Save(); SetupBlock = mSetupData; @@ -192,5 +193,6 @@ eOSState cMenuSetupEditBlock::ProcessKey(eKeys Key) break; } } + EventsBlock.Sort(); return state; } diff --git a/status.c b/status.c index 0a0ae22..bdc0a4b 100644 --- a/status.c +++ b/status.c @@ -20,7 +20,6 @@ cStatusBlock::cStatusBlock(void): void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) { int current_channel=cDevice::CurrentChannel(); - int device_number=Device->DeviceNumber(); if (cSetupBlock::LastChannel==0) { -- cgit v1.2.3