Sophie

Sophie

distrib > Mageia > 8 > armv7hl > media > core-release-src > by-pkgid > 836fa05f8fb7bdddaeed1792da348e97 > files > 4

vdr-2.0.7-9.mga8.src.rpm

diff -Nru vdr-1.7.17/config.c vdr-1.7.17-patched/config.c
--- vdr-1.7.17/config.c	2010-06-06 12:06:43.000000000 +0200
+++ vdr-1.7.17-patched/config.c	2011-03-16 18:48:43.000000000 +0100
@@ -211,6 +211,7 @@
 cNestedItemList Folders;
 cNestedItemList Commands;
 cNestedItemList RecordingCommands;
+cNestedItemList TimerCommands;
 
 // --- cSVDRPhosts -----------------------------------------------------------
 
diff -Nru vdr-1.7.17/config.h vdr-1.7.17-patched/config.h
--- vdr-1.7.17/config.h	2010-10-24 13:22:35.000000000 +0200
+++ vdr-1.7.17-patched/config.h	2011-03-16 18:49:17.000000000 +0100
@@ -181,6 +181,7 @@
 extern cNestedItemList Folders;
 extern cNestedItemList Commands;
 extern cNestedItemList RecordingCommands;
+extern cNestedItemList TimerCommands;
 extern cSVDRPhosts SVDRPhosts;
 
 class cSetupLine : public cListObject {
diff -Nru vdr-1.7.17/menu.c vdr-1.7.17-patched/menu.c
--- vdr-1.7.17/menu.c	2011-02-27 13:37:48.000000000 +0100
+++ vdr-1.7.17-patched/menu.c	2011-03-16 19:07:53.000000000 +0100
@@ -1083,6 +1083,7 @@
   eOSState Info(void);
   cTimer *CurrentTimer(void);
   void SetHelpKeys(void);
+  eOSState Commands(eKeys Key = kNone);
 public:
   cMenuTimers(void);
   virtual ~cMenuTimers();
@@ -1198,6 +1199,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(&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::ProcessKey(eKeys Key)
 {
   int TimerNumber = HasSubMenu() ? Count() : -1;
@@ -1212,6 +1260,9 @@
        case kInfo:
        case kBlue:   return Info();
                      break;
+       case k1...k9: return Commands(Key);
+       case k0:      return (TimerCommands.Count()? Commands():osContinue);
+
        default: break;
        }
      }
 
diff -Nru vdr-1.7.17/vdr.c vdr-1.7.17-patched/vdr.c
--- vdr-1.7.17/vdr.c	2010-12-12 14:42:00.000000000 +0100
+++ vdr-1.7.17-patched/vdr.c	2011-03-16 18:56:26.000000000 +0100
@@ -585,6 +585,7 @@
   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);