summaryrefslogtreecommitdiff
path: root/eepg.c
diff options
context:
space:
mode:
Diffstat (limited to 'eepg.c')
-rw-r--r--eepg.c99
1 files changed, 80 insertions, 19 deletions
diff --git a/eepg.c b/eepg.c
index 63394d0..15e1329 100644
--- a/eepg.c
+++ b/eepg.c
@@ -2821,7 +2821,9 @@ namespace SI
enum DescriptorTagExt {
DishRatingDescriptorTag = 0x89,
DishShortEventDescriptorTag = 0x91,
- DishExtendedEventDescriptorTag = 0x92 };
+ DishExtendedEventDescriptorTag = 0x92,
+ DishSeriesDescriptorTag = 0x96,
+ };
// typedef InheritEnum< DescriptorTagExt, SI::DescriptorTag > ExtendedDescriptorTag;
@@ -2838,6 +2840,8 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
: SI::EIT (Data, false)
{
//LogD(2, prep("cEIT2::cEIT2"));
+ if (Tid > 0 && (Format == DISH_BEV || (SetupPE.ProcessEIT && isEITPid))) Tid--;
+
if (!CheckCRCAndParse ()) {
LogD(2, prep("!CheckCRCAndParse ()"));
return;
@@ -2881,9 +2885,6 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
SegmentStart = SiEitEvent.getStartTime ();
SegmentEnd = SiEitEvent.getStartTime () + SiEitEvent.getDuration ();
int versionNumber = getVersionNumber();
- // increase version number for DISH_BEV EIT so it does not get overwriten by VDR.
- // TODO check the same for other providers.
- if ((Format == DISH_BEV || SetupPE.ProcessEIT )&& isEITPid) versionNumber++;
cEvent *newEvent = NULL;
cEvent *rEvent = NULL;
@@ -2981,8 +2982,7 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
}
// If the new event has a higher table ID, let's skip it.
// The lower the table ID, the more "current" the information.
- // if the Table ID is DEFAULT_TABLE_ID it is most probably EEPG event so we can overwrite
- else if (Tid > pEvent->TableID() && (SetupPE.ProcessEIT ? pEvent->TableID () != DEFAULT_TABLE_ID : true))
+ else if (Tid > pEvent->TableID())
continue;
// If the new event comes from the same table and has the same version number
// as the existing one, let's skip it to avoid unnecessary work.
@@ -3033,7 +3033,7 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
continue;
}
- LogD(2, prep("EEPGDEBUG:d->getDescriptorTAG():%x)"), d->getDescriptorTag ());
+ //LogD(2, prep("EEPGDEBUG:d->getDescriptorTAG():%x)"), d->getDescriptorTag ());
switch (d->getDescriptorTag ()) {
case SI::ExtendedEventDescriptorTag: {
@@ -3205,7 +3205,7 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
if (!DishEventDescriptor) {
DishEventDescriptor = new SI::DishDescriptor();
}
- DishEventDescriptor->setExtendedtData(Tid, deed->getData());
+ DishEventDescriptor->setExtendedtData(Tid+1, deed->getData());
HasExternalData = true;
}
break;
@@ -3214,15 +3214,31 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
if (!DishEventDescriptor) {
DishEventDescriptor = new SI::DishDescriptor();
}
- DishEventDescriptor->setShortData(Tid, dsed->getData());
+ DishEventDescriptor->setShortData(Tid+1, dsed->getData());
HasExternalData = true;
}
break;
case SI::DishRatingDescriptorTag: {
- if (d->getLength() == 4 && DishEventDescriptor) {
- uint16_t rating = d->getData().TwoBytes(2);
- DishEventDescriptor->setRating(rating);
- }
+ if (d->getLength() == 4) {
+ if (!DishEventDescriptor) {
+ DishEventDescriptor = new SI::DishDescriptor();
+ }
+ uint16_t rating = d->getData().TwoBytes(2);
+ DishEventDescriptor->setRating(rating);
+ }
+ }
+ break;
+ case SI::DishSeriesDescriptorTag: {
+ if (d->getLength() == 10) {
+ //LogD(2, prep("DishSeriesDescriptorTag: %s)"), (const char*) d->getData().getData());
+ if (!DishEventDescriptor) {
+ DishEventDescriptor = new SI::DishDescriptor();
+ }
+ DishEventDescriptor->setEpisodeInfo(d->getData());
+ }
+// else {
+// LogD(2, prep("DishSeriesDescriptorTag length: %d)"), d->getLength());
+// }
}
break;
default:
@@ -3258,14 +3274,59 @@ cEIT2::cEIT2 (cSchedules * Schedules, int Source, u_char Tid, const u_char * Dat
LogD(3, prep("Description: %s"), pEvent->Description());
} else if (!HasExternalData) {
pEvent->SetDescription (NULL);
- LogD(3, prep("SetDescription (NULL)"));
- }
if (DishEventDescriptor) {
- pEvent->SetTitle(DishEventDescriptor->getName());
- pEvent->SetDescription(DishEventDescriptor->getDescription());
- pEvent->SetShortText(DishEventDescriptor->getShortText());
- //LogD(2, prep("channelID: %s DishTitle: %s"), *channel->GetChannelID().ToString(), DishEventDescriptor->getName());
+ if (DishEventDescriptor->getName())
+ pEvent->SetTitle(DishEventDescriptor->getName());
+ //LogD(2, prep("channelID: %s DishTitle: %s"), *channel->GetChannelID().ToString(), DishShortEventDescriptor->getText());
+// pEvent->SetDescription(DishExtendedEventDescriptor->getText());
+ char *tmp;
+ string fmt;
+ fmt = "%s";
+ if (0 != strcmp(DishEventDescriptor->getShortText(),"") && DishEventDescriptor->hasTheme()) {
+ fmt += " - ";
+ }
+ fmt += "%s";
+ if (DishEventDescriptor->hasTheme() && DishEventDescriptor->hasCategory()) {
+ fmt += " ~ ";
+ }
+ fmt += "%s";
+
+ Asprintf (&tmp, fmt.c_str(), DishEventDescriptor->getShortText()
+ , DishEventDescriptor->getTheme()
+ , DishEventDescriptor->getCategory());
+ pEvent->SetShortText(tmp);
+ //LogD(2, prep("EEPGDEBUG:DishTheme:%x-DishCategory:%x)"), DishTheme, DishCategory);
+ free(tmp);
+
+ fmt = "%s";
+ if (0 != strcmp(DishEventDescriptor->getDescription(),"")
+ && (0 != strcmp(DishEventDescriptor->getRating(),"")
+ || 0 != strcmp(DishEventDescriptor->getStarRating(),""))) {
+ fmt += "\n\nRating: ";
+ }
+ fmt += "%s %s";
+ if (0 != strcmp(DishEventDescriptor->getProgramId(),"")) {
+ fmt += "\n\nProgram ID: ";
+ }
+ fmt += "%s %s%s";
+ time_t orgAirDate = DishEventDescriptor->getOriginalAirDate();
+ char datestr [80];
+ bool dateok = false;
+ if (orgAirDate == 0) {
+ dateok = strftime (datestr,80," Original Air Date: %a %b %d %Y",gmtime(&orgAirDate)) > 0;
+ }
+
+ Asprintf (&tmp, fmt.c_str(), DishEventDescriptor->getDescription()
+ , DishEventDescriptor->getRating()
+ , DishEventDescriptor->getStarRating()
+ , DishEventDescriptor->getProgramId()
+ , DishEventDescriptor->getSeriesId()
+ , orgAirDate == 0 || !dateok ? "" : datestr);
+ pEvent->SetDescription(tmp);
+ free(tmp);
+
+
//LogD(2, prep("DishDescription: %s"), DishExtendedEventDescriptor->getText());
//LogD(2, prep("DishShortText: %s"), DishExtendedEventDescriptor->getShortText());
}