diff -Nru vdr-1.6.0/config.c vdr-1.6.0-patched/config.c --- vdr-1.6.0/config.c 2008-02-17 14:39:00.000000000 +0100 +++ vdr-1.6.0-patched/config.c 2008-04-29 22:55:41.000000000 +0200 @@ -125,6 +125,7 @@ cCommands Commands; cCommands RecordingCommands; +cCommands TimerCommands; // --- cSVDRPhosts ----------------------------------------------------------- diff -Nru vdr-1.6.0/config.h vdr-1.6.0-patched/config.h --- vdr-1.6.0/config.h 2008-03-23 11:26:10.000000000 +0100 +++ vdr-1.6.0-patched/config.h 2008-04-29 22:55:41.000000000 +0200 @@ -168,6 +168,7 @@ extern cCommands Commands; extern cCommands RecordingCommands; +extern cCommands TimerCommands; extern cSVDRPhosts SVDRPhosts; class cSetupLine : public cListObject { diff -Nru vdr-1.6.0/menu.c vdr-1.6.0-patched/menu.c --- vdr-1.6.0/menu.c 2008-03-16 12:15:28.000000000 +0100 +++ vdr-1.6.0-patched/menu.c 2008-04-29 22:55:41.000000000 +0200 @@ -772,8 +772,20 @@ return state; } -// --- cMenuTimerItem -------------------------------------------------------- +// --- cMenuCommands --------------------------------------------------------- +// declaration shifted so it can be used in cMenuTimers +class cMenuCommands : public cOsdMenu { +private: + cCommands *commands; + char *parameters; + eOSState Execute(void); +public: + cMenuCommands(const char *Title, cCommands *Commands, const char *Parameters = NULL); + virtual ~cMenuCommands(); + virtual eOSState ProcessKey(eKeys Key); + }; +// --- cMenuTimerItem -------------------------------------------------------- class cMenuTimerItem : public cOsdItem { private: cTimer *timer; @@ -836,6 +848,7 @@ eOSState OnOff(void); eOSState Info(void); cTimer *CurrentTimer(void); + eOSState Commands(eKeys Key = kNone); void SetHelpKeys(void); public: cMenuTimers(void); @@ -952,6 +965,53 @@ return osContinue; } +#define CHECK_2PTR_NULL(x_,y_) ((x_)? ((y_)? y_:""):"") + +eOSState cMenuTimers::Commands(eKeys Key) +{ + if (HasSubMenu() || Count() == 0) + return osContinue; + cTimer *ti = CurrentTimer(); + if (ti) { + char *parameter = NULL; + const cEvent *pEvent = ti->Event(); + int iRecNumber=0; + + if(!pEvent) { + Timers.SetEvents(); + pEvent = ti->Event(); + } + if(pEvent) { +// create a dummy recording to get the real filename + cRecording *rc_dummy = new cRecording(ti, pEvent); + Recordings.Load(); + cRecording *rc = Recordings.GetByName(rc_dummy->FileName()); + + delete rc_dummy; + if(rc) + iRecNumber=rc->Index() + 1; + } +//Parameter format TimerNumber 'ChannelId' Start Stop 'Titel' 'Subtitel' 'file' RecNumer +// 1 2 3 4 5 6 7 8 + asprintf(¶meter, "%d '%s' %d %d '%s' '%s' '%s' %d", ti->Index(), + *ti->Channel()->GetChannelID().ToString(), + (int)ti->StartTime(), + (int)ti->StopTime(), + CHECK_2PTR_NULL(pEvent, pEvent->Title()), + CHECK_2PTR_NULL(pEvent, pEvent->ShortText()), + ti->File(), + iRecNumber); + isyslog("timercmd: %s", parameter); + cMenuCommands *menu; + eOSState state = AddSubMenu(menu = new cMenuCommands(tr("Timer commands"), &TimerCommands, parameter)); + free(parameter); + if (Key != kNone) + state = menu->ProcessKey(Key); + return state; + } + return osContinue; +} + eOSState cMenuTimers::ProcessKey(eKeys Key) { int TimerNumber = HasSubMenu() ? Count() : -1; @@ -966,6 +1026,8 @@ case kInfo: case kBlue: return Info(); break; + case k1...k9: return Commands(Key); + case k0: return (TimerCommands.Count()? Commands():osContinue); default: break; } } @@ -1548,17 +1610,6 @@ // --- cMenuCommands --------------------------------------------------------- -class cMenuCommands : public cOsdMenu { -private: - cCommands *commands; - char *parameters; - eOSState Execute(void); -public: - cMenuCommands(const char *Title, cCommands *Commands, const char *Parameters = NULL); - virtual ~cMenuCommands(); - virtual eOSState ProcessKey(eKeys Key); - }; - cMenuCommands::cMenuCommands(const char *Title, cCommands *Commands, const char *Parameters) :cOsdMenu(Title) { diff -Nru vdr-1.6.0/po/de_DE.po vdr-1.6.0-patched/po/de_DE.po --- vdr-1.6.0/po/de_DE.po 2008-03-23 11:31:29.000000000 +0100 +++ vdr-1.6.0-patched/po/de_DE.po 2008-04-29 22:55:41.000000000 +0200 @@ -381,6 +381,9 @@ msgid "Timer still recording - really delete?" msgstr "Timer zeichnet auf - trotzdem löschen?" +msgid "Timer commands" +msgstr "Befehle für Timer" + msgid "Event" msgstr "Sendung" diff -Nru vdr-1.6.0/vdr.c vdr-1.6.0-patched/vdr.c --- vdr-1.6.0/vdr.c 2008-03-14 14:22:39.000000000 +0100 +++ vdr-1.6.0-patched/vdr.c 2008-04-29 22:55:41.000000000 +0200 @@ -569,6 +569,7 @@ Timers.Load(AddDirectory(ConfigDirectory, "timers.conf")) && Commands.Load(AddDirectory(ConfigDirectory, "commands.conf"), true) && RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"), true) && + TimerCommands.Load(AddDirectory(ConfigDirectory, "timercmds.conf"), true) && SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true) && Keys.Load(AddDirectory(ConfigDirectory, "remote.conf")) && KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true)