From cbc6f442648a0aea4b94d81176f044c642a7d2b0 Mon Sep 17 00:00:00 2001 From: kamel5 Date: Thu, 8 Mar 2018 13:02:38 +0100 Subject: Compile under VDR 2.3.1 --- searchtimer.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'searchtimer.c') diff --git a/searchtimer.c b/searchtimer.c index 7e9b4db..1af3f86 100644 --- a/searchtimer.c +++ b/searchtimer.c @@ -16,8 +16,14 @@ cTVGuideSearchTimer::cTVGuideSearchTimer(void) { startTime = 0000; stopTime = 2359; useChannel = false; +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_CHANNELS_READ; + channelMin = Channels->GetByNumber(cDevice::CurrentChannel()); + channelMax = Channels->GetByNumber(cDevice::CurrentChannel()); +#else channelMin = Channels.GetByNumber(cDevice::CurrentChannel()); channelMax = Channels.GetByNumber(cDevice::CurrentChannel()); +#endif channelGroup = ""; useCase = false; mode = 0; @@ -239,7 +245,12 @@ bool cTVGuideSearchTimer::Parse(bool readTemplate) { char *channelMinbuffer = NULL; char *channelMaxbuffer = NULL; int channels = sscanf(values[value].c_str(), "%a[^|]|%a[^|]", &channelMinbuffer, &channelMaxbuffer); +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_CHANNELS_READ; + channelMin = Channels->GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true); +#else channelMin = Channels.GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true); +#endif if (!channelMin) { channelMin = channelMax = NULL; useChannel = 0; @@ -247,7 +258,11 @@ bool cTVGuideSearchTimer::Parse(bool readTemplate) { if (channels == 1) channelMax = channelMin; else { +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + channelMax = Channels->GetByChannelID(tChannelID::FromString(channelMaxbuffer), true, true); +#else channelMax = Channels.GetByChannelID(tChannelID::FromString(channelMaxbuffer), true, true); +#endif if (!channelMax) { channelMin = channelMax = NULL; useChannel = 0; @@ -511,7 +526,12 @@ int cTVGuideSearchTimer::GetNumTimers(void) { int numTimers = 0; if (ID < 0) return numTimers; +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_TIMERS_READ; + for (const cTimer *timer = Timers->First(); timer; timer = Timers->Next(timer)) { +#else for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) { +#endif char* searchID = GetAuxValue(timer, "s-id"); if (!searchID) continue; if (ID == atoi(searchID)) @@ -525,7 +545,12 @@ int cTVGuideSearchTimer::GetNumRecordings(void) { int numRecordings = 0; if (ID < 0) return numRecordings; +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_RECORDINGS_READ; + for (const cRecording *recording = Recordings->First(); recording; recording = Recordings->Next(recording)) { +#else for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) { +#endif if (recording->IsEdited()) continue; if (!recording->Info()) @@ -568,3 +593,22 @@ void cTVGuideSearchTimer::Dump(void) { esyslog("tvguide searchtimer: useDescription: %d", useDescription); } +void cTVGuideSearchTimer::SetStartChannel(int startChannel) +{ +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_CHANNELS_READ; + channelMin = Channels->GetByNumber(startChannel); +#else + channelMin = Channels.GetByNumber(startChannel); +#endif +}; + +void cTVGuideSearchTimer::SetStopChannel(int stopChannel) +{ +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_CHANNELS_READ; + channelMax = Channels->GetByNumber(stopChannel); +#else + channelMax = Channels.GetByNumber(stopChannel); +#endif +}; -- cgit v1.2.3