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
|
<%pre>
#include <vdr/plugin.h>
#include <vdr/config.h>
#include <vdr/recording.h>
#include <vdr/channels.h>
#include <vdr/menu.h>
#include <vdr/device.h>
#include "exception.h"
#include "setup.h"
#include "tools.h"
#include "epg_events.h"
#include "recman.h"
#include "timerconflict.h"
using namespace vdrlive;
using namespace std;
</%pre>
<%args>
int update;
</%args>
<%session scope="global">
bool logged_in(false);
int update_status(1);
TimerConflictNotifier timerNotifier();
</%session>
<%cpp>
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
string EMPTY_STR;
tChannelID prev_chan;
tChannelID next_chan;
reply.setContentType( "application/xml" );
if (update_status != update) {
update_status = update;
}
string infoMsg;
string infoUrl;
if (timerNotifier.ShouldNotify()) {
infoMsg = timerNotifier.Message();
infoUrl = "timerconflicts.html";
}
#if VDRVERSNUM >= 10403
const char* NowReplaying = cReplayControl::NowReplaying();
#else
const char* NowReplaying = cControl::Control()?cReplayControl::LastReplayed():NULL;
#endif
EpgInfoPtr epgEvent;
if (NowReplaying) {
RecordingsManagerPtr recManager = LiveRecordingsManager();
cRecording *recording = Recordings.GetByName(NowReplaying);
if (recording) {
epgEvent = EpgEvents::CreateEpgInfo(recManager->Md5Hash(recording),
recording,
tr("playing recording"));
}
}
else {
string CHANNEL_STR("channel");
ReadLock channelsLock( Channels );
if (cDevice::CurrentChannel()) {
const int SKIP_GAP = 1;
cChannel* Channel = Channels.GetByNumber(cDevice::CurrentChannel());
cChannel* tmp = Channels.GetByNumber(Channels.GetPrevNormal(cDevice::CurrentChannel()), -SKIP_GAP);
if (tmp)
prev_chan = tmp->GetChannelID();
tmp = Channels.GetByNumber(Channels.GetNextNormal(cDevice::CurrentChannel()), SKIP_GAP);
if (tmp)
next_chan = tmp->GetChannelID();
const string chanName(Channel->Name());
cSchedulesLock schedulesLock;
const cSchedules* Schedules = cSchedules::Schedules(schedulesLock);
const cSchedule *Schedule = Schedules->GetSchedule(Channel);
if (Schedule) {
const cEvent *Event = Schedule->GetPresentEvent();
if (Event) {
epgEvent = EpgEvents::CreateEpgInfo(Channel,
Event,
CHANNEL_STR.c_str());
}
else {
const string noInfo(tr("no epg info for current event!"));
epgEvent = EpgEvents::CreateEpgInfo(CHANNEL_STR,
chanName,
noInfo);
}
}
else {
const string noInfo(tr("no epg info for current channel!"));
epgEvent = EpgEvents::CreateEpgInfo(CHANNEL_STR,
Channel->Name(),
noInfo);
}
}
else {
const string chanName(tr("no current channel!"));
epgEvent = EpgEvents::CreateEpgInfo(CHANNEL_STR,
chanName,
chanName);
}
}
if (!epgEvent) {
const string ERROR_STR("error");
const string noInfo(tr("error retrieving status info!"));
const string chanName(tr("no current channel!"));
epgEvent = EpgEvents::CreateEpgInfo(ERROR_STR,
chanName,
noInfo);
}
else {
if (prev_chan.Valid() && next_chan.Valid())
{
</%cpp>
<& xmlresponse.ibox update=(update_status) type=(epgEvent->Id()) caption=(epgEvent->Caption()) currentTime=(epgEvent->CurrentTime(tr("%I:%M:%S %p"))) duration=(epgEvent->StartTime(tr("%I:%M %p")) + string(" - ") + epgEvent->EndTime(tr("%I:%M %p"))) title=(epgEvent->Title()) elapsed=(epgEvent->Elapsed()) prev_chan=(prev_chan) next_chan=(next_chan) infoMsg=(infoMsg) infoUrl=(infoUrl) &>
<%cpp>
}
else if (prev_chan.Valid()) {
</%cpp>
<& xmlresponse.ibox update=(update_status) type=(epgEvent->Id()) caption=(epgEvent->Caption()) currentTime=(epgEvent->CurrentTime(tr("%I:%M:%S %p"))) duration=(epgEvent->StartTime(tr("%I:%M %p")) + string(" - ") + epgEvent->EndTime(tr("%I:%M %p"))) title=(epgEvent->Title()) elapsed=(epgEvent->Elapsed()) prev_chan=(prev_chan) infoMsg=(infoMsg) infoUrl=(infoUrl) &>
<%cpp>
}
else if (next_chan.Valid()) {
</%cpp>
<& xmlresponse.ibox update=(update_status) type=(epgEvent->Id()) caption=(epgEvent->Caption()) currentTime=(epgEvent->CurrentTime(tr("%I:%M:%S %p"))) duration=(epgEvent->StartTime(tr("%I:%M %p")) + string(" - ") + epgEvent->EndTime(tr("%I:%M %p"))) title=(epgEvent->Title()) elapsed=(epgEvent->Elapsed()) next_chan=(next_chan) infoMsg=(infoMsg) infoUrl=(infoUrl) &>
<%cpp>
}
else {
</%cpp>
<& xmlresponse.ibox update=(update_status) type=(epgEvent->Id()) caption=(epgEvent->Caption()) currentTime=(epgEvent->CurrentTime(tr("%I:%M:%S %p"))) duration=(epgEvent->StartTime(tr("%I:%M %p")) + string(" - ") + epgEvent->EndTime(tr("%I:%M %p"))) title=(epgEvent->Title()) elapsed=(epgEvent->Elapsed()) infoMsg=(infoMsg) infoUrl=(infoUrl) &>
<%cpp>
}
}
</%cpp>
|