diff options
-rw-r--r-- | Makefile | 78 | ||||
-rw-r--r-- | eepg.c | 97 | ||||
-rw-r--r-- | eepg.h | 1 | ||||
-rw-r--r-- | epghandler.c | 6 | ||||
-rw-r--r-- | epghandler.h | 2 | ||||
-rw-r--r-- | po/mk_MK.po | 74 | ||||
-rw-r--r-- | setupeepg.c | 2 | ||||
-rw-r--r-- | setupeepg.h | 1 |
8 files changed, 214 insertions, 47 deletions
@@ -35,16 +35,20 @@ CXXFLAGS ?= -O2 -fPIC -Wall -Woverloaded-virtual ### The directory environment: -VDRDIR = ../../.. -LIBDIR = ../../lib -TMPDIR = /tmp +VDRDIR ?= ../../.. +LIBDIR ?= ../../lib +TMPDIR ?= /tmp + +### Make sure that necessary options are included: + +include $(VDRDIR)/Make.global ### Allow user defined options to overwrite defaults: -include $(VDRDIR)/Make.config -include Make.config -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR's plugin API (taken from VDR's "config.h"): VDRVERSION = $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) APIVERSION = $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) @@ -63,24 +67,22 @@ INCLUDES += -I$(VDRDIR)/include DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -### The object files (add further files here): - -OBJS = $(PLUGIN).o dish.o epghandler.o setupeepg.o equivhandler.o util.o eit2.o - ifdef DBG CXXFLAGS += -g endif -### Internationalization (I18N): +### The object files (add further files here): -PODIR = po -I18Npot = $(PODIR)/$(PLUGIN).pot -I18Nmsgs = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,$(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file)))))) -LOCALEDIR = $(VDRDIR)/locale +OBJS = $(PLUGIN).o dish.o epghandler.o setupeepg.o equivhandler.o util.o eit2.o ### Default Target default: $(OBJS) +### Implicit rules: + +%.o: %.c + $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< + ### Dependencies: MAKEDEP = $(CXX) -MM -MG @@ -90,47 +92,47 @@ $(DEPFILE): Makefile -include $(DEPFILE) -### Targets: - -TARGETS = libvdr-$(PLUGIN).so -ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c) -TARGETS += i18n -endif +### Internationalization (I18N): -all: $(TARGETS) -.PHONY: i18n +PODIR = po +LOCALEDIR = $(VDRDIR)/locale +I18Npo = $(wildcard $(PODIR)/*.po) +I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) +I18Npot = $(PODIR)/$(PLUGIN).pot -%.o: %.c - $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< +### target All not default since it stops VDR +all: libvdr-$(PLUGIN).so i18n -libvdr-$(PLUGIN).so: $(OBJS) - $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(APIVERSION) +%.mo: %.po + msgfmt -c -o $@ $< -$(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c $(SYSDIR)) - xgettext -C -cTRANSLATORS --no-wrap -F -k -ktr -ktrNOOP -o $@ $^ +$(I18Npot): $(wildcard *.c) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ $^ %.po: $(I18Npot) - msgmerge -U --no-wrap -F --backup=none -q $@ $< + msgmerge -U --no-wrap --no-location --backup=none -q $@ $< @touch $@ -%.mo: %.po - msgfmt -c -o $@ $< - $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo @mkdir -p $(dir $@) cp $< $@ -i18n: $(I18Nmsgs) +.PHONY: i18n +i18n: $(I18Nmsgs) $(I18Npot) + +### Targets: + +libvdr-$(PLUGIN).so: $(OBJS) + $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@ + @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION) -dist: clean +dist: $(I18Npo) clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE) - @tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE) + @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) @-rm -rf $(TMPDIR)/$(ARCHIVE) - @echo Distribution package created as $(PACKAGE).tar.gz + @echo Distribution package created as $(PACKAGE).tgz clean: - @-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~ -# @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot + @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot @@ -121,7 +121,9 @@ 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)); + SetSection (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 +138,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); @@ -222,7 +225,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); @@ -266,6 +269,13 @@ 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); + if (Channel()->Nid() == 0x01) { + setenv("VDR_CHARSET_OVERRIDE", "ISO-8859-9", true); + LogD(0, prep("setenv VDR_CHARSET_OVERRIDE ISO-8859-9")); + } else { + unsetenv("VDR_CHARSET_OVERRIDE"); + LogD(0, prep("clear VDR_CHARSET_OVERRIDE")); + } } cFilter::SetStatus (On); Trigger (); @@ -1235,7 +1245,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 +1291,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 +2067,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 +2186,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 +2412,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 +2436,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 +2462,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 +2585,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 +2634,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); @@ -2774,6 +2845,14 @@ void cFilterEEPG::Process (u_short Pid, u_char Tid, const u_char * Data, int Len // LogD(2, prep("Pid: 0x%02x Tid: %d Length: %d PMT pid: 0x%04x"), Pid, Tid, Length, pmtpid); // LogD(2, prep("Source: %d Transponder: %d"), Source () , Transponder ()); + if (Channel()->Nid() == 0x01) { + setenv("VDR_CHARSET_OVERRIDE", "ISO-8859-9", true); + LogD(0, prep("setenv VDR_CHARSET_OVERRIDE ISO-8859-9")); + } + else { + unsetenv("VDR_CHARSET_OVERRIDE"); + LogD(0, prep("clear VDR_CHARSET_OVERRIDE")); + } if (Pid == 0 && Tid == SI::TableIdPAT) { if (!pmtnext || now > pmtnext) { if (pmtpid) @@ -3619,6 +3698,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); @@ -70,6 +70,7 @@ typedef struct { unsigned int EventId;//short is not sufficient for Nagra unsigned short int NumReplays; unsigned char * Text; + unsigned char ShortTextLength; } Summary_t; diff --git a/epghandler.c b/epghandler.c index a1b92c3..4e7ab30 100644 --- a/epghandler.c +++ b/epghandler.c @@ -184,6 +184,12 @@ bool cEEpgHandler::SortSchedule(cSchedule* Schedule) { return true; } +bool cEEpgHandler::FixEpgBugs(cEvent* Event) +{ + //TODO to see which channels have bugs - disable fixing with true + return false; +} + bool cEEpgHandler::DropOutdated(cSchedule* Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version) { return false; diff --git a/epghandler.h b/epghandler.h index 003fd32..feaad9d 100644 --- a/epghandler.h +++ b/epghandler.h @@ -29,7 +29,7 @@ public: virtual bool SetStartTime(cEvent *Event, time_t StartTime); virtual bool SetDuration(cEvent *Event, int Duration); virtual bool SetVps(cEvent *Event, time_t Vps); - virtual bool FixEpgBugs(cEvent *Event) { return false; } + virtual bool FixEpgBugs(cEvent *Event); virtual bool HandleEvent(cEvent *Event); virtual bool SortSchedule(cSchedule *Schedule); virtual bool DropOutdated(cSchedule *Schedule, time_t SegmentStart, time_t SegmentEnd, uchar TableID, uchar Version); diff --git a/po/mk_MK.po b/po/mk_MK.po new file mode 100644 index 0000000..b7701bf --- /dev/null +++ b/po/mk_MK.po @@ -0,0 +1,74 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012 +# This file is distributed under the same license as the VDR package. +# Dimitar Petrovski <dimeptr@gmail.com>, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: vdr-eepg 0.0.6pre\n" +"Report-Msgid-Bugs-To: <see README>\n" +"POT-Creation-Date: 2012-10-29 13:42+0100\n" +"PO-Revision-Date: 2012-10-29 13:44+0100\n" +"Last-Translator: Dimitar Petrovski <dimeptr@gmail.com>\n" +"Language-Team: Macedonian <mk@li.org>\n" +"Language: mk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Parses Extended EPG data" +msgstr "Анализира Опширни ЕПГ податоци" + +msgid "PremiereEPG" +msgstr "Премиер ЕПГ" + +msgid "off" +msgstr "исклучено" + +msgid "Tag option events" +msgstr "Тагуван опцоини настани" + +msgid "Show order information" +msgstr "Прикажи информации за нарачка" + +msgid "Show rating information" +msgstr "Прикажи информации за рејтинг" + +msgid "Fix EPG data" +msgstr "Поправи ЕПГ податоци" + +msgid "General" +msgstr "Општо" + +msgid "Display summary message" +msgstr "Прикажи сумарна порака" + +msgid "Replace Empty Short Text with Category - Genre" +msgstr "Замени празен Краток Текст со Категорија - Жанр" + +msgid "Level of logging verbosity" +msgstr "Ниво на логирање" + +msgid "Process EIT info with EEPG" +msgstr "Процесирај ЕИТ информации со ЕЕПГ" + +msgid "Ordernumber" +msgstr "Бр. на нарачка" + +msgid "Price" +msgstr "Цена" + +msgid "Ordering" +msgstr "Нарачка" + +msgid "SMS" +msgstr "СМС" + +msgid "WWW" +msgstr "WWW" + +msgid "Rating" +msgstr "Рејтинг" + +msgid "years" +msgstr "години" diff --git a/setupeepg.c b/setupeepg.c index c0dff6a..bfbb26f 100644 --- a/setupeepg.c +++ b/setupeepg.c @@ -22,6 +22,8 @@ cSetupEEPG::cSetupEEPG (void) FixEpg = 0; DisplayMessage = 1; ProcessEIT = 0; + ReplaceEmptyShText = 0; + #ifdef DEBUG LogLevel = 0; #endif diff --git a/setupeepg.h b/setupeepg.h index 4c30ede..eb3c53e 100644 --- a/setupeepg.h +++ b/setupeepg.h @@ -18,6 +18,7 @@ public: int FixEpg; int DisplayMessage; int ProcessEIT; + int ReplaceEmptyShText; #ifdef DEBUG int LogLevel; #endif |