diff options
Diffstat (limited to 'eepg.c')
-rw-r--r-- | eepg.c | 108 |
1 files changed, 99 insertions, 9 deletions
@@ -111,7 +111,13 @@ public: cMenuSetupPremiereEpg::cMenuSetupPremiereEpg (void) { data = cSetupEEPG::getInstance(); - SetSection (tr ("PremiereEPG")); + cOsdItem *item = new cOsdItem(tr ("PremiereEPG")); + + if (item) { + item->SetSelectable(false); + Add(item); + } +// AddCategory (tr ("PremiereEPG")); optDisp[0] = tr ("off"); for (unsigned int i = 1; i < NUM_PATS; i++) { snprintf (buff[i], sizeof (buff[i]), optPats[i], "Event", 1); @@ -121,7 +127,14 @@ cMenuSetupPremiereEpg::cMenuSetupPremiereEpg (void) Add (new cMenuEditBoolItem (tr ("Show order information"), &data->OrderInfo)); Add (new cMenuEditBoolItem (tr ("Show rating information"), &data->RatingInfo)); Add (new cMenuEditBoolItem (tr ("Fix EPG data"), &data->FixEpg)); + item = new cOsdItem(tr ("General")); + if (item) { + item->SetSelectable(false); + Add(item); + } +// AddCategory (tr ("General")); Add (new cMenuEditBoolItem (tr ("Display summary message"), &data->DisplayMessage)); + Add (new cMenuEditBoolItem (tr ("Replace Empty Short Text with Category - Genre"), &data->ReplaceEmptyShText)); #ifdef DEBUG Add (new cMenuEditIntItem (tr ("Level of logging verbosity"), &data->LogLevel, 0, 5)); Add (new cMenuEditBoolItem (tr ("Process EIT info with EEPG"), &data->ProcessEIT)); @@ -136,6 +149,7 @@ void cMenuSetupPremiereEpg::Store (void) SetupStore ("RatingInfo", SetupPE->RatingInfo); SetupStore ("FixEpg", SetupPE->FixEpg); SetupStore ("DisplayMessage", SetupPE->DisplayMessage); + SetupStore ("ReplaceEmptyShText", SetupPE->ReplaceEmptyShText); #ifdef DEBUG SetupStore ("LogLevel", SetupPE->LogLevel); SetupStore ("ProcessEIT", SetupPE->ProcessEIT); @@ -175,6 +189,7 @@ private: bool EndChannels, EndThemes; //only used for ?? int MHWStartTime; //only used for MHW1 bool ChannelsOk; + int prevNid; //int Format; //the format that this filter currently is processing std::map < int, int >ChannelSeq; // ChannelSeq[ChannelId] returns the recordnumber of the channel @@ -222,7 +237,7 @@ protected: //virtual void FinishWriteToSchedule (sChannel * C, cSchedules * s, cSchedule * ps[MAX_EQUIVALENCES]); virtual void WriteToSchedule (tChannelID channelID, cSchedules* s, unsigned int EventId, unsigned int StartTime, unsigned int Duration, char *Text, char *SummText, unsigned short int ThemeId, - unsigned short int TableId, unsigned short int Version, char Rating = 0x00); + unsigned short int TableId, unsigned short int Version, char Rating = 0x00, unsigned char ShortTextLenght = 0); virtual void LoadIntoSchedule (void); //virtual void LoadEquivalentChannels (void); @@ -240,6 +255,7 @@ cFilterEEPG::cFilterEEPG (void) { nSummaries = 0; nTitles = 0; + prevNid = 0; Trigger (); //Set (0x00, 0x00); } @@ -266,6 +282,17 @@ void cFilterEEPG::SetStatus (bool On) for (int i = 0; i <= HIGHEST_FORMAT; i++) UnprocessedFormat[i] = 0; //pid 0 is assumed to be nonvalid for EEPG transfers AddFilter (0, 0); + int nid = Channel()->Nid(); + if (nid != prevNid) { + if (nid == 0x01 && prevNid != 0x01) { + setenv("VDR_CHARSET_OVERRIDE", "ISO-8859-9", true); + LogD(0, prep("setenv VDR_CHARSET_OVERRIDE ISO-8859-9")); + } else if (nid != 0x01 && (prevNid == 0x01 || prevNid == 0)){ + unsetenv("VDR_CHARSET_OVERRIDE"); + LogD(0, prep("clear VDR_CHARSET_OVERRIDE")); + } + prevNid = nid; + } } cFilter::SetStatus (On); Trigger (); @@ -1235,7 +1262,11 @@ char *cFilterEEPG::GetSummaryTextNagra (const u_char * DataStart, long int Offse * \param Duration the Duration of the event in minutes * \param ps points to array of schedules ps[eq], where eq is equivalence number of the channel. If channelId is invalid then ps[eq]=NULL */ -void cFilterEEPG::WriteToSchedule (tChannelID channelID, cSchedules* pSchedules, unsigned int EventId, unsigned int StartTime, unsigned int Duration, char *Text, char *SummText, unsigned short int ThemeId, unsigned short int TableId, unsigned short int Version, char Rating) +void cFilterEEPG::WriteToSchedule(tChannelID channelID, cSchedules* pSchedules, + unsigned int EventId, unsigned int StartTime, unsigned int Duration, + char *Text, char *SummText, unsigned short int ThemeId, + unsigned short int TableId, unsigned short int Version, char Rating, + unsigned char ShTxtLen) { bool WrittenTitle = false; bool WrittenSummary = false; @@ -1277,21 +1308,66 @@ void cFilterEEPG::WriteToSchedule (tChannelID channelID, cSchedules* pSchedules, if (Rating) { Event->SetParentalRating(Rating); } - char *tmp; if (Text != 0x00) { WrittenTitle = true; CleanString ((uchar *) Text); Event->SetTitle (Text); } - Asprintf (&tmp, "%s - %d\'", Themes[ThemeId], Duration); - Event->SetShortText (tmp); - free(tmp); + + char* tmp = NULL; + string shText; + if (SummText && ShTxtLen) { + + shText.assign(SummText,ShTxtLen); + + string tmpTitle(Text); + if (Format == MHW2 && !shText.empty()) { + //TODO (HD) channels + size_t found = tmpTitle.find(" (HD)"); + if (found != string::npos) + tmpTitle.erase(found, 5); + found = shText.compare(0, tmpTitle.size() + 2, string(tmpTitle + ": ")); + if (shText.compare(0, tmpTitle.size() + 2, string(tmpTitle + ": "))==0) + shText.erase(0, tmpTitle.size() + 2); + } + + //Do not use Subtitle if it is substring of Title + if (tmpTitle.compare(0, shText.size(), shText) == 0) + shText.clear(); + +#define MAX_USEFUL_EPISODE_LENGTH 40 + // From VDR FixEPG Bugs + // Some channels put a whole lot of information in the ShortText and leave + // the Description totally empty. So if the ShortText length exceeds + // MAX_USEFUL_EPISODE_LENGTH, let's put this into the Description + // instead: + if (!shText.empty() && shText.size() > MAX_USEFUL_EPISODE_LENGTH) + shText.clear(); + + } + if (!shText.empty()) + Event->SetShortText (shText.c_str()); + else if (SetupPE->ReplaceEmptyShText) { + Asprintf (&tmp, "%s - %d\'", Themes[ThemeId], Duration); + Event->SetShortText (tmp); + free(tmp); + } +/* + char *tmp; + if (!ShortText || strcmp(ShortText, Text) == 0) { + Asprintf (&tmp, "%s - %d\'", Themes[ThemeId], Duration); + Event->SetShortText (tmp); + free(tmp); + } else + Event->SetShortText (ShortText); +*/ //strreplace(t, '|', '\n'); if (SummText != 0x00) { WrittenSummary = true; CleanString ((uchar *) SummText); //Add themes and categories epgsearch style + //TODO DPE move this char *theme; Asprintf (&theme, "%s", Themes[ThemeId]); if (theme && 0 != strcmp(theme,"")) { @@ -2008,6 +2084,7 @@ int cFilterEEPG::GetSummariesMHW1 (const u_char * Data, int Length) S->NumReplays = Summary->NumReplays; S->EventId = HILO32 (Summary->ProgramId); S->Text = Text; + S->ShortTextLength = 0; //TODO find for MHW1 int i = 0; do { S->Replays[i].MjdTime = 0; //only used for SKY @@ -2126,6 +2203,9 @@ int cFilterEEPG::GetSummariesMHW2 (const u_char * Data, int Length) //S->Text[SummaryLength] = '\0'; //end string with NULL character decodeText2(tmp,SummaryLength,(char*)S->Text,2 * SummaryLength + 1); CleanString (S->Text); + char * delim = strchr ( (char *)S->Text, '\n' ); + S->ShortTextLength = delim == NULL ? 0 : delim - (char *)S->Text; + LogI(3, prep("EventId %08x Summnr %d:%.30s."), S->EventId, nSummaries, S->Text); nSummaries++; } else { @@ -2349,6 +2429,7 @@ int cFilterEEPG::GetSummariesSKYBOX (const u_char * Data, int Length) unsigned short int MjdTime; int Len1; int Len2; + const char* STxtDelim = Format == SKY_UK?": ":" - "; if (Length < 20) { return 1; //non fatal error I assume @@ -2372,6 +2453,7 @@ int cFilterEEPG::GetSummariesSKYBOX (const u_char * Data, int Length) S->Replays[0].MjdTime = MjdTime; S->NumReplays = 0; //not used S->EventId = (Data[p] << 8) | Data[p + 1]; + S->ShortTextLength = 0; Len1 = ((Data[p + 2] & 0x0f) << 8) | Data[p + 3]; if (Data[p + 4] != 0xb9) { LogD(5, prep("Data error signature for title - Data[p + 4] != 0xb5")); @@ -2397,6 +2479,8 @@ int cFilterEEPG::GetSummariesSKYBOX (const u_char * Data, int Length) memcpy (S->Text, tmp, Len2); S->Text[Len2] = '\0'; //end string with NULL character CleanString (S->Text); + char * delim = strstr ( (char *)S->Text, STxtDelim ); + S->ShortTextLength = delim == NULL ? 0 : delim - (char *)S->Text; LogI(3, prep("EventId %08x Summnr %d:%.30s."), S->EventId, nSummaries, S->Text); p += Len1; nSummaries++; @@ -2518,9 +2602,13 @@ void cFilterEEPG::LoadIntoSchedule (void) TableId = T->TableId; } +// LogD (0, prep("EventId %08x Titlenr %d:SummAv:%x,Un1:%x,Un2:%x,Un3:%x,Name:%s,STxtLn:%dSummary:%s."), +// T->EventId, i, T->SummaryAvailable, T->Unknown1, T->Unknown2, T->Unknown3, T->Text, S->ShortTextLength, S->Text); + WriteToSchedule (chanID, s, T->EventId, StartTime, T->Duration / 60, (char *) T->Text, - (char *) S->Text, T->ThemeId, TableId, 0, rating); + (char *) S->Text, T->ThemeId, TableId, 0, rating, S->ShortTextLength); sortSchedules(s, chanID); + //if (shortText != NULL) delete [] shortText; //FinishWriteToSchedule (C, s, p); //Replays--; @@ -2563,7 +2651,7 @@ void cFilterEEPG::LoadIntoSchedule (void) rating = T->Rating; } WriteToSchedule (chanID, s, T->EventId, T->StartTime, T->Duration / 60, (char *) T->Text, - NULL, T->ThemeId, DEFAULT_TABLE_ID, 0, rating); + NULL, T->ThemeId, DEFAULT_TABLE_ID, 0, rating, S->ShortTextLength); //FinishWriteToSchedule (C, s, p); sortSchedules(s, chanID); @@ -3614,6 +3702,8 @@ bool cPluginEEPG::SetupParse (const char *Name, const char *Value) SetupPE->FixEpg = atoi (Value); else if (!strcasecmp (Name, "DisplayMessage")) SetupPE->DisplayMessage = atoi (Value); + else if (!strcasecmp (Name, "ReplaceEmptyShText")) + SetupPE->ReplaceEmptyShText = atoi (Value); #ifdef DEBUG else if (!strcasecmp (Name, "LogLevel")) SetupPE->LogLevel = atoi (Value); |