release 0.0.2 trunk 0.0.2
authornathan
Sat, 29 Dec 2007 11:18:14 +0100
branchtrunk
changeset 23562cacb3b0b
parent 1 b933889f428a
child 3 8ba179855ee2
release 0.0.2
HISTORY
Makefile
README
premiereepg.c
     1.1 --- a/HISTORY	Sat Dec 29 11:17:41 2007 +0100
     1.2 +++ b/HISTORY	Sat Dec 29 11:18:14 2007 +0100
     1.3 @@ -1,6 +1,12 @@
     1.4  VDR Plugin 'premiereepg' Revision History
     1.5  -----------------------------------------
     1.6  
     1.7 +31.07.2005: Version 0.0.2
     1.8 +- Added plugin setup menu.
     1.9 +- Added setup option to select different tagging styles for option events.
    1.10 +
    1.11 +24.07.2005: Version 0.0.1a
    1.12 +- Fixed compiling issue with vdr 1.3.25+
    1.13 +
    1.14  24.07.2005: Version 0.0.1
    1.15 -
    1.16  - Initial release.
     2.1 --- a/Makefile	Sat Dec 29 11:17:41 2007 +0100
     2.2 +++ b/Makefile	Sat Dec 29 11:18:14 2007 +0100
     2.3 @@ -63,6 +63,10 @@
     2.4  
     2.5  OBJS = $(PLUGIN).o
     2.6  
     2.7 +ifdef DBG
     2.8 +CXXFLAGS += -g
     2.9 +endif
    2.10 +
    2.11  ### Implicit rules:
    2.12  
    2.13  %.o: %.c
    2.14 @@ -91,7 +95,7 @@
    2.15  	@cp -a * $(TMPDIR)/$(ARCHIVE)
    2.16  	@tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
    2.17  	@-rm -rf $(TMPDIR)/$(ARCHIVE)
    2.18 -	@echo Distribution package created as $(PACKAGE).tgz
    2.19 +	@echo Distribution package created as $(PACKAGE).tar.gz
    2.20  
    2.21  clean:
    2.22 -	@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
    2.23 +	@-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~
     3.1 --- a/README	Sat Dec 29 11:17:41 2007 +0100
     3.2 +++ b/README	Sat Dec 29 11:18:14 2007 +0100
     3.3 @@ -1,7 +1,7 @@
     3.4  
     3.5  This is the PremiereEpg plugin for VDR.
     3.6  
     3.7 -It parses the extended EPG data which is send by Premiere on their option
     3.8 +It parses the extended EPG data which is send by Premiere on their portal
     3.9  channels.
    3.10  
    3.11  Written by:                  Stefan Hülswitt <s.huelswitt@gmx.de>
    3.12 @@ -13,8 +13,8 @@
    3.13  ----------------------------------------------------------------------
    3.14  
    3.15  This plugin parses the extended EPG data which is send by Premiere on their
    3.16 -option channels. The EPG data is transmitted in a non-standard format on a
    3.17 -non-standard PID.
    3.18 +portal channels (e.g. SPORT PORTAL). This EPG data is transmitted in a
    3.19 +non-standard format on a non-standard PID.
    3.20  
    3.21  This work is based on the premiereepg2vdr commandline tool, which was written
    3.22  by Axel Katzur software@katzur.de.
    3.23 @@ -24,12 +24,15 @@
    3.24  Note: the EPG entries created with this plugin aren't fully compatible with
    3.25  entries created by premiereepg2vdr. This plugin used a different sheme (IMO more
    3.26  reliable) to map the EventID. If you're upgrading from premiereepg2vdr you
    3.27 -should delete your epg.data file.
    3.28 +should delete your epg.data file, otherwise you will see duplicate EPG events.
    3.29 +
    3.30 +The plugin can tag option events i.e. the same event with the same time on
    3.31 +different channels e.g. F1 sub channels. The tagging format (e.g. before or
    3.32 +after event name) can be selected in the plugin setup menu.
    3.33  
    3.34  Beside this, there is nothing big to say:
    3.35  
    3.36  - There are no commandline options for this plugin.
    3.37 -- There is no plugin setup menu.
    3.38  - There is no plugin mainmenu entry.
    3.39  - Everything should work automatically. Whenever a device is tuned to a Premiere
    3.40    channel i.e. by EPG scan or manually, the Premiere EPG scan is triggered.
     4.1 --- a/premiereepg.c	Sat Dec 29 11:17:41 2007 +0100
     4.2 +++ b/premiereepg.c	Sat Dec 29 11:18:14 2007 +0100
     4.3 @@ -28,6 +28,7 @@
     4.4  #include <vdr/epg.h>
     4.5  #include <vdr/channels.h>
     4.6  #include <vdr/dvbdevice.h>
     4.7 +#include <vdr/i18n.h>
     4.8  #include <libsi/section.h>
     4.9  #include <libsi/descriptor.h>
    4.10  
    4.11 @@ -48,8 +49,124 @@
    4.12  #define PMT_SCAN_TIMEOUT  10  // seconds
    4.13  #define PMT_SCAN_IDLE     300 // seconds
    4.14  
    4.15 -static const char *VERSION        = "0.0.1";
    4.16 -static const char *DESCRIPTION    = "Parse extended Premiere EPG data";
    4.17 +static const char *VERSION        = "0.0.2";
    4.18 +static const char *DESCRIPTION    = "Parses extended Premiere EPG data";
    4.19 +
    4.20 +// --- cSetupPremiereEpg -------------------------------------------------------
    4.21 +
    4.22 +const char *optPats[] = {
    4.23 +  "%s",
    4.24 +  "%s (Option %d)",
    4.25 +  "%s (O%d)",
    4.26 +  "#%2$d %1$s",
    4.27 +  "[%2$d] %1$s"
    4.28 +  };
    4.29 +#define NUM_PATS (sizeof(optPats)/sizeof(char *))
    4.30 +
    4.31 +class cSetupPremiereEpg {
    4.32 +public:
    4.33 +  int OptPat;
    4.34 +public:
    4.35 +  cSetupPremiereEpg(void);
    4.36 +  };
    4.37 +
    4.38 +cSetupPremiereEpg SetupPE;
    4.39 +
    4.40 +cSetupPremiereEpg::cSetupPremiereEpg(void)
    4.41 +{
    4.42 +  OptPat=1;
    4.43 +}
    4.44 +
    4.45 +// --- i18n --------------------------------------------------------------------
    4.46 +
    4.47 +const tI18nPhrase Phrases[] = {
    4.48 +/*
    4.49 +*/
    4.50 +  { "PremiereEPG",
    4.51 +    "PremiereEPG",
    4.52 +    "", // TODO
    4.53 +    "", // TODO
    4.54 +    "", // TODO
    4.55 +    "", // TODO
    4.56 +    "", // TODO
    4.57 +    "", // TODO
    4.58 +    "", // TODO
    4.59 +    "", // TODO
    4.60 +    "", // TODO
    4.61 +    "", // TODO
    4.62 +    "", // TODO
    4.63 +    "", // TODO
    4.64 +    "", // TODO
    4.65 +    "", // TODO
    4.66 +  },
    4.67 +  { "Parses extended Premiere EPG data",
    4.68 +    "Liest erweiterte Premiere EPG Daten ein",
    4.69 +    "", // TODO
    4.70 +    "", // TODO
    4.71 +    "", // TODO
    4.72 +    "", // TODO
    4.73 +    "", // TODO
    4.74 +    "", // TODO
    4.75 +    "", // TODO
    4.76 +    "", // TODO
    4.77 +    "", // TODO
    4.78 +    "", // TODO
    4.79 +    "", // TODO
    4.80 +    "", // TODO
    4.81 +    "", // TODO
    4.82 +    "", // TODO
    4.83 +  },
    4.84 +  { "Tag option events",
    4.85 +    "Options Events markieren",
    4.86 +    "", // TODO
    4.87 +    "", // TODO
    4.88 +    "", // TODO
    4.89 +    "", // TODO
    4.90 +    "", // TODO
    4.91 +    "", // TODO
    4.92 +    "", // TODO
    4.93 +    "", // TODO
    4.94 +    "", // TODO
    4.95 +    "", // TODO
    4.96 +    "", // TODO
    4.97 +    "", // TODO
    4.98 +    "", // TODO
    4.99 +    "", // TODO
   4.100 +  },
   4.101 +
   4.102 +  { NULL }
   4.103 +  };
   4.104 +
   4.105 +// --- cMenuSetupPremiereEpg ------------------------------------------------------------
   4.106 +
   4.107 +class cMenuSetupPremiereEpg : public cMenuSetupPage {
   4.108 +private:
   4.109 +  cSetupPremiereEpg data;
   4.110 +  const char *optDisp[NUM_PATS];
   4.111 +  char buff[NUM_PATS][32];
   4.112 +protected:
   4.113 +  virtual void Store(void);
   4.114 +public:
   4.115 +  cMenuSetupPremiereEpg(void);
   4.116 +  };
   4.117 +
   4.118 +cMenuSetupPremiereEpg::cMenuSetupPremiereEpg(void)
   4.119 +{
   4.120 +  data=SetupPE;
   4.121 +  SetSection(tr("PremiereEPG"));
   4.122 +  optDisp[0]=tr("off");
   4.123 +  for(unsigned int i=1; i<NUM_PATS; i++) {
   4.124 +    snprintf(buff[i],sizeof(buff[i]),optPats[i],"Event",1);
   4.125 +    optDisp[i]=buff[i];
   4.126 +    }
   4.127 +  Add(new cMenuEditStraItem(tr("Tag option events"),&data.OptPat,NUM_PATS,optDisp));
   4.128 +}
   4.129 +
   4.130 +void cMenuSetupPremiereEpg::Store(void)
   4.131 +{
   4.132 +  SetupPE=data;
   4.133 +  SetupStore("OptionPattern",SetupPE.OptPat);
   4.134 +}
   4.135  
   4.136  // --- CIT ---------------------------------------------------------------------
   4.137  
   4.138 @@ -90,11 +207,11 @@
   4.139     u_char duration_m                             :8;
   4.140     u_char duration_s                             :8;
   4.141  #if BYTE_ORDER == BIG_ENDIAN
   4.142 -   u_char reserved                               :4;
   4.143 +   u_char                                        :4;
   4.144     u_char descriptors_loop_length_hi             :4;
   4.145  #else
   4.146     u_char descriptors_loop_length_hi             :4;
   4.147 -   u_char reserved                               :4;
   4.148 +   u_char                                        :4;
   4.149  #endif
   4.150     u_char descriptors_loop_length_lo             :8;
   4.151  };
   4.152 @@ -383,11 +500,17 @@
   4.153                  continue;
   4.154                  }
   4.155  
   4.156 +              bool newEvent=false;
   4.157                cEvent *pEvent=(cEvent *)pSchedule->GetEvent(EventId,StartTime);
   4.158                if(!pEvent) {
   4.159                   d2(printf("(new)\n"))
   4.160 -                 pEvent=pSchedule->AddEvent(new cEvent(channelID,EventId));
   4.161 +#if VDRVERSNUM >= 10325
   4.162 +                 pEvent=new cEvent(EventId);
   4.163 +#else
   4.164 +                 pEvent=new cEvent(channelID,EventId);
   4.165 +#endif
   4.166                   if(!pEvent) continue;
   4.167 +                 newEvent=true;
   4.168                   }
   4.169                else {
   4.170                   d2(printf("(upd)\n"))
   4.171 @@ -402,14 +525,15 @@
   4.172                pEvent->SetDuration(cit.getDuration());
   4.173  
   4.174                if(ShortEventDescriptor) {
   4.175 -                char buffer[256+32];
   4.176 -                ShortEventDescriptor->name.getText(buffer,sizeof(buffer)-32);
   4.177 +                char buffer[256];
   4.178 +                ShortEventDescriptor->name.getText(buffer,sizeof(buffer));
   4.179                  if(isOpt) {
   4.180 -                  char o[32];
   4.181 -                  snprintf(o,sizeof(o)," (Option %d)",optCount);
   4.182 -                  strcat(buffer,o);
   4.183 +                  char buffer2[sizeof(buffer)+32];
   4.184 +                  snprintf(buffer2,sizeof(buffer2),optPats[SetupPE.OptPat],buffer,optCount);
   4.185 +                  pEvent->SetTitle(buffer2);
   4.186                    }
   4.187 -                pEvent->SetTitle(buffer);
   4.188 +                else
   4.189 +                  pEvent->SetTitle(buffer);
   4.190                  pEvent->SetShortText(ShortEventDescriptor->text.getText(buffer,sizeof(buffer)));
   4.191                  }
   4.192                if(ExtendedEventDescriptors) {
   4.193 @@ -417,6 +541,7 @@
   4.194                  pEvent->SetDescription(ExtendedEventDescriptors->getText(buffer,sizeof(buffer),": "));
   4.195                  }
   4.196  
   4.197 +              if(newEvent) pSchedule->AddEvent(pEvent);
   4.198                pEvent->SetComponents(NULL);
   4.199                pEvent->FixEpgBugs();
   4.200                Modified=true;
   4.201 @@ -446,9 +571,11 @@
   4.202  public:
   4.203    cPluginPremiereEpg(void);
   4.204    virtual const char *Version(void) { return VERSION; }
   4.205 -  virtual const char *Description(void) { return DESCRIPTION; }
   4.206 +  virtual const char *Description(void) { return tr(DESCRIPTION); }
   4.207    virtual bool Start(void);
   4.208    virtual void Stop(void);
   4.209 +  virtual cMenuSetupPage *SetupMenu(void);
   4.210 +  virtual bool SetupParse(const char *Name, const char *Value);
   4.211    };
   4.212  
   4.213  cPluginPremiereEpg::cPluginPremiereEpg(void)
   4.214 @@ -458,6 +585,7 @@
   4.215  
   4.216  bool cPluginPremiereEpg::Start(void)
   4.217  {
   4.218 +  RegisterI18n(Phrases);
   4.219    for(int i=0; i<MAXDVBDEVICES; i++) {
   4.220      cDevice *dev=cDevice::GetDevice(i);
   4.221      if(dev) {
   4.222 @@ -480,4 +608,16 @@
   4.223      }
   4.224  }
   4.225  
   4.226 +cMenuSetupPage *cPluginPremiereEpg::SetupMenu(void)
   4.227 +{
   4.228 +  return new cMenuSetupPremiereEpg;
   4.229 +}
   4.230 +
   4.231 +bool cPluginPremiereEpg::SetupParse(const char *Name, const char *Value)
   4.232 +{
   4.233 +  if      (!strcasecmp(Name, "OptionPattern")) SetupPE.OptPat = atoi(Value);
   4.234 +  else return false;
   4.235 +  return true;
   4.236 +}
   4.237 +
   4.238  VDRPLUGINCREATOR(cPluginPremiereEpg); // Don't touch this!