summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/multischedule.ecpp47
-rw-r--r--pages/setup.ecpp9
2 files changed, 52 insertions, 4 deletions
diff --git a/pages/multischedule.ecpp b/pages/multischedule.ecpp
index f3188f0..4ae0c7e 100644
--- a/pages/multischedule.ecpp
+++ b/pages/multischedule.ecpp
@@ -37,7 +37,7 @@ struct SchedEntry {
std::vector<time_t> times_start;
</%pre>
<%args>
- unsigned int channel = 0;
+ int channel = -1;
unsigned int time_para = 0;
</%args>
<%session scope="global">
@@ -136,6 +136,29 @@ pageTitle = trVDR("Schedule");
}
}
}
+ if ( channel < 0 ) {
+ if (cDevice::CurrentChannel()) {
+ // find group corresponding to current channel
+ int curGroup =0;
+ int curChannel = cDevice::CurrentChannel();
+ for ( std::vector< std::vector<int> >::iterator grIt = channel_groups_numbers.begin();
+ grIt != channel_groups_numbers.end() && channel < 0; ++grIt, ++curGroup )
+ {
+ for ( std::vector<int>::iterator chIt = (*grIt).begin();
+ chIt != (*grIt).end() && channel < 0; ++ chIt )
+ {
+ if ( *chIt == curChannel )
+ channel_group = channel = curGroup;
+ }
+ }
+ // if nothing is found, fall back to group 0
+ if ( channel < 0 )
+ channel = 0;
+ }
+ else {
+ channel_group = channel;
+ }
+ }
if ( channel >= channel_groups_numbers.size() )
channel = 0;
@@ -172,7 +195,6 @@ pageTitle = trVDR("Schedule");
{
times_names.push_back(FormatDateTime( tr("%A, %x"), midnight + MAX_HOURS*3600*i)
+std::string(" ")+ FormatDateTime( tr("%I:%M %p"), midnight + MAX_HOURS*3600*i) );
- //times_names.push_back("today 0:00");
times_start.push_back( midnight + MAX_HOURS*3600*i );
}
if ( time_para >= times_names.size() )
@@ -199,10 +221,23 @@ pageTitle = trVDR("Schedule");
if ( time_para >= times_start.size() )
time_para = times_start.size()-1;
time_t sched_start = times_start[ time_para ];
- time_t sched_end = sched_start + 60 * 60 * MAX_HOURS;
+ time_t max_hours;
+ try {
+ max_hours = lexical_cast<time_t>( LiveSetup().GetScheduleDuration() );
+ }
+ catch ( const bad_lexical_cast & )
+ {
+ esyslog("Live: could not convert '%s' into a schedule duration", LiveSetup().GetScheduleDuration().c_str());
+ max_hours = 8;
+ };
+ if (max_hours > 48)
+ max_hours = 48;
+
+ time_t sched_end = sched_start + 60 * 60 * max_hours;
int sched_end_row = ( sched_end - sched_start ) / 60 / MINUTES_PER_ROW;
std::list<SchedEntry> table[MAX_CHANNELS];
std::vector<std::string> channel_names(channel_groups_numbers[ channel ].size() );
+ std::vector<tChannelID> channel_IDs(channel_groups_numbers[ channel ].size() );
if ( channel >= channel_groups_numbers.size() )
channel = channel_groups_numbers.size()-1;
//for ( int chan = 0; chan<MAX_CHANNELS; chan++)
@@ -219,6 +254,7 @@ pageTitle = trVDR("Schedule");
if ( Channel->GroupSep() || Channel->Name() == '\0' )
continue;
channel_names[ j ] = Channel->Name();
+ channel_IDs[ j ] = Channel->GetChannelID();
cSchedule const* Schedule = schedules->GetSchedule( Channel );
if ( ! Schedule )
@@ -299,7 +335,10 @@ pageTitle = trVDR("Schedule");
for ( unsigned int channel = 0; channel< channel_names.size() ; channel++)
{
</%cpp>
- <td> <div class="boxheader"> <div> <div><$ StringEscapeAndBreak(channel_names[channel]) $> </div></div> </div></td>
+ <td> <div class="boxheader"> <div> <div><$ StringEscapeAndBreak(channel_names[channel]) $>
+ <& pageelems.ajax_action_href action="switch_channel" tip=(tr("Switch to this channel.")) param=(channel_IDs[channel]) image="zap.png" alt="" &>
+ <& pageelems.vlc_stream_channel channelId=(channel_IDs[channel]) &>
+ </div></div> </div></td>
<td class="time spacer"> &nbsp; </td>
<%cpp>
}
diff --git a/pages/setup.ecpp b/pages/setup.ecpp
index c1d328f..d5d4f2a 100644
--- a/pages/setup.ecpp
+++ b/pages/setup.ecpp
@@ -17,6 +17,7 @@ using namespace std;
string pass;
string times;
string channelGroups;
+ string scheduleDuration;
string startscreen;
string theme;
string localnetmask;
@@ -60,6 +61,7 @@ if (!cUser::CurrentUserHasRightTo(UR_EDITSETUP))
}
LiveSetup().SetTimes(times);
LiveSetup().SetChannelGroups(channelGroups);
+ LiveSetup().SetScheduleDuration(scheduleDuration);
LiveSetup().SetStartScreen(startscreen);
LiveSetup().SetTheme(theme);
LiveSetup().SetShowLogo(!showLogo.empty());
@@ -88,6 +90,7 @@ if (!cUser::CurrentUserHasRightTo(UR_EDITSETUP))
useauth = LiveSetup().GetUseAuth();
times = LiveSetup().GetTimes();
channelGroups = LiveSetup().GetChannelGroups();
+ scheduleDuration = LiveSetup().GetScheduleDuration();
startscreen = LiveSetup().GetStartScreen();
theme = LiveSetup().GetTheme();
localnetmask = LiveSetup().GetLocalNetMask();
@@ -235,6 +238,11 @@ if (!cUser::CurrentUserHasRightTo(UR_EDITSETUP))
<& tooltip.help text=(tr("Separate channels with a comma ',', separate groups with a semi-colon ';'")) &></td>
</tr>
<tr>
+ <td class="label leftcol"><div class="withmargin"><$ tr("Duration of MultiSchedule in hours") $>:</div></td>
+ <td class="rightcol"><input type="text" name="scheduleDuration" value="<$ scheduleDuration $>" id="scheduleDuration" />
+ </td>
+ </tr>
+ <tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Show channels without EPG") $>:</div></td>
<td class="rightcol">
<input type="checkbox" name="showChannelsWithoutEPG" id="showChannelsWithoutEPG" value="1" <%cpp> CHECKIF(!showChannelsWithoutEPG.empty()); </%cpp>/>
@@ -247,6 +255,7 @@ if (!cUser::CurrentUserHasRightTo(UR_EDITSETUP))
<option value="whatsonnow" <%cpp> SELECTIF(startscreen == "whatsonnow") </%cpp>><$ trVDR("What's on now?") $></option>
<option value="whatsonnext" <%cpp> SELECTIF(startscreen == "whatsonnext") </%cpp>><$ trVDR("What's on next?") $></option>
<option value="schedule" <%cpp> SELECTIF(startscreen == "schedule") </%cpp>><$ trVDR("Schedule") $></option>
+ <option value="multischedule" <%cpp> SELECTIF(startscreen == "multischedule") </%cpp>><$ trVDR("MultiSchedule") $></option>
<option value="recordings" <%cpp> SELECTIF(startscreen == "recordings") </%cpp>><$ trVDR("Recordings") $></option>
<option value="timers" <%cpp> SELECTIF(startscreen == "timers") </%cpp>><$ trVDR("Timers") $></option>
</select></td>