Beispiel #1
0
void cGraphLCDState::OsdHelpKeys(const char * Red, const char * Green, const char * Yellow, const char * Blue)
{
//	printf("graphlcd plugin: cGraphLCDState::OsdHelpKeys %s - %s - %s - %s\n", Red, Green, Yellow, Blue);
	if (GraphLCDSetup.PluginActive)
	{
		if (GraphLCDSetup.ShowColorButtons)
		{
			mutex.Lock();

			for (int i = 0; i < 4; i++)
				osd.colorButton[i] = "";

			if (Red)
				osd.colorButton[0] = compactspace(Red);
			if (Green)
				osd.colorButton[1] = compactspace(Green);
			if (Yellow)
				osd.colorButton[2] = compactspace(Yellow);
			if (Blue)
				osd.colorButton[3] = compactspace(Blue);

			mutex.Unlock();
		}
	}
}
Beispiel #2
0
void cRssParserItem::SetDescription(const char *strP)
{
  Utf8Strn0Cpy(descriptionM, strP, sizeof(descriptionM));
  compactspace(descriptionM);
  striphtml(descriptionM);
  Utf8Strn0Cpy(descriptionM, convM.Convert(descriptionM), sizeof(descriptionM));
}
Beispiel #3
0
void cRssParserItem::SetTitle(const char *strP)
{
  Utf8Strn0Cpy(titleM, strP, sizeof(titleM));
  compactspace(titleM);
  striphtml(titleM);
  Utf8Strn0Cpy(titleM, convM.Convert(titleM), sizeof(titleM));
}
Beispiel #4
0
void cItem::SetLink(const char *str)
{
  char tmp[SHORT_TEXT_LEN];
  memset(tmp, 0, sizeof(tmp));
  const char* codeset =  cCharSetConv::SystemCharacterTable();
  charsetconv(tmp, sizeof(tmp), str, strlen(str), "UTF8", codeset?codeset:"UTF-8");
  compactspace(tmp);
  debug("cItem::SetLink(): '%s'", tmp);
  Utf8Strn0Cpy(link, tmp, sizeof(tmp));
}
Beispiel #5
0
void cItem::SetDescription(const char *str)
{
  char tmp[LONG_TEXT_LEN];
  memset(tmp, 0, sizeof(tmp));
  const char* codeset =  cCharSetConv::SystemCharacterTable();
  charsetconv(tmp, sizeof(tmp), str, strlen(str), "UTF8", codeset?codeset:"UTF-8");
  compactspace(tmp);
  striphtml(tmp);
  debug("cItem::SetDescription nach striphtml:= '%s'", tmp);
  Utf8Strn0Cpy(description, tmp, sizeof(tmp));
}
Beispiel #6
0
bool cTemplLine::Parse(char *s)
{
    if (!s) return false;
    if (s[0] == '#')
	return true;
    char *p = strchr(s, '=');
    if (p)
    {
	*p = 0;
	char *Name  = compactspace(s);
	char *Value = compactspace(p + 1);
	if (*Name)
	{
	    name = strdup(Name);
	    value = strdup(Value);
	    return true;
	}
    }
    return false;
}
Beispiel #7
0
bool cSetupLine::Parse(char *s)
{
  char *p = strchr(s, '=');
  if (p) {
     *p = 0;
     char *Name  = compactspace(s);
     char *Value = compactspace(p + 1);
     if (*Name) { // value may be an empty string
        p = strchr(Name, '.');
        if (p) {
           *p = 0;
           char *Plugin = compactspace(Name);
           Name = compactspace(p + 1);
           if (!(*Plugin && *Name))
              return false;
           plugin = strdup(Plugin);
           }
        name = strdup(Name);
        value = strdup(Value);
        return true;
        }
     }
  return false;
}
Beispiel #8
0
void cGraphLCDState::OsdStatusMessage(const char * Message)
{
//	printf("graphlcd plugin: cGraphLCDState::OsdStatusMessage '%s'\n", Message);
	if (GraphLCDSetup.PluginActive)
	{
		if (GraphLCDSetup.ShowMessages)
		{
			mutex.Lock();

			if (Message)
				osd.message = compactspace(Message);
			else
				osd.message = "";

			mutex.Unlock();
			Display.Update();
		}
	}
}
Beispiel #9
0
void cGraphLCDState::OsdChannel(const char * Text)
{
//	printf("graphlcd plugin: cGraphLCDState::OsdChannel %s\n", Text);
	if (GraphLCDSetup.PluginActive)
	{
		mutex.Lock();
		if (Text)
		{
			channel.strTmp = Text;
			channel.strTmp = compactspace(channel.strTmp);
		}
		else
		{
			channel.strTmp = "";
		}
		mutex.Unlock();

		if (Text)
			Display.Update();
	}
}
Beispiel #10
0
void cGraphLCDState::OsdTitle(const char * Title)
{
//	printf("graphlcd plugin: cGraphLCDState::OsdTitle '%s'\n", Title);
	if (GraphLCDSetup.PluginActive)
	{
		mutex.Lock();

		osd.message = "";
		osd.title = "";
		if (Title)
		{
			osd.title = Title;
			// remove the time
			std::string::size_type pos = osd.title.find('\t');
			if (pos != std::string::npos)
				osd.title.resize(pos);
			osd.title = compactspace(osd.title);
		}
	
		mutex.Unlock();
		Display.SetOsdTitle();
	}
}
Beispiel #11
0
void cEvent::FixEpgBugs(void)
{
  // VDR can't usefully handle newline characters in the title and shortText of EPG
  // data, so let's always convert them to blanks (independent of the setting of EPGBugfixLevel):
  strreplace(title, '\n', ' ');
  strreplace(shortText, '\n', ' ');
  // Same for control characters:
  strreplace(title, '\x86', ' ');
  strreplace(title, '\x87', ' ');
  strreplace(shortText, '\x86', ' ');
  strreplace(shortText, '\x87', ' ');
  strreplace(description, '\x86', ' ');
  strreplace(description, '\x87', ' ');

  if (isempty(title)) {
     // we don't want any "(null)" titles
     title = strcpyrealloc(title, tr("No title"));
     EpgBugFixStat(12, ChannelID());
     }

  if (Setup.EPGBugfixLevel == 0)
     return;

  // Some TV stations apparently have their own idea about how to fill in the
  // EPG data. Let's fix their bugs as good as we can:

  // Some channels put the ShortText in quotes and use either the ShortText
  // or the Description field, depending on how long the string is:
  //
  // Title
  // "ShortText". Description
  //
  if ((shortText == NULL) != (description == NULL)) {
     char *p = shortText ? shortText : description;
     if (*p == '"') {
        const char *delim = "\".";
        char *e = strstr(p + 1, delim);
        if (e) {
           *e = 0;
           char *s = strdup(p + 1);
           char *d = strdup(e + strlen(delim));
           free(shortText);
           free(description);
           shortText = s;
           description = d;
           EpgBugFixStat(1, ChannelID());
           }
        }
     }

  // Some channels put the Description into the ShortText (preceded
  // by a blank) if there is no actual ShortText and the Description
  // is short enough:
  //
  // Title
  //  Description
  //
  if (shortText && !description) {
     if (*shortText == ' ') {
        memmove(shortText, shortText + 1, strlen(shortText));
        description = shortText;
        shortText = NULL;
        EpgBugFixStat(2, ChannelID());
        }
     }

  // Sometimes they repeat the Title in the ShortText:
  //
  // Title
  // Title
  //
  if (shortText && strcmp(title, shortText) == 0) {
     free(shortText);
     shortText = NULL;
     EpgBugFixStat(3, ChannelID());
     }

  // Some channels put the ShortText between double quotes, which is nothing
  // but annoying (some even put a '.' after the closing '"'):
  //
  // Title
  // "ShortText"[.]
  //
  if (shortText && *shortText == '"') {
     int l = strlen(shortText);
     if (l > 2 && (shortText[l - 1] == '"' || (shortText[l - 1] == '.' && shortText[l - 2] == '"'))) {
        memmove(shortText, shortText + 1, l);
        char *p = strrchr(shortText, '"');
        if (p)
           *p = 0;
        EpgBugFixStat(4, ChannelID());
        }
     }

  if (Setup.EPGBugfixLevel <= 1)
     return;

  // Some channels apparently try to do some formatting in the texts,
  // which is a bad idea because they have no way of knowing the width
  // of the window that will actually display the text.
  // Remove excess whitespace:
  title = compactspace(title);
  shortText = compactspace(shortText);
  description = compactspace(description);

#define MAX_USEFUL_EPISODE_LENGTH 40
  // 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 (!isempty(shortText) && isempty(description)) {
     if (strlen(shortText) > MAX_USEFUL_EPISODE_LENGTH) {
        free(description);
        description = shortText;
        shortText = NULL;
        EpgBugFixStat(6, ChannelID());
        }
     }

  // Some channels put the same information into ShortText and Description.
  // In that case we delete one of them:
  if (shortText && description && strcmp(shortText, description) == 0) {
     if (strlen(shortText) > MAX_USEFUL_EPISODE_LENGTH) {
        free(shortText);
        shortText = NULL;
        }
     else {
        free(description);
        description = NULL;
        }
     EpgBugFixStat(7, ChannelID());
     }

  // Some channels use the ` ("backtick") character, where a ' (single quote)
  // would be normally used. Actually, "backticks" in normal text don't make
  // much sense, so let's replace them:
  strreplace(title, '`', '\'');
  strreplace(shortText, '`', '\'');
  strreplace(description, '`', '\'');

  if (Setup.EPGBugfixLevel <= 2)
     return;

  // The stream components have a "description" field which some channels
  // apparently have no idea of how to set correctly:
  if (components) {
     for (int i = 0; i < components->NumComponents(); i++) {
         tComponent *p = components->Component(i);
         switch (p->stream) {
           case 0x01: { // video
                if (p->description) {
                   if (strcasecmp(p->description, "Video") == 0 ||
                        strcasecmp(p->description, "Bildformat") == 0) {
                      // Yes, we know it's video - that's what the 'stream' code
                      // is for! But _which_ video is it?
                      free(p->description);
                      p->description = NULL;
                      EpgBugFixStat(8, ChannelID());
                      }
                   }
                if (!p->description) {
                   switch (p->type) {
                     case 0x01:
                     case 0x05: p->description = strdup("4:3"); break;
                     case 0x02:
                     case 0x03:
                     case 0x06:
                     case 0x07: p->description = strdup("16:9"); break;
                     case 0x04:
                     case 0x08: p->description = strdup(">16:9"); break;
                     case 0x09:
                     case 0x0D: p->description = strdup("HD 4:3"); break;
                     case 0x0A:
                     case 0x0B:
                     case 0x0E:
                     case 0x0F: p->description = strdup("HD 16:9"); break;
                     case 0x0C:
                     case 0x10: p->description = strdup("HD >16:9"); break;
                     }
                   EpgBugFixStat(9, ChannelID());
                   }
                }
                break;
           case 0x02: { // audio
                if (p->description) {
                   if (strcasecmp(p->description, "Audio") == 0) {
                      // Yes, we know it's audio - that's what the 'stream' code
                      // is for! But _which_ audio is it?
                      free(p->description);
                      p->description = NULL;
                      EpgBugFixStat(10, ChannelID());
                      }
                   }
                if (!p->description) {
                   switch (p->type) {
                     case 0x05: p->description = strdup("Dolby Digital"); break;
                     // all others will just display the language
                     }
                   EpgBugFixStat(11, ChannelID());
                   }
                }
                break;
           }
         }
     }
}
Beispiel #12
0
void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
{
  if (!(Source() && Transponder()))
     return;
  SI::SDT sdt(Data, false);
  if (!sdt.CheckCRCAndParse())
     return;
  if (!sectionSyncer.Sync(sdt.getVersionNumber(), sdt.getSectionNumber(), sdt.getLastSectionNumber()))
     return;
  if (!Channels.Lock(true, 10))
     return;
  SI::SDT::Service SiSdtService;
  for (SI::Loop::Iterator it; sdt.serviceLoop.getNext(SiSdtService, it); ) {
      cChannel *channel = Channels.GetByChannelID(tChannelID(Source(), sdt.getOriginalNetworkId(), sdt.getTransportStreamId(), SiSdtService.getServiceId()));
      if (!channel)
         channel = Channels.GetByChannelID(tChannelID(Source(), 0, Transponder(), SiSdtService.getServiceId()));

      cLinkChannels *LinkChannels = NULL;
      SI::Descriptor *d;
      for (SI::Loop::Iterator it2; (d = SiSdtService.serviceDescriptors.getNext(it2)); ) {
          switch (d->getDescriptorTag()) {
            case SI::ServiceDescriptorTag: {
                 SI::ServiceDescriptor *sd = (SI::ServiceDescriptor *)d;
                 switch (sd->getServiceType()) {
                   case 0x01: // digital television service
                   case 0x02: // digital radio sound service
                   case 0x04: // NVOD reference service
                   case 0x05: // NVOD time-shifted service
                        {
                        char NameBuf[1024];
                        char ShortNameBuf[1024];
                        char ProviderNameBuf[1024];
                        sd->serviceName.getText(NameBuf, ShortNameBuf, sizeof(NameBuf), sizeof(ShortNameBuf));
                        char *pn = compactspace(NameBuf);
                        char *ps = compactspace(ShortNameBuf);
                        if (!*ps && cSource::IsCable(Source())) {
                           // Some cable providers don't mark short channel names according to the
                           // standard, but rather go their own way and use "name>short name" or
                           // "name, short name":
                           char *p = strchr(pn, '>'); // fix for UPC Wien
                           if (!p)
                              p = strchr(pn, ','); // fix for "Kabel Deutschland"
                           if (p && p > pn) {
                              *p++ = 0;
                              strcpy(ShortNameBuf, skipspace(p));
                              }
                           }
                        sd->providerName.getText(ProviderNameBuf, sizeof(ProviderNameBuf));
                        char *pp = compactspace(ProviderNameBuf);
                        if (channel) {
                           channel->SetId(sdt.getOriginalNetworkId(), sdt.getTransportStreamId(), SiSdtService.getServiceId());
                           if (Setup.UpdateChannels == 1 || Setup.UpdateChannels >= 3)
                              channel->SetName(pn, ps, pp);
                           // Using SiSdtService.getFreeCaMode() is no good, because some
                           // tv stations set this flag even for non-encrypted channels :-(
                           // The special value 0xFFFF was supposed to mean "unknown encryption"
                           // and would have been overwritten with real CA values later:
                           // channel->SetCa(SiSdtService.getFreeCaMode() ? 0xFFFF : 0);
                           }
                        else if (*pn && Setup.UpdateChannels >= 4) {
                           channel = Channels.NewChannel(Channel(), pn, ps, pp, sdt.getOriginalNetworkId(), sdt.getTransportStreamId(), SiSdtService.getServiceId());
                           patFilter->Trigger();
                           }
                        }
                   }
                 }
                 break;
            // Using the CaIdentifierDescriptor is no good, because some tv stations
            // just don't use it. The actual CA values are collected in pat.c:
            /*
            case SI::CaIdentifierDescriptorTag: {
                 SI::CaIdentifierDescriptor *cid = (SI::CaIdentifierDescriptor *)d;
                 if (channel) {
                    for (SI::Loop::Iterator it; cid->identifiers.hasNext(it); )
                        channel->SetCa(cid->identifiers.getNext(it));
                    }
                 }
                 break;
            */
            case SI::NVODReferenceDescriptorTag: {
                 SI::NVODReferenceDescriptor *nrd = (SI::NVODReferenceDescriptor *)d;
                 SI::NVODReferenceDescriptor::Service Service;
                 for (SI::Loop::Iterator it; nrd->serviceLoop.getNext(Service, it); ) {
                     cChannel *link = Channels.GetByChannelID(tChannelID(Source(), Service.getOriginalNetworkId(), Service.getTransportStream(), Service.getServiceId()));
                     if (!link && Setup.UpdateChannels >= 4) {
                        link = Channels.NewChannel(Channel(), "NVOD", "", "", Service.getOriginalNetworkId(), Service.getTransportStream(), Service.getServiceId());
                        patFilter->Trigger();
                        }
                     if (link) {
                        if (!LinkChannels)
                           LinkChannels = new cLinkChannels;
                        LinkChannels->Add(new cLinkChannel(link));
                        }
                     }
                 }
                 break;
            default: ;
            }
          delete d;
          }
      if (LinkChannels) {
         if (channel)
            channel->SetLinkChannels(LinkChannels);
         else
            delete LinkChannels;
         }
      }
  Channels.Unlock();
}
Beispiel #13
0
void cRssParserItem::SetLink(const char *strP)
{
  Utf8Strn0Cpy(linkM, strP, sizeof(linkM));
  compactspace(linkM);
  Utf8Strn0Cpy(linkM, convM.Convert(linkM), sizeof(linkM));
}
Beispiel #14
0
void cRssParserItem::SetDate(const char *strP)
{
  Utf8Strn0Cpy(dateM, strP, sizeof(dateM));
  compactspace(dateM);
  Utf8Strn0Cpy(dateM, convM.Convert(dateM), sizeof(dateM));
}