From 2fcbdbd22272aae4f30e0842a42e11e0ca1844a1 Mon Sep 17 00:00:00 2001 From: Christian Wieninger Date: Wed, 9 Jan 2008 22:37:59 +0100 Subject: - first try with favorites --- epgsearch.h | 1 + pages/whats_on.ecpp | 218 ++++++++++++++++++++++++++++++++++------------------ po/ca_ES.po | 6 +- po/cs_CZ.po | 6 +- po/da_DK.po | 6 +- po/de_DE.po | 9 ++- po/el_GR.po | 6 +- po/es_ES.po | 6 +- po/et_EE.po | 6 +- po/fi_FI.po | 9 ++- po/fr_FR.po | 6 +- po/hr_HR.po | 6 +- po/hu_HU.po | 6 +- po/it_IT.po | 9 ++- po/nl_NL.po | 6 +- po/nn_NO.po | 6 +- po/pl_PL.po | 6 +- po/pt_PT.po | 6 +- po/ro_RO.po | 6 +- po/ru_RU.po | 6 +- po/sl_SI.po | 6 +- po/sv_SE.po | 6 +- po/tr_TR.po | 6 +- 23 files changed, 215 insertions(+), 139 deletions(-) diff --git a/epgsearch.h b/epgsearch.h index 4519490..51c73cf 100644 --- a/epgsearch.h +++ b/epgsearch.h @@ -375,6 +375,7 @@ public: iterator end() { return m_list.end(); } const_iterator end() const { return m_list.end(); } + void merge(SearchResults& r) {m_list.merge(r.m_list); m_list.sort();} static std::string AddQuery(std::string const& query); static std::string PopQuery(std::string const& md5); private: diff --git a/pages/whats_on.ecpp b/pages/whats_on.ecpp index 7331adc..9944e21 100644 --- a/pages/whats_on.ecpp +++ b/pages/whats_on.ecpp @@ -8,6 +8,7 @@ #include "setup.h" #include "tools.h" #include "epg_events.h" +#include "epgsearch.h" using namespace std; using namespace vdrlive; @@ -69,6 +70,8 @@ if (type == "now") { if (seektime - time(0) + 3600 < 0) // if wanted time is past more then 1h, then use tomorrow seektime += SECSINDAY; head = tr("What's running at") + string(" ") + FormatDateTime(tr("%I:%M %p"), seektime) +string(" (") +FormatDateTime(tr("%a, %b %d"), seektime) + string(")"); +} else if (type == "favs") { + head = tr("Favorites"); } @@ -104,90 +107,151 @@ if (type == "now") { <%cpp> EpgEvents epgEvents; - ReadLock channelsLock( Channels ); - if (channelsLock) { - // int evntNr = 0; - for (cChannel *Channel = Channels.First(); Channel && Channel->Number() <= LiveSetup().GetLastChannel(); Channel = Channels.Next(Channel)) { - if (Channel->GroupSep()) { - continue; - } - const cSchedule *Schedule = Schedules->GetSchedule(Channel); - if (!Schedule) { - continue; - } - const cEvent *Event = NULL; - if (type == "now") - Event = Schedule->GetPresentEvent(); - else if (type == "next") - Event = Schedule->GetFollowingEvent(); - else if (type == "at") - Event = Schedule->GetEventAround(seektime); - if (!Event) { - continue; - } - - 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") { + if (type != "favs") + { + ReadLock channelsLock( Channels ); + if (channelsLock) { + // int evntNr = 0; + for (cChannel *Channel = Channels.First(); Channel && Channel->Number() <= LiveSetup().GetLastChannel(); Channel = Channels.Next(Channel)) { + if (Channel->GroupSep()) { + continue; + } + const cSchedule *Schedule = Schedules->GetSchedule(Channel); + if (!Schedule) { + continue; + } + const cEvent *Event = NULL; + if (type == "now") + Event = Schedule->GetPresentEvent(); + else if (type == "next") + Event = Schedule->GetFollowingEvent(); + else if (type == "at") + Event = Schedule->GetEventAround(seektime); + if (!Event) { + continue; + } + + 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()) &> +
+ +
+
+ <& 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) { + +% } +
-
-
<$ (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))); + } + 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()) &>
-% } -
- - "> - - - "> - -% } + + <& 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> - } + } + } } + else { + SearchResults results; + SearchTimers timers; + for (SearchTimers::iterator timer = timers.begin(); timer != timers.end(); ++timer) { + if (!timer->UseInFavorites()) continue; + SearchResults curresults; + curresults.GetByID(timer->Id()); + results.merge(curresults); + } + for (SearchResults::iterator result = results.begin(); result != results.end(); ++result) { + 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."); + + // last result? + bool bottom = false; + SearchResults::iterator nextres = result; + nextres++; + if (nextres == results.end()) bottom = true; + + time_t now = time(NULL); + long diff = result->StartTime() - now; + long absdiff = labs(diff); + if (absdiff >= 24*60*60) continue; // skip broadcasts more than a day away + string diffstring; + if (absdiff >= (60 * 60)) + diffstring = lexical_cast(long(absdiff / (60*60))) + " hours"; + else + diffstring = lexical_cast(long(absdiff / 60)) + " minutes"; + if (diff > 0) + diffstring = "in " + diffstring; + else + diffstring = "since " + diffstring; + + <& 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 $> minutes +
+ + "> + + + "> + +% } +<%cpp> + } + % if (mode == "list") { % } @@ -220,6 +284,8 @@ if (type == "now") { "><$ tr("at") $> " onchange="showspectime(this)"/> | +" href="whats_on.html?type=favs&mode=<$ current_mode $>"><$ tr("Favorites") $> +| % if ( current_mode == "list" ) { <$ tr("Details view") $> % } else { diff --git a/po/ca_ES.po b/po/ca_ES.po index 112e8e7..c7f0fea 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -109,9 +109,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -724,6 +721,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/cs_CZ.po b/po/cs_CZ.po index 9edf310..63f6e48 100644 --- a/po/cs_CZ.po +++ b/po/cs_CZ.po @@ -107,9 +107,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -722,6 +719,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/da_DK.po b/po/da_DK.po index 1b94804..0721988 100644 --- a/po/da_DK.po +++ b/po/da_DK.po @@ -107,9 +107,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -722,6 +719,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/de_DE.po b/po/de_DE.po index 3ada953..59f7c21 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -109,9 +109,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "Kanäle" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -724,6 +721,9 @@ msgstr "Was l msgid "%a, %b %d" msgstr "%a, %d.%m." +msgid "Favorites" +msgstr "Favoriten" + msgid "View the schedule of this channel" msgstr "Zeige Programm dieses Kanals" @@ -748,6 +748,9 @@ msgstr "Ausf msgid "List view" msgstr "Listenansicht" +#~ msgid "channels" +#~ msgstr "Kanäle" + #~ msgid "RecDate" #~ msgstr "Aufnahmedatum" diff --git a/po/el_GR.po b/po/el_GR.po index 339c7fa..13ce479 100644 --- a/po/el_GR.po +++ b/po/el_GR.po @@ -107,9 +107,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -722,6 +719,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/es_ES.po b/po/es_ES.po index fb63fa3..9757140 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -107,9 +107,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -722,6 +719,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/et_EE.po b/po/et_EE.po index ee04d5b..40f1c66 100644 --- a/po/et_EE.po +++ b/po/et_EE.po @@ -107,9 +107,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -722,6 +719,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/fi_FI.po b/po/fi_FI.po index d45a385..c598cf8 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -107,9 +107,6 @@ msgstr "Ensisijaisen DVB-sovittimen k msgid "Couldn't grab image from primary device" msgstr "Kuvan kaappaus ensisijaiselta DVB-sovittimelta epäonnistui!" -msgid "channels" -msgstr "kanavat" - msgid "Couldn't aquire access to channels, please try again later." msgstr "Kanavien käyttäminen epäonnistui! Yritä myöhemmin uudelleen." @@ -723,6 +720,9 @@ msgstr "Tulossa seuraavaksi?" msgid "%a, %b %d" msgstr "%a, %d.%m." +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "Näytä ohjelmisto kanavalta" @@ -747,6 +747,9 @@ msgstr "Ruudukkon msgid "List view" msgstr "Listanäkymä" +#~ msgid "channels" +#~ msgstr "kanavat" + #~ msgid "RecDate" #~ msgstr "Tallenteen päiväys" diff --git a/po/fr_FR.po b/po/fr_FR.po index 31a432a..554821f 100644 --- a/po/fr_FR.po +++ b/po/fr_FR.po @@ -111,9 +111,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -727,6 +724,9 @@ msgstr "" msgid "%a, %b %d" msgstr "%a, %d.%m." +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "Regarder le programme de cette chaîne" diff --git a/po/hr_HR.po b/po/hr_HR.po index df4cff4..214e876 100644 --- a/po/hr_HR.po +++ b/po/hr_HR.po @@ -108,9 +108,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -723,6 +720,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/hu_HU.po b/po/hu_HU.po index 5108609..e141102 100644 --- a/po/hu_HU.po +++ b/po/hu_HU.po @@ -108,9 +108,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -723,6 +720,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/it_IT.po b/po/it_IT.po index 24b5c23..0286dd8 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -110,9 +110,6 @@ msgstr "Impossibile identificare scheda primaria" msgid "Couldn't grab image from primary device" msgstr "Impossibile ottenere immagine da scheda primaria" -msgid "channels" -msgstr "canali" - msgid "Couldn't aquire access to channels, please try again later." msgstr "Impossibile avere accesso ai canali, per favore riprova più tardi." @@ -725,6 +722,9 @@ msgstr "Cosa c' msgid "%a, %b %d" msgstr "%a, %b %d" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "Visualizza scheda programmi del canale" @@ -749,6 +749,9 @@ msgstr "Vedi come dettagli" msgid "List view" msgstr "Vedi come elenco" +#~ msgid "channels" +#~ msgstr "canali" + #~ msgid "RecDate" #~ msgstr "Data reg." diff --git a/po/nl_NL.po b/po/nl_NL.po index d727680..7135d18 100644 --- a/po/nl_NL.po +++ b/po/nl_NL.po @@ -110,9 +110,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -726,6 +723,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/nn_NO.po b/po/nn_NO.po index 3b06503..e1c2004 100644 --- a/po/nn_NO.po +++ b/po/nn_NO.po @@ -108,9 +108,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -723,6 +720,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/pl_PL.po b/po/pl_PL.po index eff3272..49d5ec7 100644 --- a/po/pl_PL.po +++ b/po/pl_PL.po @@ -107,9 +107,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -722,6 +719,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/pt_PT.po b/po/pt_PT.po index 3757b41..7b85c48 100644 --- a/po/pt_PT.po +++ b/po/pt_PT.po @@ -107,9 +107,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -722,6 +719,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/ro_RO.po b/po/ro_RO.po index bccdd1e..f00598d 100644 --- a/po/ro_RO.po +++ b/po/ro_RO.po @@ -108,9 +108,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -723,6 +720,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/ru_RU.po b/po/ru_RU.po index 61e0f3d..c129782 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -107,9 +107,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -722,6 +719,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/sl_SI.po b/po/sl_SI.po index 00b6dd5..7364d71 100644 --- a/po/sl_SI.po +++ b/po/sl_SI.po @@ -108,9 +108,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -723,6 +720,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/sv_SE.po b/po/sv_SE.po index 64f3166..b1aa5ba 100644 --- a/po/sv_SE.po +++ b/po/sv_SE.po @@ -108,9 +108,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -723,6 +720,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" diff --git a/po/tr_TR.po b/po/tr_TR.po index 8b14588..94e5487 100644 --- a/po/tr_TR.po +++ b/po/tr_TR.po @@ -107,9 +107,6 @@ msgstr "" msgid "Couldn't grab image from primary device" msgstr "" -msgid "channels" -msgstr "" - msgid "Couldn't aquire access to channels, please try again later." msgstr "" @@ -722,6 +719,9 @@ msgstr "" msgid "%a, %b %d" msgstr "" +msgid "Favorites" +msgstr "" + msgid "View the schedule of this channel" msgstr "" -- cgit v1.2.3