From 197b8c27fa486577ea35e9e89d09abd877fd5c70 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 15 Jan 2006 13:09:16 +0100 Subject: [PATCH] Implemented '0' key function in the "Schedule" menu --- HISTORY | 7 ++- MANUAL | 6 +++ i18n.c | 65 ++++++++++++++++++++++++- menu.c | 146 +++++++++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 206 insertions(+), 18 deletions(-) diff --git a/HISTORY b/HISTORY index 933ce953..1364c2cd 100644 --- a/HISTORY +++ b/HISTORY @@ -4135,7 +4135,7 @@ Video Disk Recorder Revision History Schneider). - Cleaned up some trailing white space. -2006-01-14: Version 1.3.39 +2006-01-15: Version 1.3.39 - The SVDRP command LSTT now accepts the new option 'id' to have the channels of the timers listed with their unique channel ids instead of their numbers @@ -4176,3 +4176,8 @@ Video Disk Recorder Revision History (suggested by Andreas Brachold). - The SVDRP command GRAB allows file names without extension again (suggested by Stefan Huelswitt). +- Pressing '0' in the "Schedule" menu now rotates through displaying "This event on + this channel", "This event on all channels" and "All events on all channels". + This can be used to find reruns of a given show, or the episodes of a series. + Note that if there are many channels in your channels.conf, displaying the + "All events on all channels" page may take a while. diff --git a/MANUAL b/MANUAL index 5b47078f..cd86d731 100644 --- a/MANUAL +++ b/MANUAL @@ -177,6 +177,12 @@ Version 1.3 whether there is currently a DVB card receiving the transponder this channel is on). + Pressing '0' in the "Schedule" menu rotates through displaying "This event on + this channel", "This event on all channels" and "All events on all channels". + This can be used to find reruns of a given show, or the episodes of a series. + Note that if there are many channels in your channels.conf, displaying the + "All events on all channels" page may take a while. + * Selecting a Channel There are four ways to select a channel: diff --git a/i18n.c b/i18n.c index f660a284..4080fd12 100644 --- a/i18n.c +++ b/i18n.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.234 2006/01/13 16:24:07 kls Exp $ + * $Id: i18n.c 1.235 2006/01/15 12:22:15 kls Exp $ * * Translations provided by: * @@ -441,6 +441,69 @@ const tI18nPhrase Phrases[] = { "Programm - %s", "Program - %s", }, + { "This event - %s", + "Diese Sendung - %s", + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + }, + { "This event - all channels", + "Diese Sendung - alle Kanäle", + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + }, + { "All events - all channels", + "Alle Sendungen - alle Kanäle", + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + "",//TODO + }, { "What's on now?", "Was läuft jetzt?", "Kaj je na sporedu?", diff --git a/menu.c b/menu.c index 8a1bab13..af9cebf8 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.393 2006/01/14 14:53:43 kls Exp $ + * $Id: menu.c 1.394 2006/01/15 12:46:07 kls Exp $ */ #include "menu.h" @@ -323,10 +323,10 @@ public: cMenuChannelItem(cChannel *Channel); static void SetSortMode(eChannelSortMode SortMode) { sortMode = SortMode; } static void IncSortMode(void) { sortMode = eChannelSortMode((sortMode == csmProvider) ? csmNumber : sortMode + 1); } + static eChannelSortMode SortMode(void) { return sortMode; } virtual int Compare(const cListObject &ListObject) const; virtual void Set(void); cChannel *Channel(void) { return channel; } - static eChannelSortMode SortMode(void) { return sortMode; } }; cMenuChannelItem::eChannelSortMode cMenuChannelItem::sortMode = csmNumber; @@ -961,22 +961,45 @@ eOSState cMenuEvent::ProcessKey(eKeys Key) // --- cMenuScheduleItem ----------------------------------------------------- class cMenuScheduleItem : public cOsdItem { +public: + enum eScheduleSortMode { ssmAllThis, ssmThisThis, ssmThisAll, ssmAllAll }; // "which event(s) on which channel(s)" +private: + static eScheduleSortMode sortMode; public: const cEvent *event; const cChannel *channel; + bool withDate; int timerMatch; - cMenuScheduleItem(const cEvent *Event, cChannel *Channel = NULL); + cMenuScheduleItem(const cEvent *Event, cChannel *Channel = NULL, bool WithDate = false); + static void SetSortMode(eScheduleSortMode SortMode) { sortMode = SortMode; } + static void IncSortMode(void) { sortMode = eScheduleSortMode((sortMode == ssmAllAll) ? ssmAllThis : sortMode + 1); } + static eScheduleSortMode SortMode(void) { return sortMode; } + virtual int Compare(const cListObject &ListObject) const; bool Update(bool Force = false); -}; + }; -cMenuScheduleItem::cMenuScheduleItem(const cEvent *Event, cChannel *Channel) +cMenuScheduleItem::eScheduleSortMode cMenuScheduleItem::sortMode = ssmAllThis; + +cMenuScheduleItem::cMenuScheduleItem(const cEvent *Event, cChannel *Channel, bool WithDate) { event = Event; channel = Channel; + withDate = WithDate; timerMatch = tmNone; Update(true); } +int cMenuScheduleItem::Compare(const cListObject &ListObject) const +{ + cMenuScheduleItem *p = (cMenuScheduleItem *)&ListObject; + int r = -1; + if (sortMode != ssmAllThis) + r = strcoll(event->Title(), p->event->Title()); + if (sortMode == ssmAllThis || r == 0) + r = event->StartTime() - p->event->StartTime(); + return r; +} + static char *TimerMatchChars = " tT"; bool cMenuScheduleItem::Update(bool Force) @@ -989,7 +1012,9 @@ bool cMenuScheduleItem::Update(bool Force) char t = TimerMatchChars[timerMatch]; char v = event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' '; char r = event->IsRunning() ? '*' : ' '; - if (channel) + if (channel && withDate) + asprintf(&buffer, "%d\t%.*s\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), 6, channel->ShortName(true), 6, *event->GetDateString(), *event->GetTimeString(), t, v, r, event->Title()); + else if (channel) asprintf(&buffer, "%d\t%.*s\t%s\t%c%c%c\t%s", channel->Number(), 6, channel->ShortName(true), *event->GetTimeString(), t, v, r, event->Title()); else asprintf(&buffer, "%.*s\t%s\t%c%c%c\t%s", 6, *event->GetDateString(), *event->GetTimeString(), t, v, r, event->Title()); @@ -1163,9 +1188,13 @@ private: bool now, next; int otherChannel; int helpKeys; + eOSState Number(void); eOSState Record(void); eOSState Switch(void); - void PrepareSchedule(cChannel *Channel); + void PrepareScheduleAllThis(const cEvent *Event, const cChannel *Channel); + void PrepareScheduleThisThis(const cEvent *Event, const cChannel *Channel); + void PrepareScheduleThisAll(const cEvent *Event, const cChannel *Channel); + void PrepareScheduleAllAll(const cEvent *Event, const cChannel *Channel); bool Update(void); void SetHelpKeys(void); public: @@ -1175,16 +1204,17 @@ public: }; cMenuSchedule::cMenuSchedule(void) -:cOsdMenu("", 7, 6, 4) +:cOsdMenu("") { now = next = false; otherChannel = 0; helpKeys = -1; + cMenuScheduleItem::SetSortMode(cMenuScheduleItem::ssmAllThis); cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); if (channel) { cMenuWhatsOn::SetCurrentChannel(channel->Number()); schedules = cSchedules::Schedules(schedulesLock); - PrepareSchedule(channel); + PrepareScheduleAllThis(NULL, channel); SetHelpKeys(); } } @@ -1194,26 +1224,85 @@ cMenuSchedule::~cMenuSchedule() cMenuWhatsOn::ScheduleEvent(); // makes sure any posted data is cleared } -void cMenuSchedule::PrepareSchedule(cChannel *Channel) +void cMenuSchedule::PrepareScheduleAllThis(const cEvent *Event, const cChannel *Channel) { Clear(); + SetCols(7, 6, 4); char *buffer = NULL; asprintf(&buffer, tr("Schedule - %s"), Channel->Name()); SetTitle(buffer); free(buffer); - if (schedules) { + if (schedules && Channel) { const cSchedule *Schedule = schedules->GetSchedule(Channel); if (Schedule) { - const cEvent *PresentEvent = Schedule->GetPresentEvent(Channel->Number() == cDevice::CurrentChannel()); + const cEvent *PresentEvent = Event ? Event : Schedule->GetPresentEvent(Channel->Number() == cDevice::CurrentChannel()); time_t now = time(NULL) - Setup.EPGLinger * 60; - for (const cEvent *Event = Schedule->Events()->First(); Event; Event = Schedule->Events()->Next(Event)) { - if (Event->EndTime() > now || Event == PresentEvent) - Add(new cMenuScheduleItem(Event), Event == PresentEvent); + for (const cEvent *ev = Schedule->Events()->First(); ev; ev = Schedule->Events()->Next(ev)) { + if (ev->EndTime() > now || ev == PresentEvent) + Add(new cMenuScheduleItem(ev), ev == PresentEvent); } } } } +void cMenuSchedule::PrepareScheduleThisThis(const cEvent *Event, const cChannel *Channel) +{ + Clear(); + SetCols(7, 6, 4); + char *buffer = NULL; + asprintf(&buffer, tr("This event - %s"), Channel->Name()); + SetTitle(buffer); + free(buffer); + if (schedules && Channel && Event) { + const cSchedule *Schedule = schedules->GetSchedule(Channel); + if (Schedule) { + time_t now = time(NULL) - Setup.EPGLinger * 60; + for (const cEvent *ev = Schedule->Events()->First(); ev; ev = Schedule->Events()->Next(ev)) { + if ((ev->EndTime() > now || ev == Event) && !strcmp(ev->Title(), Event->Title())) + Add(new cMenuScheduleItem(ev), ev == Event); + } + } + } +} + +void cMenuSchedule::PrepareScheduleThisAll(const cEvent *Event, const cChannel *Channel) +{ + Clear(); + SetCols(CHNUMWIDTH, 7, 7, 6, 4); + SetTitle(tr("This event - all channels")); + if (schedules && Event) { + for (cChannel *ch = Channels.First(); ch; ch = Channels.Next(ch)) { + const cSchedule *Schedule = schedules->GetSchedule(ch); + if (Schedule) { + time_t now = time(NULL) - Setup.EPGLinger * 60; + for (const cEvent *ev = Schedule->Events()->First(); ev; ev = Schedule->Events()->Next(ev)) { + if ((ev->EndTime() > now || ev == Event) && !strcmp(ev->Title(), Event->Title())) + Add(new cMenuScheduleItem(ev, ch, true), ev == Event && ch == Channel); + } + } + } + } +} + +void cMenuSchedule::PrepareScheduleAllAll(const cEvent *Event, const cChannel *Channel) +{ + Clear(); + SetCols(CHNUMWIDTH, 7, 7, 6, 4); + SetTitle(tr("All events - all channels")); + if (schedules) { + for (cChannel *ch = Channels.First(); ch; ch = Channels.Next(ch)) { + const cSchedule *Schedule = schedules->GetSchedule(ch); + if (Schedule) { + time_t now = time(NULL) - Setup.EPGLinger * 60; + for (const cEvent *ev = Schedule->Events()->First(); ev; ev = Schedule->Events()->Next(ev)) { + if (ev->EndTime() > now || ev == Event) + Add(new cMenuScheduleItem(ev, ch, true), ev == Event && ch == Channel); + } + } + } + } +} + bool cMenuSchedule::Update(void) { bool result = false; @@ -1241,6 +1330,29 @@ void cMenuSchedule::SetHelpKeys(void) } } +eOSState cMenuSchedule::Number(void) +{ + cMenuScheduleItem::IncSortMode(); + cMenuScheduleItem *CurrentItem = (cMenuScheduleItem *)Get(Current()); + const cChannel *Channel = NULL; + const cEvent *Event = NULL; + if (CurrentItem) { + Event = CurrentItem->event; + Channel = Channels.GetByChannelID(Event->ChannelID(), true); + } + switch (cMenuScheduleItem::SortMode()) { + case cMenuScheduleItem::ssmAllThis: PrepareScheduleAllThis(Event, Channel); break; + case cMenuScheduleItem::ssmThisThis: PrepareScheduleThisThis(Event, Channel); break; + case cMenuScheduleItem::ssmThisAll: PrepareScheduleThisAll(Event, Channel); break; + case cMenuScheduleItem::ssmAllAll: PrepareScheduleAllAll(Event, Channel); break; + } + CurrentItem = (cMenuScheduleItem *)Get(Current()); + Sort(); + SetCurrent(CurrentItem); + Display(); + return osContinue; +} + eOSState cMenuSchedule::Record(void) { cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current()); @@ -1290,6 +1402,7 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key) if (state == osUnknown) { switch (Key) { + case k0: return Number(); case kRecord: case kRed: return Record(); case kGreen: if (schedules) { @@ -1325,7 +1438,8 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key) if (ei) { cChannel *channel = Channels.GetByChannelID(ei->ChannelID(), true); if (channel) { - PrepareSchedule(channel); + cMenuScheduleItem::SetSortMode(cMenuScheduleItem::ssmAllThis); + PrepareScheduleAllThis(NULL, channel); if (channel->Number() != cDevice::CurrentChannel()) { otherChannel = channel->Number(); SetHelp(Count() ? tr("Button$Record") : NULL, tr("Button$Now"), tr("Button$Next"), tr("Button$Switch"));