From 3be2cb060c30581bd1c59c72a90b0d0c3f79bd45 Mon Sep 17 00:00:00 2001 From: Christian Wieninger Date: Sun, 13 Jan 2008 13:46:22 +0100 Subject: - code for collecting and displaying EPG events in 'What's on' is now separated --- epg_events.cpp | 10 +++ epg_events.h | 10 ++- epgsearch.cpp | 20 ++++-- epgsearch.h | 2 + pages/whats_on.ecpp | 172 +++++++++++++++++++--------------------------------- po/ca_ES.po | 12 ---- po/cs_CZ.po | 12 ---- po/da_DK.po | 12 ---- po/de_DE.po | 15 +---- po/el_GR.po | 12 ---- po/es_ES.po | 12 ---- po/et_EE.po | 12 ---- po/fi_FI.po | 17 ++---- po/fr_FR.po | 17 ++---- po/hr_HR.po | 12 ---- po/hu_HU.po | 12 ---- po/it_IT.po | 17 ++---- po/nl_NL.po | 12 ---- po/nn_NO.po | 12 ---- po/pl_PL.po | 12 ---- po/pt_PT.po | 12 ---- po/ro_RO.po | 12 ---- po/ru_RU.po | 12 ---- po/sl_SI.po | 12 ---- po/sv_SE.po | 12 ---- po/tr_TR.po | 12 ---- 26 files changed, 113 insertions(+), 371 deletions(-) diff --git a/epg_events.cpp b/epg_events.cpp index 7d22cdf..9496714 100644 --- a/epg_events.cpp +++ b/epg_events.cpp @@ -98,6 +98,11 @@ namespace vdrlive return ""; } + const cChannel* EpgString::Channel() const + { + return NULL; + } + // virtual const std::string Archived() const { return std::string(); } time_t EpgString::GetStartTime() const @@ -164,6 +169,11 @@ namespace vdrlive return (info && info->Description()) ? info->Description() : ""; } + const cChannel* EpgRecording::Channel() const + { + return NULL; + } + const string EpgRecording::Archived() const { if (!m_checkedArchived) { diff --git a/epg_events.h b/epg_events.h index 15e4b36..f1b8bdf 100644 --- a/epg_events.h +++ b/epg_events.h @@ -35,6 +35,8 @@ namespace vdrlive virtual std::string const LongDescr() const = 0; + virtual const cChannel* Channel() const = 0; + virtual std::string const Archived() const { return ""; } virtual std::string const StartTime(const char* format) const; @@ -82,6 +84,8 @@ namespace vdrlive virtual time_t GetEndTime() const; + virtual const cChannel* Channel() const; + private: const std::string m_info; }; @@ -95,7 +99,7 @@ namespace vdrlive protected: EpgEvent(std::string const &id, cEvent const *event, - char const *channelName = ""); + const char* channelName); public: virtual ~EpgEvent(); @@ -110,6 +114,8 @@ namespace vdrlive virtual time_t GetEndTime() const { return m_event->EndTime(); } + virtual const cChannel* Channel() const { return Channels.GetByChannelID(m_event->ChannelID());} + private: const cEvent* m_event; }; @@ -144,6 +150,8 @@ namespace vdrlive virtual time_t GetEndTime() const; + virtual const cChannel* Channel() const; + private: const cRecording* m_recording; bool m_ownCaption; diff --git a/epgsearch.cpp b/epgsearch.cpp index e905bd9..622ef21 100644 --- a/epgsearch.cpp +++ b/epgsearch.cpp @@ -557,10 +557,10 @@ Blacklists::Blacklists() SearchResult::SearchResult( string const& data ) { - vector< string > parts = StringSplit( data, ':' ); - try { - vector< string >::const_iterator part = parts.begin(); - for ( int i = 0; part != parts.end(); ++i, ++part ) { + vector< string > parts = StringSplit( data, ':' ); + try { + vector< string >::const_iterator part = parts.begin(); + for ( int i = 0; part != parts.end(); ++i, ++part ) { switch ( i ) { case 0: m_searchId = lexical_cast< int >( *part ); break; case 1: m_eventId = lexical_cast< u_int32_t >( *part ); break; @@ -580,6 +580,18 @@ SearchResult::SearchResult( string const& data ) } } +const cEvent* SearchResult::GetEvent() +{ + cSchedulesLock schedulesLock; + const cSchedules* Schedules = cSchedules::Schedules(schedulesLock); + if (!Schedules) return NULL; + const cChannel *Channel = GetChannel(); + if (!Channel) return NULL; + const cSchedule *Schedule = Schedules->GetSchedule(Channel); + if (!Schedule) return NULL; + return Schedule->GetEvent(m_eventId); +} + std::set SearchResults::querySet; void SearchResults::GetByID(int id) diff --git a/epgsearch.h b/epgsearch.h index 51c73cf..b63f109 100644 --- a/epgsearch.h +++ b/epgsearch.h @@ -339,6 +339,8 @@ public: time_t TimerStopTime() const { return m_timerstop; } int TimerMode() const { return m_timerMode; } bool operator<( SearchResult const& other ) const { return m_starttime < other.m_starttime; } + const cEvent* GetEvent(); + const cChannel* GetChannel() { return Channels.GetByChannelID(m_channel); } private: int m_searchId; diff --git a/pages/whats_on.ecpp b/pages/whats_on.ecpp index a902ae6..4a7948f 100644 --- a/pages/whats_on.ecpp +++ b/pages/whats_on.ecpp @@ -106,7 +106,9 @@ if (type == "now") { % } <%cpp> EpgEvents epgEvents; + std::list eventList; + // collect the broadcasts if (type != "favs") { ReadLock channelsLock( Channels ); @@ -132,68 +134,12 @@ if (type == "now") { } EpgInfoPtr epgEvent = EpgEvents::CreateEpgInfo(Channel, Event); - - bool truncated = false; - string truncDescription = StringWordTruncate(epgEvent->LongDescr(), maximumTooltipHintLength, truncated); - string longDescription = StringEscapeAndBreak(StringWordTruncate(epgEvent->LongDescr(), maximumDescriptionLength)) - + "

" + tr("Click to view details."); - bool lastCurrentChanel = true; - - if (mode == "detail") { - -
- -
-
- <& pageelems.epg_tool_box detail=(1) epgid=(epgEvent->Id()) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) &> -
-
-
<$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $>
-% if (epgEvent->Elapsed() >= 0) { -
<& pageelems.progressbar progress=(epgEvent->Elapsed()) &>
-% } -
<$ (epgEvent->Title()) $>
-
<$ (epgEvent->ShortDescr()) $>
-
<$ truncDescription $>
-% if (truncated) { - -% } -
-
-
-<%cpp> - } - else { // mode == "list" - lastCurrentChanel = ((Channel->Number() == LiveSetup().GetLastChannel()) - || (!Channels.Next(Channel))); - - - <& pageelems.epg_tool_box detail=(0) epgid=(epgEvent->Id()) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) lastCurrentChanel=(lastCurrentChanel ? 1 : 0) &> - "> -
-
<$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $>
-% if (epgEvent->Elapsed() >= 0) { -
<& pageelems.progressbar progress=(epgEvent->Elapsed()) &>
-% } -
- - "> - - - "> - -% } -<%cpp> - } + eventList.push_back(epgEvent); + } } - } - else { + } + else // get favorite broadcasts from epgsearch + { SearchResults results; SearchTimers timers; for (SearchTimers::iterator timer = timers.begin(); timer != timers.end(); ++timer) { @@ -205,68 +151,76 @@ if (type == "now") { time_t now = time(NULL); for (SearchResults::iterator result = results.begin(); result != results.end(); ++result) { long diff = result->StartTime() - now; - long absdiff = labs(diff); - if (absdiff >= 24*60*60) continue; // skip broadcasts more than a day away + if (labs(diff) >= 24*60*60) continue; // skip broadcasts more than a day away + EpgInfoPtr epgEvent = EpgEvents::CreateEpgInfo(result->GetChannel(), result->GetEvent()); + eventList.push_back(epgEvent); + } + } - string diffstring = string((diff > 0) ? tr("in") : tr("since")) + " "; - if (absdiff >= (60 * 60)) - diffstring += lexical_cast(long(absdiff / (60*60))) + " " + tr("hours"); - else - diffstring += lexical_cast(long(absdiff / 60)) + " " + tr("minutes"); + // display broadcasts + for(std::list::iterator i = eventList.begin(); i != eventList.end(); ++i ) { + EpgInfoPtr epgEvent = *i; - string epgId = EpgEvents::EncodeDomId(result->Channel(), result->EventId()); - string channelname = Channels.GetByChannelID(result->Channel())->Name(); - int channelnr = Channels.GetByChannelID(result->Channel())->Number(); - bool truncated = false; - string truncDescription = StringWordTruncate(result->Description(), maximumTooltipHintLength, truncated); - string longDescription = StringEscapeAndBreak(StringWordTruncate(result->Description(), maximumDescriptionLength)) - + "

" + tr("Click to view details."); + bool truncated = false; + string truncDescription = StringWordTruncate(epgEvent->LongDescr(), maximumTooltipHintLength, truncated); + string longDescription = StringEscapeAndBreak(StringWordTruncate(epgEvent->LongDescr(), maximumDescriptionLength)) + + "

" + tr("Click to view details."); + bool lastCurrentChanel = true; + const cChannel* Channel = epgEvent->Channel(); + if (!Channel) continue; + int chNumber = Channel->Number(); - // last result? - SearchResults::iterator nextres = result; - bool bottom = (++nextres == results.end()); - if (mode == "list") { + if (mode == "detail") { - - <& pageelems.epg_tool_box detail=(0) epgid=(epgId) title=(result->Title()) startTime=(result->StartTime()) endTime=(result->StopTime()) lastCurrentChanel=(bottom ? 1 : 0) &> - "> -
-
<$ (FormatDateTime(tr("%I:%M %p"), result->StartTime())) $> - <$ (FormatDateTime(tr("%I:%M %p"), result->StopTime())) $>
- <$ diffstring $> -
- - "> - - - "> - -% } else {
- <& pageelems.epg_tool_box detail=(1) epgid=(epgId) title=(result->Title()) startTime=(result->StartTime()) endTime=(result->StopTime()) &> + <& pageelems.epg_tool_box detail=(1) epgid=(epgEvent->Id()) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) &>
-
<$ (FormatDateTime(tr("%I:%M %p"), result->StartTime())) $> - <$ (FormatDateTime(tr("%I:%M %p"), result->StopTime())) $>
-
<$ diffstring $>
-
<$ (result->Title()) $>
-
<$ (result->ShortText()) $>
+
<$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $>
+% if (epgEvent->Elapsed() >= 0) { +
<& pageelems.progressbar progress=(epgEvent->Elapsed()) &>
+% } +
<$ (epgEvent->Title()) $>
+
<$ (epgEvent->ShortDescr()) $>
<$ truncDescription $>
-% if (truncated) { - -% } +% if (truncated) { + +% }
-
-<%cpp> } - } + +<%cpp> + } else { // mode == "list" + lastCurrentChanel = ((chNumber == LiveSetup().GetLastChannel()) || (!Channels.Next(Channel))); + + + <& pageelems.epg_tool_box detail=(0) epgid=(epgEvent->Id()) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) lastCurrentChanel=(lastCurrentChanel ? 1 : 0) &> + "> +
+
<$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $>
+% if (epgEvent->Elapsed() >= 0) { +
<& pageelems.progressbar progress=(epgEvent->Elapsed()) &>
+% } +
+ + "> + + + "> + + +% } +<%cpp> } % if (mode == "list") { diff --git a/po/ca_ES.po b/po/ca_ES.po index 332c188..c7f0fea 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -730,18 +730,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/cs_CZ.po b/po/cs_CZ.po index 6ec293f..63f6e48 100644 --- a/po/cs_CZ.po +++ b/po/cs_CZ.po @@ -728,18 +728,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/da_DK.po b/po/da_DK.po index 42da18b..0721988 100644 --- a/po/da_DK.po +++ b/po/da_DK.po @@ -728,18 +728,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/de_DE.po b/po/de_DE.po index 5e12058..85f8e5e 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -730,18 +730,6 @@ msgstr "Zeige Programm dieses Kanals" msgid "more" msgstr "mehr" -msgid "in" -msgstr "in" - -msgid "since" -msgstr "seit" - -msgid "hours" -msgstr "Stunden" - -msgid "minutes" -msgstr "Minuten" - msgid "Now" msgstr "Jetzt" @@ -760,5 +748,4 @@ msgstr "Ausf msgid "List view" msgstr "Listenansicht" -#~ msgid "RecDate" -#~ msgstr "Aufnahmedatum" + diff --git a/po/el_GR.po b/po/el_GR.po index 2ff384c..13ce479 100644 --- a/po/el_GR.po +++ b/po/el_GR.po @@ -728,18 +728,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/es_ES.po b/po/es_ES.po index a310953..9757140 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -728,18 +728,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/et_EE.po b/po/et_EE.po index f8c8175..40f1c66 100644 --- a/po/et_EE.po +++ b/po/et_EE.po @@ -728,18 +728,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/fi_FI.po b/po/fi_FI.po index 076cb58..5150a24 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -728,19 +728,6 @@ msgstr "N msgid "more" msgstr "lisätietoja" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -#, fuzzy -msgid "hours" -msgstr "Tekijät" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "Nyt" @@ -759,5 +746,9 @@ msgstr "Ruudukkon msgid "List view" msgstr "Listanäkymä" +#, fuzzy +#~ msgid "hours" +#~ msgstr "Tekijät" + #~ msgid "RecDate" #~ msgstr "Tallenteen päiväys" diff --git a/po/fr_FR.po b/po/fr_FR.po index 9847a19..f069f44 100644 --- a/po/fr_FR.po +++ b/po/fr_FR.po @@ -733,19 +733,6 @@ msgstr "Regarder le programme de cette cha msgid "more" msgstr "plus" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -#, fuzzy -msgid "hours" -msgstr "Auteur" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "maintenant" @@ -764,6 +751,10 @@ msgstr "Vue d msgid "List view" msgstr "Vue en liste" +#, fuzzy +#~ msgid "hours" +#~ msgstr "Auteur" + #, fuzzy #~ msgid "Watch channel" #~ msgstr "à la chaîne" diff --git a/po/hr_HR.po b/po/hr_HR.po index 261da91..214e876 100644 --- a/po/hr_HR.po +++ b/po/hr_HR.po @@ -729,18 +729,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/hu_HU.po b/po/hu_HU.po index 2a0f7db..e141102 100644 --- a/po/hu_HU.po +++ b/po/hu_HU.po @@ -729,18 +729,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/it_IT.po b/po/it_IT.po index 356bdf9..218bcee 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -731,19 +731,6 @@ msgstr "Visualizza scheda programmi del canale" msgid "more" msgstr "altro" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -#, fuzzy -msgid "hours" -msgstr "Autori" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "Adesso" @@ -762,5 +749,9 @@ msgstr "Vedi come dettagli" msgid "List view" msgstr "Vedi come elenco" +#, fuzzy +#~ msgid "hours" +#~ msgstr "Autori" + #~ msgid "RecDate" #~ msgstr "Data reg." diff --git a/po/nl_NL.po b/po/nl_NL.po index e5c5d33..7135d18 100644 --- a/po/nl_NL.po +++ b/po/nl_NL.po @@ -732,18 +732,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/nn_NO.po b/po/nn_NO.po index ae499ae..e1c2004 100644 --- a/po/nn_NO.po +++ b/po/nn_NO.po @@ -729,18 +729,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/pl_PL.po b/po/pl_PL.po index 2df7690..49d5ec7 100644 --- a/po/pl_PL.po +++ b/po/pl_PL.po @@ -728,18 +728,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/pt_PT.po b/po/pt_PT.po index a23902c..7b85c48 100644 --- a/po/pt_PT.po +++ b/po/pt_PT.po @@ -728,18 +728,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/ro_RO.po b/po/ro_RO.po index 406991f..f00598d 100644 --- a/po/ro_RO.po +++ b/po/ro_RO.po @@ -729,18 +729,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/ru_RU.po b/po/ru_RU.po index 1259d0f..c129782 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -728,18 +728,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/sl_SI.po b/po/sl_SI.po index 0408648..7364d71 100644 --- a/po/sl_SI.po +++ b/po/sl_SI.po @@ -729,18 +729,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/sv_SE.po b/po/sv_SE.po index 66b847f..b1aa5ba 100644 --- a/po/sv_SE.po +++ b/po/sv_SE.po @@ -729,18 +729,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" diff --git a/po/tr_TR.po b/po/tr_TR.po index 71125a2..94e5487 100644 --- a/po/tr_TR.po +++ b/po/tr_TR.po @@ -728,18 +728,6 @@ msgstr "" msgid "more" msgstr "" -msgid "in" -msgstr "" - -msgid "since" -msgstr "" - -msgid "hours" -msgstr "" - -msgid "minutes" -msgstr "" - msgid "Now" msgstr "" -- cgit v1.2.3