Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > adc71b89727e16d9b88f5dd238a4d4c5 > files > 27

vdr-1.6.0-17mdv2010.1.src.rpm

#! /bin/sh /usr/share/dpatch/dpatch-run
## opt-39_noepg.dpatch from version the vdr-noepgmenu plugin 0.0.6.beta3
## http://winni.vdr-developer.org/noepgmenu/downloads/beta
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: The patch allows to disable normal epg update for specified channels.
## DP: This is useful if you get epg data of the channels from external sources.

@DPATCH@
diff -p -up vdr-1.6.0/config.c.orig vdr-1.6.0/config.c
--- vdr-1.6.0/config.c.orig	2009-07-25 21:25:34.210092383 +0300
+++ vdr-1.6.0/config.c	2009-07-25 21:25:34.324136004 +0300
@@ -299,11 +299,20 @@ cSetup::cSetup(void)
   ShowRecLength = 0;
   ShowProgressBar = 0;
   MenuCmdPosition = 0;
+  noEPGMode=0;
+  noEPGList=strdup("");
+}
+
+cSetup::~cSetup()
+{
+  free(noEPGList);
 }
 
 cSetup& cSetup::operator= (const cSetup &s)
 {
   memcpy(&__BeginData__, &s.__BeginData__, (char *)&s.__EndData__ - (char *)&s.__BeginData__);
+  free(noEPGList);
+  noEPGList = strdup(s.noEPGList);
   return *this;
 }
 
@@ -503,6 +512,11 @@ bool cSetup::Parse(const char *Name, con
   else if (!strcasecmp(Name, "FontOsdSize"))         FontOsdSize        = atoi(Value);
   else if (!strcasecmp(Name, "FontSmlSize"))         FontSmlSize        = atoi(Value);
   else if (!strcasecmp(Name, "FontFixSize"))         FontFixSize        = atoi(Value);
+  else if (!strcasecmp(Name, "noEPGMode"))           noEPGMode          = atoi(Value);
+  else if (!strcasecmp(Name, "noEPGList")) {
+    free(noEPGList);
+    noEPGList=strdup(Value ? Value : "");
+  }
   else if (!strcasecmp(Name, "MaxVideoFileSize"))    MaxVideoFileSize   = atoi(Value);
   else if (!strcasecmp(Name, "SplitEditedFiles"))    SplitEditedFiles   = atoi(Value);
   else if (!strcasecmp(Name, "MinEventTimeout"))     MinEventTimeout    = atoi(Value);
@@ -590,6 +604,8 @@ bool cSetup::Save(void)
   Store("FontOsd",            FontOsd);
   Store("FontSml",            FontSml);
   Store("FontFix",            FontFix);
+  Store("noEPGMode",          noEPGMode);
+  Store("noEPGList",          noEPGList);
   Store("FontOsdSize",        FontOsdSize);
   Store("FontSmlSize",        FontSmlSize);
   Store("FontFixSize",        FontFixSize);
diff -p -up vdr-1.6.0/config.h.orig vdr-1.6.0/config.h
--- vdr-1.6.0/config.h.orig	2009-07-25 21:25:34.212091976 +0300
+++ vdr-1.6.0/config.h	2009-07-25 21:25:34.326091679 +0300
@@ -271,6 +271,7 @@ public:
   int FontOsdSize;
   int FontSmlSize;
   int FontFixSize;
+  int noEPGMode;
   int MaxVideoFileSize;
   int SplitEditedFiles;
   int MinEventTimeout, MinUserInactivity;
@@ -286,7 +287,9 @@ public:
   int EmergencyExit;
   int ShowRecDate, ShowRecTime, ShowRecLength, ShowProgressBar, MenuCmdPosition;
   int __EndData__;
+  char *noEPGList; // pointer not to be flat-copied
   cSetup(void);
+  ~cSetup();
   cSetup& operator= (const cSetup &s);
   bool Load(const char *FileName);
   bool Save(void);
diff -p -up vdr-1.6.0/eit.c.orig vdr-1.6.0/eit.c
--- vdr-1.6.0/eit.c.orig	2009-07-25 21:22:30.214093757 +0300
+++ vdr-1.6.0/eit.c	2009-07-25 21:25:34.328091792 +0300
@@ -22,8 +22,28 @@
 class cEIT : public SI::EIT {
 public:
   cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bool OnlyRunningStatus = false);
+
+private:
+  bool allowedEPG(tChannelID kanalID);
   };
 
+bool cEIT::allowedEPG(tChannelID kanalID) {
+  bool rc;
+
+  if (Setup.noEPGMode == 1) {
+     rc=false;
+     if (strstr(::Setup.noEPGList,kanalID.ToString())!=NULL)
+        rc=true;
+     }
+  else {
+     rc=true;
+     if (strstr(::Setup.noEPGList,kanalID.ToString())!=NULL)
+        rc=false;
+     }
+
+  return rc;
+}
+
 cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data, bool OnlyRunningStatus)
 :SI::EIT(Data, false)
 {
@@ -35,6 +55,12 @@ cEIT::cEIT(cSchedules *Schedules, int So
   if (!channel)
      return; // only collect data for known channels
 
+  // only use epg from channels not blocked by noEPG-patch
+  tChannelID kanalID;
+  kanalID=channel->GetChannelID();
+  if (!allowedEPG(kanalID))
+    return;
+
   cSchedule *pSchedule = (cSchedule *)Schedules->GetSchedule(channel, true);
 
   bool Empty = true;
diff -p -up vdr-1.6.0/menu.c.orig vdr-1.6.0/menu.c
--- vdr-1.6.0/menu.c.orig	2009-07-25 21:25:33.741841349 +0300
+++ vdr-1.6.0/menu.c	2009-07-25 21:27:58.241092850 +0300
@@ -2625,6 +2625,7 @@ eOSState cMenuSetupOSD::ProcessKey(eKeys
 
 class cMenuSetupEPG : public cMenuSetupBase {
 private:
+  const char *noEPGModes[2];
   int originalNumLanguages;
   int numLanguages;
   void Setup(void);
@@ -2648,6 +2649,9 @@ void cMenuSetupEPG::Setup(void)
 {
   int current = Current();
 
+  noEPGModes[0]=tr("Blacklist");
+  noEPGModes[1]=tr("Whitelist");
+
   Clear();
 
   Add(new cMenuEditIntItem( tr("Setup.EPG$EPG scan timeout (h)"),      &data.EPGScanTimeout));
@@ -2662,6 +2666,7 @@ void cMenuSetupEPG::Setup(void)
   for (int i = 0; i < numLanguages; i++)
       // TRANSLATORS: note the singular!
       Add(new cMenuEditStraItem(tr("Setup.EPG$Preferred language"),    &data.EPGLanguages[i], I18nLanguages()->Size(), &I18nLanguages()->At(0)));
+  Add(new cMenuEditStraItem(tr("Setup.EPG$Mode noEPG-Patch"),          &data.noEPGMode, 2, noEPGModes));
 
   SetCurrent(Get(current));
   Display();