1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

EPG info is now updated if the contents changes but the ID remains the same

This commit is contained in:
Klaus Schmidinger 2001-09-22 13:07:43 +02:00
parent 935cfc2683
commit 14992a8037
6 changed files with 48 additions and 72 deletions

View File

@ -773,3 +773,4 @@ Video Disk Recorder Revision History
- Supplying the new frontend parameter 'Inversion' (currently it is always - Supplying the new frontend parameter 'Inversion' (currently it is always
set to INVERSION_AUTO, which should work with all channels on Astra). set to INVERSION_AUTO, which should work with all channels on Astra).
- Removing unnecessary double quotes from EPG Subtitle in EPGBugfixLevel >=1. - Removing unnecessary double quotes from EPG Subtitle in EPGBugfixLevel >=1.
- EPG info is now updated if the contents changes but the ID remains the same.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: config.h 1.79 2001/09/16 14:54:36 kls Exp $ * $Id: config.h 1.80 2001/09/22 13:00:04 kls Exp $
*/ */
#ifndef __CONFIG_H #ifndef __CONFIG_H
@ -19,7 +19,7 @@
#include "eit.h" #include "eit.h"
#include "tools.h" #include "tools.h"
#define VDRVERSION "0.95" #define VDRVERSION "0.96"
#define MAXPRIORITY 99 #define MAXPRIORITY 99
#define MAXLIFETIME 99 #define MAXLIFETIME 99

89
eit.c
View File

@ -16,7 +16,7 @@
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* $Id: eit.c 1.23 2001/09/22 10:28:33 kls Exp $ * $Id: eit.c 1.24 2001/09/22 13:07:21 kls Exp $
***************************************************************************/ ***************************************************************************/
#include "eit.h" #include "eit.h"
@ -279,59 +279,19 @@ unsigned short cEventInfo::GetEventID() const
return uEventID; return uEventID;
} }
/** */ /** */
bool cEventInfo::SetTitle(const char *string) void cEventInfo::SetTitle(const char *string)
{ {
if (string == NULL) pTitle = strcpyrealloc(pTitle, string);
return false;
pTitle = strdup(string);
if (pTitle == NULL)
return false;
return true;
} }
/** */ /** */
bool cEventInfo::SetSubtitle(const char *string) void cEventInfo::SetSubtitle(const char *string)
{ {
if (string == NULL) pSubtitle = strcpyrealloc(pSubtitle, string);
return false;
pSubtitle = strdup(string);
if (pSubtitle == NULL)
return false;
return true;
} }
/** */ /** */
bool cEventInfo::AddExtendedDescription(const char *string) void cEventInfo::SetExtendedDescription(const char *string)
{ {
int size = 0; pExtendedDescription = strcpyrealloc(pExtendedDescription, string);
bool first = true;
char *p;
if (string == NULL)
return false;
if (pExtendedDescription)
{
first = false;
size += strlen(pExtendedDescription);
}
size += (strlen(string) + 1);
p = (char *)realloc(pExtendedDescription, size);
if (p == NULL)
return false;
if (first)
*p = 0;
strcat(p, string);
pExtendedDescription = p;
return true;
} }
/** */ /** */
void cEventInfo::SetTime(time_t t) void cEventInfo::SetTime(time_t t)
@ -783,28 +743,29 @@ int cEIT::ProcessEIT(unsigned char *buffer)
} }
pEvent = (cEventInfo *)pSchedule->GetEvent((unsigned short)VdrProgramInfo->EventID); pEvent = (cEventInfo *)pSchedule->GetEvent((unsigned short)VdrProgramInfo->EventID);
if (!pEvent) { if (!pEvent) {
// If we don't have that event ID yet, we create a new one.
// Otherwise we copy the information into the existing event anyway, because the data might have changed.
pSchedule->Events.Add(new cEventInfo(VdrProgramInfo->ServiceID, VdrProgramInfo->EventID)); pSchedule->Events.Add(new cEventInfo(VdrProgramInfo->ServiceID, VdrProgramInfo->EventID));
pEvent = (cEventInfo *)pSchedule->GetEvent((unsigned short)VdrProgramInfo->EventID); pEvent = (cEventInfo *)pSchedule->GetEvent((unsigned short)VdrProgramInfo->EventID);
if (!pEvent) if (!pEvent)
break; break;
if (rEvent) {
pEvent->SetTitle(rEvent->GetTitle());
pEvent->SetSubtitle(rEvent->GetSubtitle());
pEvent->SetTime(VdrProgramInfo->StartTime);
pEvent->SetDuration(VdrProgramInfo->Duration);
pEvent->AddExtendedDescription(rEvent->GetExtendedDescription());
pEvent->FixEpgBugs();
}
else {
pEvent->SetTitle(VdrProgramInfo->ShortName);
pEvent->SetSubtitle(VdrProgramInfo->ShortText);
pEvent->SetTime(VdrProgramInfo->StartTime);
pEvent->SetDuration(VdrProgramInfo->Duration);
pEvent->AddExtendedDescription(VdrProgramInfo->ExtendedName);
pEvent->AddExtendedDescription(VdrProgramInfo->ExtendedText);
pEvent->FixEpgBugs();
}
} }
if (rEvent) {
pEvent->SetTitle(rEvent->GetTitle());
pEvent->SetSubtitle(rEvent->GetSubtitle());
pEvent->SetExtendedDescription(rEvent->GetExtendedDescription());
}
else {
pEvent->SetTitle(VdrProgramInfo->ShortName);
pEvent->SetSubtitle(VdrProgramInfo->ShortText);
pEvent->SetExtendedDescription(VdrProgramInfo->ExtendedName);
//XXX kls 2001-09-22:
//XXX apparently this never occurred, so I have simpified ExtendedDescription handling
//XXX pEvent->AddExtendedDescription(VdrProgramInfo->ExtendedText);
}
pEvent->SetTime(VdrProgramInfo->StartTime);
pEvent->SetDuration(VdrProgramInfo->Duration);
pEvent->FixEpgBugs();
if (IsPresentFollowing()) { if (IsPresentFollowing()) {
if ((GetRunningStatus(VdrProgramInfo->Status) == RUNNING_STATUS_PAUSING) || (GetRunningStatus(VdrProgramInfo->Status) == RUNNING_STATUS_RUNNING)) if ((GetRunningStatus(VdrProgramInfo->Status) == RUNNING_STATUS_PAUSING) || (GetRunningStatus(VdrProgramInfo->Status) == RUNNING_STATUS_RUNNING))
pSchedule->SetPresentEvent(pEvent); pSchedule->SetPresentEvent(pEvent);

8
eit.h
View File

@ -16,7 +16,7 @@
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* $Id: eit.h 1.10 2001/08/15 15:47:31 kls Exp $ * $Id: eit.h 1.11 2001/09/22 11:43:21 kls Exp $
***************************************************************************/ ***************************************************************************/
#ifndef __EIT_H #ifndef __EIT_H
@ -42,13 +42,13 @@ private:
protected: protected:
void SetFollowing(bool foll); void SetFollowing(bool foll);
void SetPresent(bool pres); void SetPresent(bool pres);
bool SetTitle(const char *string); void SetTitle(const char *string);
void SetServiceID(unsigned short servid); void SetServiceID(unsigned short servid);
void SetEventID(unsigned short evid); void SetEventID(unsigned short evid);
void SetDuration(long l); void SetDuration(long l);
void SetTime(time_t t); void SetTime(time_t t);
bool AddExtendedDescription(const char *string); void SetExtendedDescription(const char *string);
bool SetSubtitle(const char *string); void SetSubtitle(const char *string);
cEventInfo(unsigned short serviceid, unsigned short eventid); cEventInfo(unsigned short serviceid, unsigned short eventid);
public: public:
~cEventInfo(); ~cEventInfo();

15
tools.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: tools.c 1.45 2001/09/15 15:41:16 kls Exp $ * $Id: tools.c 1.46 2001/09/22 12:13:40 kls Exp $
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -64,6 +64,19 @@ char *readline(FILE *f)
return NULL; return NULL;
} }
char *strcpyrealloc(char *dest, const char *src)
{
if (src) {
int l = max(dest ? strlen(dest) : 0, strlen(src)) + 1; // don't let the block get smaller!
dest = (char *)realloc(dest, l);
if (dest)
strcpy(dest, src);
else
esyslog(LOG_ERR, "ERROR: out of memory");
}
return dest;
}
char *strn0cpy(char *dest, const char *src, size_t n) char *strn0cpy(char *dest, const char *src, size_t n)
{ {
char *s = dest; char *s = dest;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: tools.h 1.34 2001/09/15 15:22:57 kls Exp $ * $Id: tools.h 1.35 2001/09/22 12:12:55 kls Exp $
*/ */
#ifndef __TOOLS_H #ifndef __TOOLS_H
@ -44,6 +44,7 @@ ssize_t safe_read(int filedes, void *buffer, size_t size);
ssize_t safe_write(int filedes, const void *buffer, size_t size); ssize_t safe_write(int filedes, const void *buffer, size_t size);
void writechar(int filedes, char c); void writechar(int filedes, char c);
char *readline(FILE *f); char *readline(FILE *f);
char *strcpyrealloc(char *dest, const char *src);
char *strn0cpy(char *dest, const char *src, size_t n); char *strn0cpy(char *dest, const char *src, size_t n);
char *strreplace(char *s, char c1, char c2); char *strreplace(char *s, char c1, char c2);
char *skipspace(const char *s); char *skipspace(const char *s);