premiereepg.c
branchtrunk
changeset 12 5213337a6614
parent 10 967afc97e51d
child 14 feccb11658b1
equal deleted inserted replaced
11:7196c6d57fab 12:5213337a6614
    48 #endif
    48 #endif
    49 
    49 
    50 #define PMT_SCAN_TIMEOUT  10  // seconds
    50 #define PMT_SCAN_TIMEOUT  10  // seconds
    51 #define PMT_SCAN_IDLE     300 // seconds
    51 #define PMT_SCAN_IDLE     300 // seconds
    52 
    52 
    53 static const char *VERSION        = "0.0.6";
    53 static const char *VERSION        = "0.0.7";
    54 static const char *DESCRIPTION    = "Parses extended Premiere EPG data";
    54 static const char *DESCRIPTION    = "Parses extended Premiere EPG data";
    55 
    55 
    56 #if APIVERSNUM < 10401
    56 #if APIVERSNUM < 10401
    57 #error You need at least VDR API version 1.4.1 for this plugin
    57 #error You need at least VDR API version 1.4.1 for this plugin
    58 #endif
    58 #endif
    71 class cSetupPremiereEpg {
    71 class cSetupPremiereEpg {
    72 public:
    72 public:
    73   int OptPat;
    73   int OptPat;
    74   int OrderInfo;
    74   int OrderInfo;
    75   int RatingInfo;
    75   int RatingInfo;
       
    76   int FixEpg;
    76 public:
    77 public:
    77   cSetupPremiereEpg(void);
    78   cSetupPremiereEpg(void);
    78   };
    79   };
    79 
    80 
    80 cSetupPremiereEpg SetupPE;
    81 cSetupPremiereEpg SetupPE;
    82 cSetupPremiereEpg::cSetupPremiereEpg(void)
    83 cSetupPremiereEpg::cSetupPremiereEpg(void)
    83 {
    84 {
    84   OptPat=1;
    85   OptPat=1;
    85   OrderInfo=1;
    86   OrderInfo=1;
    86   RatingInfo=1;
    87   RatingInfo=1;
       
    88   FixEpg=0;
    87 }
    89 }
    88 
    90 
    89 // --- i18n --------------------------------------------------------------------
    91 // --- i18n --------------------------------------------------------------------
    90 
    92 
    91 const tI18nPhrase Phrases[] = {
    93 const tI18nPhrase Phrases[] = {
   279     "", // TODO
   281     "", // TODO
   280     "", // TODO
   282     "", // TODO
   281   },
   283   },
   282   { "years",
   284   { "years",
   283     "Jahre",
   285     "Jahre",
       
   286     "", // TODO
       
   287     "", // TODO
       
   288     "", // TODO
       
   289     "", // TODO
       
   290     "", // TODO
       
   291     "", // TODO
       
   292     "", // TODO
       
   293     "", // TODO
       
   294     "", // TODO
       
   295     "", // TODO
       
   296     "", // TODO
       
   297     "", // TODO
       
   298     "", // TODO
       
   299     "", // TODO
       
   300   },
       
   301   { "Fix EPG data",
       
   302     "EPG Daten korrigieren",
   284     "", // TODO
   303     "", // TODO
   285     "", // TODO
   304     "", // TODO
   286     "", // TODO
   305     "", // TODO
   287     "", // TODO
   306     "", // TODO
   288     "", // TODO
   307     "", // TODO
   323     optDisp[i]=buff[i];
   342     optDisp[i]=buff[i];
   324     }
   343     }
   325   Add(new cMenuEditStraItem(tr("Tag option events"),&data.OptPat,NUM_PATS,optDisp));
   344   Add(new cMenuEditStraItem(tr("Tag option events"),&data.OptPat,NUM_PATS,optDisp));
   326   Add(new cMenuEditBoolItem(tr("Show order information"),&data.OrderInfo));
   345   Add(new cMenuEditBoolItem(tr("Show order information"),&data.OrderInfo));
   327   Add(new cMenuEditBoolItem(tr("Show rating information"),&data.RatingInfo));
   346   Add(new cMenuEditBoolItem(tr("Show rating information"),&data.RatingInfo));
       
   347   Add(new cMenuEditBoolItem(tr("Fix EPG data"),&data.FixEpg));
   328 }
   348 }
   329 
   349 
   330 void cMenuSetupPremiereEpg::Store(void)
   350 void cMenuSetupPremiereEpg::Store(void)
   331 {
   351 {
   332   SetupPE=data;
   352   SetupPE=data;
   333   SetupStore("OptionPattern",SetupPE.OptPat);
   353   SetupStore("OptionPattern",SetupPE.OptPat);
   334   SetupStore("OrderInfo",SetupPE.OrderInfo);
   354   SetupStore("OrderInfo",SetupPE.OrderInfo);
   335   SetupStore("RatingInfo",SetupPE.RatingInfo);
   355   SetupStore("RatingInfo",SetupPE.RatingInfo);
       
   356   SetupStore("FixEpg",SetupPE.FixEpg);
   336 }
   357 }
   337 
   358 
   338 // --- CRC16 -------------------------------------------------------------------
   359 // --- CRC16 -------------------------------------------------------------------
   339 
   360 
   340 #define POLY 0xA001 // CRC16
   361 #define POLY 0xA001 // CRC16
   573         int optCount=0;
   594         int optCount=0;
   574         unsigned int crc[3];
   595         unsigned int crc[3];
   575         crc[0]=cit.getContentId();
   596         crc[0]=cit.getContentId();
   576         SI::PremiereContentTransmissionDescriptor *pct;
   597         SI::PremiereContentTransmissionDescriptor *pct;
   577         for(SI::Loop::Iterator it; (pct=(SI::PremiereContentTransmissionDescriptor *)cit.eventDescriptors.getNext(it,SI::PremiereContentTransmissionDescriptorTag)); ) {
   598         for(SI::Loop::Iterator it; (pct=(SI::PremiereContentTransmissionDescriptor *)cit.eventDescriptors.getNext(it,SI::PremiereContentTransmissionDescriptorTag)); ) {
   578           tChannelID channelID(Source(),pct->getOriginalNetworkId(),pct->getTransportStreamId(),pct->getServiceId());
   599           int nid=pct->getOriginalNetworkId();
       
   600           int tid=pct->getTransportStreamId();
       
   601           int sid=pct->getServiceId();
       
   602           if(SetupPE.FixEpg) {
       
   603             if(nid==133) {
       
   604 	      if     (tid==0x03 && sid==0xf0) { tid=0x02; sid=0xe0; }
       
   605 	      else if(tid==0x03 && sid==0xf1) { tid=0x02; sid=0xe1; }
       
   606 	      else if(tid==0x03 && sid==0xf5) { tid=0x03; sid=0xdc; }
       
   607 	      else if(tid==0x04 && sid==0xd2) { tid=0x11; sid=0xe2; }
       
   608 	      else if(tid==0x11 && sid==0xd3) { tid=0x11; sid=0xe3; }
       
   609               }
       
   610             }
       
   611           tChannelID channelID(Source(),nid,tid,sid);
   579           cChannel *channel=Channels.GetByChannelID(channelID,true);
   612           cChannel *channel=Channels.GetByChannelID(channelID,true);
   580           if(!channel) continue;
   613           if(!channel) continue;
   581 
   614 
   582           cSchedule *pSchedule=(cSchedule *)Schedules->GetSchedule(channelID);
   615           cSchedule *pSchedule=(cSchedule *)Schedules->GetSchedule(channelID);
   583           if(!pSchedule) {
   616           if(!pSchedule) {
   740 bool cPluginPremiereEpg::SetupParse(const char *Name, const char *Value)
   773 bool cPluginPremiereEpg::SetupParse(const char *Name, const char *Value)
   741 {
   774 {
   742   if      (!strcasecmp(Name, "OptionPattern")) SetupPE.OptPat     = atoi(Value);
   775   if      (!strcasecmp(Name, "OptionPattern")) SetupPE.OptPat     = atoi(Value);
   743   else if (!strcasecmp(Name, "OrderInfo"))     SetupPE.OrderInfo  = atoi(Value);
   776   else if (!strcasecmp(Name, "OrderInfo"))     SetupPE.OrderInfo  = atoi(Value);
   744   else if (!strcasecmp(Name, "RatingInfo"))    SetupPE.RatingInfo = atoi(Value);
   777   else if (!strcasecmp(Name, "RatingInfo"))    SetupPE.RatingInfo = atoi(Value);
       
   778   else if (!strcasecmp(Name, "FixEpg"))        SetupPE.FixEpg     = atoi(Value);
   745   else return false;
   779   else return false;
   746   return true;
   780   return true;
   747 }
   781 }
   748 
   782 
   749 VDRPLUGINCREATOR(cPluginPremiereEpg); // Don't touch this!
   783 VDRPLUGINCREATOR(cPluginPremiereEpg); // Don't touch this!