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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
diff -rupbB ./lcdproc.c ../lcdproc-0.0.10.SHF-volume/lcdproc.c
--- ./lcdproc.c 2008-05-27 00:03:09.000000000 +0200
+++ ../lcdproc-0.0.10.SHF-volume/lcdproc.c 2007-12-13 21:41:06.000000000 +0100
@@ -61,7 +61,7 @@ protected:
virtual void OsdCurrentItem(const char *Text);
virtual void OsdTextItem(const char *Text, bool Scroll);
virtual void OsdChannel(const char *Text);
- virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
+// virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
};
@@ -70,10 +70,8 @@ void cLcdFeed::ChannelSwitch(const cDevi
//syslog(LOG_INFO, "lcdproc: cLcdFeed::ChannelSwitch %d %d", Device->CardIndex(), ChannelNumber);
if ( Device && Device->IsPrimaryDevice() ) {
if (ChannelNumber) {
- LCDproc->SetLine(1,2," ");
- LCDproc->SetLine(1,3," ");
- LCDproc->SetRunning(false,tr("Waiting for EPG info."), NULL);
switched = true;
+ LCDproc->SetChannelSwitch( (cDevice *) Device, ChannelNumber);
} else switched = false;
LCDproc->SetPrimaryDevice( (cDevice *) Device );
}
@@ -188,31 +186,31 @@ void cLcdFeed::OsdChannel(const char *Te
switched=false; menumode=false;
}
-void cLcdFeed::OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle)
-{
- char buffer[25];
- struct tm tm_r;
- //syslog(LOG_INFO, "lcdproc: cLcdFeed::OsdProgramme");
- strftime(buffer, sizeof(buffer), "%R", localtime_r(&PresentTime, &tm_r));
- //syslog(LOG_INFO, "%5s %s", buffer, PresentTitle);
- //syslog(LOG_INFO, "%5s %s", "", PresentSubtitle);
-
-
- if ( (!isempty(PresentTitle)) && (!isempty(PresentSubtitle)) )
- LCDproc->SetRunning(false,buffer,PresentTitle,PresentSubtitle);
- else if (!isempty(PresentTitle)) LCDproc->SetRunning(false,buffer,PresentTitle);
- else LCDproc->SetRunning(false,tr("No EPG info available."), NULL);
-
-
- strftime(buffer, sizeof(buffer), "%R", localtime_r(&FollowingTime, &tm_r));
- //syslog(LOG_INFO, "%5s %s", buffer, FollowingTitle);
- //syslog(LOG_INFO, "%5s %s", "", FollowingSubtitle);
-
- if ( (!isempty(FollowingTitle)) && (!isempty(FollowingSubtitle)) )
- LCDproc->SetRunning(true,buffer,FollowingTitle,FollowingSubtitle);
- else if (!isempty(FollowingTitle)) LCDproc->SetRunning(true,buffer,FollowingTitle);
- else LCDproc->SetRunning(true,tr("No EPG info available."), NULL);
-}
+// void cLcdFeed::OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle)
+// {
+// char buffer[25];
+// struct tm tm_r;
+// //syslog(LOG_INFO, "lcdproc: cLcdFeed::OsdProgramme");
+// strftime(buffer, sizeof(buffer), "%R", localtime_r(&PresentTime, &tm_r));
+// //syslog(LOG_INFO, "%5s %s", buffer, PresentTitle);
+// //syslog(LOG_INFO, "%5s %s", "", PresentSubtitle);
+//
+//
+// if ( (!isempty(PresentTitle)) && (!isempty(PresentSubtitle)) )
+// LCDproc->SetRunning(false,buffer,PresentTitle,PresentSubtitle);
+// else if (!isempty(PresentTitle)) LCDproc->SetRunning(false,buffer,PresentTitle);
+// else LCDproc->SetRunning(false,tr("No EPG info available."), NULL);
+//
+//
+// strftime(buffer, sizeof(buffer), "%R", localtime_r(&FollowingTime, &tm_r));
+// //syslog(LOG_INFO, "%5s %s", buffer, FollowingTitle);
+// //syslog(LOG_INFO, "%5s %s", "", FollowingSubtitle);
+//
+// if ( (!isempty(FollowingTitle)) && (!isempty(FollowingSubtitle)) )
+// LCDproc->SetRunning(true,buffer,FollowingTitle,FollowingSubtitle);
+// else if (!isempty(FollowingTitle)) LCDproc->SetRunning(true,buffer,FollowingTitle);
+// else LCDproc->SetRunning(true,tr("No EPG info available."), NULL);
+// }
// ---
diff -rupbB ./lcd.c ../lcdproc-0.0.10.SHF-volume/lcd.c
--- ./lcd.c 2008-05-27 02:13:45.000000000 +0200
+++ ../lcdproc-0.0.10.SHF-volume/lcd.c 2008-05-27 02:13:22.000000000 +0200
@@ -277,6 +277,15 @@ void cLcd::SetWarning( const char *strin
}
}
+void cLcd::SetChannelSwitch(const cDevice *Device, int ChannelNumber){
+ cLcd::SetLine(1,2," ");
+ cLcd::SetLine(1,3," ");
+ cLcd::SetRunning(false,tr("Waiting for EPG info."), NULL);
+ cLcd::SetRunning(true,tr("Waiting for EPG info."), NULL);
+ epg=false;
+ epg_retry=MAX_EPG_RETRY;
+}
+
void cLcd::ShowVolume(unsigned int vol, bool muted ) {
if (!connected) return;
BeginMutualExclusion();
@@ -712,9 +721,15 @@ void cLcd::Action(void) { // LCD output
// epg update
+ if ( !epg && epg_retry > 0 ) {
+ epg_retry-- ;
+ if ( ( epg_retry % 5 ) == 0 ) nextLcdUpdate=time(NULL)-10;
+ } else epg = true;
+
#ifdef OLDVDR
if ( time(NULL) > nextLcdUpdate ) {
+ epg=true;
const cEventInfo *Present = NULL;
cMutexLock MutexLock;
const cSchedules *Schedules = cSIProcessor::Schedules(MutexLock);
@@ -722,54 +737,99 @@ void cLcd::Action(void) { // LCD output
const cSchedule *Schedule = Schedules->GetSchedule();
if (Schedule) {
const char *PresentTitle, *PresentSubtitle;
+
PresentTitle = NULL; PresentSubtitle = NULL;
if ((Present = Schedule->GetPresentEvent()) != NULL) {
- nextLcdUpdate=Present->GetTime()+Present->GetDuration();
+// nextLcdUpdate=Present->GetTime()+Present->GetDuration();
PresentTitle = Present->GetTitle();
PresentSubtitle = Present->GetSubtitle();
if ( (!isempty(PresentTitle)) && (!isempty(PresentSubtitle)) )
SetRunning(false,Present->GetTimeString(),PresentTitle,PresentSubtitle);
else if (!isempty(PresentTitle)) SetRunning(false,Present->GetTimeString(),PresentTitle);
+ else {
+ SetRunning(false,tr("No EPG info available."), NULL);
+ }
} else
SetRunning(false,tr("No EPG info available."), NULL);
- if ((Present = Schedule->GetFollowingEvent()) != NULL)
- nextLcdUpdate=(Present->GetTime()<nextLcdUpdate)?Present->GetTime():nextLcdUpdate;
+
+ Present = NULL; PresentTitle = NULL; PresentSubtitle = NULL;
+ if ((Present = Schedule->GetFollowingEvent()) != NULL) {
+// nextLcdUpdate=Present->StartTime()+Present->Duration();
+ PresentTitle = Present->Title();
+ PresentSubtitle = Present->ShortText();
+ if ( (!isempty(PresentTitle)) && (!isempty(PresentSubtitle)) )
+ SetRunning(true,Present->GetTimeString(),PresentTitle,PresentSubtitle);
+ else if (!isempty(PresentTitle)) SetRunning(true,Present->GetTimeString(),PresentTitle);
+ else {
+ SetRunning(true,tr("No EPG info available."), NULL);
+ epg=false;
}
+ } else {
+ SetRunning(true,tr("No EPG info available."), NULL);
+ epg=false;
}
- if ( nextLcdUpdate <= time(NULL) )
- nextLcdUpdate=(time(NULL)/60)*60+60;
- else if ( nextLcdUpdate > time(NULL)+60 )
+
+// if ((Present = Schedule->GetFollowingEvent()) != NULL)
+// nextLcdUpdate=(Present->GetTime()<nextLcdUpdate)?Present->GetTime():nextLcdUpdate;
+ }
+ }
+// if ( nextLcdUpdate <= time(NULL) )
+// nextLcdUpdate=(time(NULL)/60)*60+60;
+// else if ( nextLcdUpdate > time(NULL)+60 )
nextLcdUpdate=(time(NULL)/60)*60+60;
}
#else
if ( time(NULL) > nextLcdUpdate ) {
+ epg=true;
cChannel *channel = Channels.GetByNumber(primaryDvbApi->CurrentChannel());
const cEvent *Present = NULL;
cSchedulesLock schedulesLock;
const cSchedules *Schedules = cSchedules::Schedules(schedulesLock);
if (Schedules) {
const cSchedule *Schedule = Schedules->GetSchedule(channel->GetChannelID());
+
if (Schedule) {
const char *PresentTitle, *PresentSubtitle;
+
PresentTitle = NULL; PresentSubtitle = NULL;
if ((Present = Schedule->GetPresentEvent()) != NULL) {
- nextLcdUpdate=Present->StartTime()+Present->Duration();
+// nextLcdUpdate=Present->StartTime()+Present->Duration();
PresentTitle = Present->Title();
PresentSubtitle = Present->ShortText();
if ( (!isempty(PresentTitle)) && (!isempty(PresentSubtitle)) )
SetRunning(false,Present->GetTimeString(),PresentTitle,PresentSubtitle);
else if (!isempty(PresentTitle)) SetRunning(false,Present->GetTimeString(),PresentTitle);
- } else
+ else {
SetRunning(false,tr("No EPG info available."), NULL);
- if ((Present = Schedule->GetFollowingEvent()) != NULL)
- nextLcdUpdate=(Present->StartTime()<nextLcdUpdate)?Present->StartTime():nextLcdUpdate;
}
+ } else {
+ SetRunning(false,tr("No EPG info available."), NULL);
}
- if ( nextLcdUpdate <= time(NULL) )
- nextLcdUpdate=(time(NULL)/60)*60+60;
- else if ( nextLcdUpdate > time(NULL)+60 )
+
+ Present = NULL; PresentTitle = NULL; PresentSubtitle = NULL;
+ if ((Present = Schedule->GetFollowingEvent()) != NULL) {
+// nextLcdUpdate=Present->StartTime()+Present->Duration();
+ PresentTitle = Present->Title();
+ PresentSubtitle = Present->ShortText();
+ if ( (!isempty(PresentTitle)) && (!isempty(PresentSubtitle)) )
+ SetRunning(true,Present->GetTimeString(),PresentTitle,PresentSubtitle);
+ else if (!isempty(PresentTitle)) SetRunning(true,Present->GetTimeString(),PresentTitle);
+ else {
+ SetRunning(true,tr("No EPG info available."), NULL);
+ }
+ } else {
+ SetRunning(true,tr("No EPG info available."), NULL);
+ }
+
+// if ((Present = Schedule->GetFollowingEvent()) != NULL)
+// nextLcdUpdate=(Present->StartTime()<nextLcdUpdate)?Present->StartTime():nextLcdUpdate;
+ }
+ }
+// if ( nextLcdUpdate <= time(NULL) )
+// nextLcdUpdate=(time(NULL)/60)*60+60;
+// else if ( nextLcdUpdate > time(NULL)+60 )
nextLcdUpdate=(time(NULL)/60)*60+60;
}
diff -rupbB ./lcd.h ../lcdproc-0.0.10.SHF-volume/lcd.h
--- ./lcd.h 2008-05-27 02:11:55.000000000 +0200
+++ ../lcdproc-0.0.10.SHF-volume/lcd.h 2008-05-27 01:03:23.000000000 +0200
@@ -14,6 +14,7 @@
#define LCDMAXWID 40
#define LCDMAXCARDS 4
#define LCDMAXFULLSTRING 1024
+#define MAX_EPG_RETRY 45 // : 8 = sec
#define MAX_LCDd_dead 12 // : 8 = sec
class cLcd : public cThread {
@@ -40,6 +41,7 @@ class cLcd : public cThread {
void SetTitle( const char *string);
void SetMain( unsigned int n, const char *string);
void SetHelp( unsigned int n, const char *Red, const char *Green, const char *Yellow, const char *Blue);
+ void SetChannelSwitch(const cDevice *Device, int ChannelNumber);
void SetStatus( const char *string);
void SetWarning( const char *string);
void ShowVolume(unsigned int vol, bool muted );
@@ -65,7 +67,9 @@ class cLcd : public cThread {
char host[100]; // 100 should be sufficient, I think.
unsigned int port;
bool connected;
+ bool epg;
unsigned int LCDd_dead;
+ int epg_retry;
struct StateData ThreadStateData;
time_t LastProgress;
cMutex CriticalArea;
|