diff options
-rw-r--r-- | pages/multischedule.ecpp | 47 | ||||
-rw-r--r-- | pages/setup.ecpp | 9 | ||||
-rw-r--r-- | setup.cpp | 6 | ||||
-rw-r--r-- | setup.h | 3 |
4 files changed, 61 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"> </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> @@ -36,6 +36,8 @@ Setup::Setup(): m_screenshotInterval( 1000 ), m_useAuth( 1 ), m_adminLogin("admin"), + m_channelGroups( "" ), + m_scheduleDuration( "8" ), m_theme("marine"), m_lastwhatsonlistmode("detail"), m_tntnetloglevel("WARN"), @@ -121,6 +123,7 @@ bool Setup::ParseSetupEntry( char const* name, char const* value ) else if ( strcmp( name, "AdminPasswordMD5" ) == 0 ) m_adminPasswordMD5 = value; else if ( strcmp( name, "UserdefTimes" ) == 0 ) m_times = value; else if ( strcmp( name, "ChannelGroups" ) == 0 ) m_channelGroups = value; + else if ( strcmp( name, "ScheduleDuration" ) == 0 ) m_scheduleDuration = value; else if ( strcmp( name, "StartPage" ) == 0 ) m_startscreen = value; else if ( strcmp( name, "Theme" ) == 0 ) m_theme = value; else if ( strcmp( name, "LocalNetMask" ) == 0 ) { m_localnetmask = value; } @@ -224,6 +227,8 @@ std::string const Setup::GetStartScreenLink() const return "whats_on.html?type=next"; else if (m_startscreen == "schedule") return "schedule.html"; + else if (m_startscreen == "multischedule") + return "multischedule.html"; else if (m_startscreen == "timers") return "timers.html"; else if (m_startscreen == "recordings") @@ -286,6 +291,7 @@ bool Setup::SaveSetup() } liveplugin->SetupStore("UserdefTimes", m_times.c_str()); liveplugin->SetupStore("ChannelGroups", m_channelGroups.c_str()); + liveplugin->SetupStore("ScheduleDuration", m_scheduleDuration.c_str()); liveplugin->SetupStore("StartPage", m_startscreen.c_str()); liveplugin->SetupStore("Theme", m_theme.c_str()); liveplugin->SetupStore("LastWhatsOnListMode", m_lastwhatsonlistmode.c_str()); @@ -45,6 +45,7 @@ class Setup bool UseAuth() const; std::string const GetTimes() const { return m_times; } std::string const GetChannelGroups() const { return m_channelGroups; } + std::string const GetScheduleDuration() const { return m_scheduleDuration; } std::string const GetStartScreen() const { return m_startscreen; } std::string const GetStartScreenLink() const; std::string const GetTheme() const { return m_theme; } @@ -70,6 +71,7 @@ class Setup void SetScreenshotInterval(int interval) { m_screenshotInterval = interval; } void SetTimes(std::string const & times) { m_times = times; } void SetChannelGroups(std::string const & channelGroups) { m_channelGroups = channelGroups; } + void SetScheduleDuration(std::string const & scheduleDuration) { m_scheduleDuration = scheduleDuration; } void SetStartScreen(std::string const & startscreen) { m_startscreen = startscreen; } void SetTheme(std::string const & theme) { m_theme = theme; } void SetLocalNetMask(std::string const & localnetmask) { m_localnetmask = localnetmask; } @@ -122,6 +124,7 @@ class Setup std::string m_adminPasswordMD5; std::string m_times; std::string m_channelGroups; + std::string m_scheduleDuration; std::string m_startscreen; std::string m_theme; std::string m_localnetmask; |