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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
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)
|