summaryrefslogtreecommitdiff
path: root/patches/timercmd-0.1_1.3.25.diff
blob: 331330b33295af8cb54024830203dbae10ca3e9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
diff -ruN7p1 vdr-1.3.25-orig/config.c vdr-1.3.25/config.c
--- vdr-1.3.25-orig/config.c	2005-02-20 13:52:59.000000000 +0100
+++ vdr-1.3.25/config.c	2005-05-31 00:07:56.000000000 +0200
@@ -143,2 +143,3 @@ cCommands Commands;
 cCommands RecordingCommands;
+cCommands TimerCommands;
 
diff -ruN7p1 vdr-1.3.25-orig/config.h vdr-1.3.25/config.h
--- vdr-1.3.25-orig/config.h	2005-05-14 11:18:08.000000000 +0200
+++ vdr-1.3.25/config.h	2005-05-31 00:07:56.000000000 +0200
@@ -175,2 +175,3 @@ extern cCommands Commands;
 extern cCommands RecordingCommands;
+extern cCommands TimerCommands;
 extern cSVDRPhosts SVDRPhosts;
diff -ruN7p1 vdr-1.3.25-orig/i18n.c vdr-1.3.25/i18n.c
--- vdr-1.3.25-orig/i18n.c	2005-05-15 16:37:59.000000000 +0200
+++ vdr-1.3.25/i18n.c	2005-05-31 00:07:56.000000000 +0200
@@ -317,2 +317,23 @@ const tI18nPhrase Phrases[] = {
   },
+  { "Timer commands",
+    "Befehle für Timer",
+    "Ukazi za termine",
+    "Timer comandi",
+    "",// "Nederlands"
+    "",// "Português"
+    "Commandes de programmation",
+    "Timer kommandoer",
+    "Ajastinkomennot",
+    "",// "Polski"
+    "Comandos de programacion",
+    "",// "ÅëëçíéêÜ", // Greek
+    "Timer kommandon",
+    "Comenzi timer",
+    "",// "Magyar"
+    "Ordres de programació",
+    "",// "ÀãááÚØÙ", // Russian
+    "Naredbe za termine",
+    "",// "Eesti"
+    "",// "Dansk"
+  },
   { "Edit channel",
diff -ruN7p1 vdr-1.3.25-orig/menu.c vdr-1.3.25/menu.c
--- vdr-1.3.25-orig/menu.c	2005-05-16 15:59:03.000000000 +0200
+++ vdr-1.3.25/menu.c	2005-05-31 00:12:31.000000000 +0200
@@ -709,4 +709,16 @@ eOSState cMenuEditTimer::ProcessKey(eKey
 
-// --- 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 {
@@ -775,2 +787,3 @@ private:
   cTimer *CurrentTimer(void);
+  eOSState Commands(eKeys Key = kNone);
 public:
@@ -877,2 +890,49 @@ eOSState cMenuTimers::Summary(void)
 
+#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)
@@ -893,2 +952,4 @@ eOSState cMenuTimers::ProcessKey(eKeys K
                      break;
+       case k1...k9: return Commands(Key);
+       case k0:      return (TimerCommands.Count()? Commands():osContinue);
        default: break;
@@ -1241,13 +1302,2 @@ eOSState cMenuSchedule::ProcessKey(eKeys
 
-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)
diff -ruN7p1 vdr-1.3.25-orig/vdr.c vdr-1.3.25/vdr.c
--- vdr-1.3.25-orig/vdr.c	2005-05-26 12:45:29.000000000 +0200
+++ vdr-1.3.25/vdr.c	2005-05-31 00:07:56.000000000 +0200
@@ -395,2 +395,3 @@ int main(int argc, char *argv[])
         RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"), true) &&
+        TimerCommands.Load(AddDirectory(ConfigDirectory, "timercmds.conf"), true) &&
         SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true) &&