Blob Blame History Raw
diff -up vdr-1.7.21/config.c~ vdr-1.7.21/config.c
--- vdr-1.7.21/config.c~	2011-10-18 00:02:51.394223695 +0300
+++ vdr-1.7.21/config.c	2011-10-18 00:12:30.255855027 +0300
@@ -211,6 +211,7 @@ bool cNestedItemList::Save(void)
 cNestedItemList Folders;
 cNestedItemList Commands;
 cNestedItemList RecordingCommands;
+cNestedItemList TimerCommands;
 
 // --- cSVDRPhosts -----------------------------------------------------------
 
diff -up vdr-1.7.21/config.h~ vdr-1.7.21/config.h
--- vdr-1.7.21/config.h~	2011-10-18 00:02:51.438227770 +0300
+++ vdr-1.7.21/config.h	2011-10-18 00:12:30.702896536 +0300
@@ -187,6 +187,7 @@ public:
 extern cNestedItemList Folders;
 extern cNestedItemList Commands;
 extern cNestedItemList RecordingCommands;
+extern cNestedItemList TimerCommands;
 extern cSVDRPhosts SVDRPhosts;
 
 class cSetupLine : public cListObject {
diff -up vdr-1.7.21/menu.c~ vdr-1.7.21/menu.c
--- vdr-1.7.21/menu.c~	2011-10-18 00:02:51.428226843 +0300
+++ vdr-1.7.21/menu.c	2011-10-18 00:12:29.520786768 +0300
@@ -1142,6 +1142,7 @@ void cTimerEntry::SetDiskStatus(char Dis
 
 class cMenuTimers : public cOsdMenu {
 private:
+  eOSState Commands(eKeys Key = kNone);
   int helpKeys;
   eOSState Edit(void);
   eOSState New(void);
@@ -1259,6 +1260,53 @@ eOSState cMenuTimers::Delete(void)
   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(&parameter, "%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::Info(void)
 {
   if (HasSubMenu() || Count() == 0)
@@ -1346,6 +1394,8 @@ eOSState cMenuTimers::ProcessKey(eKeys K
        case kInfo:
        case kBlue:   return Info();
                      break;
+       case k1...k9: return Commands(Key);
+       case k0:      return (TimerCommands.Count()? Commands():osContinue);
        default: break;
        }
      }
diff -up vdr-1.7.21/vdr.c~ vdr-1.7.21/vdr.c
--- vdr-1.7.21/vdr.c~	2011-10-18 00:02:51.284213503 +0300
+++ vdr-1.7.21/vdr.c	2011-10-18 00:12:31.901007794 +0300
@@ -602,6 +602,7 @@ int main(int argc, char *argv[])
   Timers.Load(AddDirectory(ConfigDirectory, "timers.conf"));
   Commands.Load(AddDirectory(ConfigDirectory, "commands.conf"));
   RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"));
+  TimerCommands.Load(AddDirectory(ConfigDirectory, "timercmds.conf"));
   SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true);
   Keys.Load(AddDirectory(ConfigDirectory, "remote.conf"));
   KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true);