From 90164158b340e6e2cefd4a663aec40ee6fa096d1 Mon Sep 17 00:00:00 2001 From: seife Date: Sun, 10 Apr 2011 18:10:25 +0000 Subject: [PATCH] epgview: rework hasFollowScreenings() and FollowScreenings() the current code has differences in hasFollowScreenings() and FollowScreenings() leading to different results. hasFollow() returns true but Follow() then notices that there are actually no repeats. Fix this by making hasFollowScreenings() generate a list "followlist" containing all repeats and FollowScreenings() use that list. An added benefit is that the requested feature to add a possibility to select one of the follow-ups for a record timer will be also able to use that list ;-) git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1383 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/gui/epgview.cpp | 61 ++++++++++++++++++++++----------------------- src/gui/epgview.h | 1 + 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 90691dbfc..6158160ab 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -420,17 +420,6 @@ const neutrino_locale_t * genre_sub_classes_list[10] = genre_travel_hobbies }; -bool CEpgData::hasFollowScreenings(const t_channel_id /*channel_id*/, const std::string & title) { - time_t curtime = time(NULL); - - for (CChannelEventList::iterator e = evtlist.begin(); e != evtlist.end(); ++e ) - { - if (e->startTime > curtime && e->eventID && e->description == title) - return true; - } - return false; -} - const char * GetGenre(const unsigned char contentClassification) // UTF-8 { neutrino_locale_t res; @@ -1070,8 +1059,24 @@ void CEpgData::GetPrevNextEPGData( uint64_t id, time_t* startzeit ) // -- 2002-05-03 rasc // -int CEpgData::FollowScreenings (const t_channel_id /*channel_id*/, const std::string & title) +bool CEpgData::hasFollowScreenings(const t_channel_id /*channel_id*/, const std::string &title) +{ + CChannelEventList::iterator e; + followlist.clear(); + for (e = evtlist.begin(); e != evtlist.end(); ++e) + { + if (e->startTime <= tmp_curent_zeit) + continue; + if (! e->eventID) + continue; + if (e->description != title) + continue; + followlist.push_back(*e); + } + return !followlist.empty(); +} +int CEpgData::FollowScreenings (const t_channel_id /*channel_id*/, const std::string & title) { CChannelEventList::iterator e; struct tm *tmStartZeit; @@ -1082,32 +1087,26 @@ int CEpgData::FollowScreenings (const t_channel_id /*channel_id*/, const std::st screening_dates = screening_nodual = ""; // alredy read: evtlist = g_Sectionsd->getEventsServiceKey( channel_id&0xFFFFFFFFFFFFULL ); - for ( e= evtlist.begin(); e != evtlist.end(); ++e ) + for (e = followlist.begin(); e != followlist.end(); ++e) { - if (e->startTime <= tmp_curent_zeit) continue; - if (! e->eventID) continue; - if (e->description == title) { - count++; - tmStartZeit = localtime(&(e->startTime)); + count++; + tmStartZeit = localtime(&(e->startTime)); - screening_dates = g_Locale->getText(CLocaleManager::getWeekday(tmStartZeit)); - screening_dates += '.'; + screening_dates = g_Locale->getText(CLocaleManager::getWeekday(tmStartZeit)); + screening_dates += '.'; - strftime(tmpstr, sizeof(tmpstr), " %d.", tmStartZeit ); - screening_dates += tmpstr; + strftime(tmpstr, sizeof(tmpstr), " %d.", tmStartZeit ); + screening_dates += tmpstr; - screening_dates += g_Locale->getText(CLocaleManager::getMonth(tmStartZeit)); + screening_dates += g_Locale->getText(CLocaleManager::getMonth(tmStartZeit)); - strftime(tmpstr, sizeof(tmpstr), ". %H:%M", tmStartZeit ); - screening_dates += tmpstr; - if (screening_dates != screening_nodual) { - screening_nodual=screening_dates; - processTextToArray(screening_dates, true ); // UTF-8 - } + strftime(tmpstr, sizeof(tmpstr), ". %H:%M", tmStartZeit ); + screening_dates += tmpstr; + if (screening_dates != screening_nodual) { + screening_nodual=screening_dates; + processTextToArray(screening_dates, true ); // UTF-8 } } - if (count == 0) - processTextToArray("---\n"); // UTF-8 return count; } diff --git a/src/gui/epgview.h b/src/gui/epgview.h index 4590ba50f..ddc475a86 100644 --- a/src/gui/epgview.h +++ b/src/gui/epgview.h @@ -54,6 +54,7 @@ class CEpgData private: CFrameBuffer *frameBuffer; CChannelEventList evtlist; + CChannelEventList followlist; CEPGData epgData; std::string epg_date;