summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/multischedule.ecpp99
-rw-r--r--pages/setup.ecpp8
2 files changed, 83 insertions, 24 deletions
diff --git a/pages/multischedule.ecpp b/pages/multischedule.ecpp
index bf05fa6..f3188f0 100644
--- a/pages/multischedule.ecpp
+++ b/pages/multischedule.ecpp
@@ -32,6 +32,7 @@ struct SchedEntry {
};
std::vector<std::string> channel_groups_names;
+ std::vector< std::vector<int> > channel_groups_numbers;
std::vector<std::string> times_names;
std::vector<time_t> times_start;
</%pre>
@@ -55,39 +56,89 @@ pageTitle = trVDR("Schedule");
if ( !channelsLock )
throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") );
-#define MAX_CHANNELS 5
+#define MAX_CHANNELS 10
#define MAX_DAYS 3
#define MAX_HOURS 8
#define MINUTES_PER_ROW 5
#define CHARACTERS_PER_ROW 30
+ if ( channel_groups_numbers.size() == 0 )
+ {
// build the groups of channels to display
- std::vector< std::vector<int> > channel_groups_numbers;
- channel_groups_names.clear();
- int cur_group_count=0;
- for ( cChannel *listChannel = Channels.First(); listChannel; listChannel = Channels.Next( listChannel ) )
+ std::string channelGroups=LiveSetup().GetChannelGroups();
+ if ( channelGroups.empty() )
{
- if ( listChannel->GroupSep() || *listChannel->Name() == '\0' )
- continue;
+ // setup default channel groups
+ int lastChannel = LiveSetup().GetLastChannel();
+ if ( lastChannel == 0 )
+ lastChannel = Channels.MaxNumber();
+ std::stringstream groups;
+ for ( int i = 1; i<= lastChannel; i++)
+ {
+ groups << i;
+ if ( (i % 5) == 0 )
+ groups << ";";
+ else
+ groups << ",";
+ }
+ channelGroups = groups.str();
+ LiveSetup().SetChannelGroups( channelGroups );
+ }
+ size_t groupSep;
+ std::string thisGroup = "";
+ while ( ! channelGroups.empty() )
+ {
+ groupSep = channelGroups.find(';');
+ thisGroup = channelGroups.substr(0, groupSep );
+ if ( groupSep != channelGroups.npos )
+ channelGroups.erase(0, groupSep+1 );
+ else
+ channelGroups="";
- if ( cur_group_count==0 )
+ int cur_group_count=0;
+ channel_groups_names.push_back( std::string() );
+ channel_groups_numbers.push_back( std::vector<int>() );
+ while ( !thisGroup.empty() )
+ {
+ std::string thisChannel;
+ try {
+ if ( cur_group_count != 0 )
+ channel_groups_names.back() += std::string( " - " );
+ size_t channelSep = thisGroup.find(',');
+ thisChannel = thisGroup.substr(0, channelSep );
+ if ( channelSep != thisGroup.npos )
+ thisGroup.erase( 0, channelSep+1 );
+ else
+ thisGroup = "";
+ int channel_no = lexical_cast< int > (thisChannel);
+ cChannel* Channel = Channels.GetByNumber( channel_no );
+ if ( !Channel )
+ {
+ esyslog("Live: could not find channel no '%s'.", thisChannel.c_str() );
+ continue;
+ }
+ channel_groups_names.back() += std::string( Channel->Name() );
+ channel_groups_numbers.back().push_back( Channel->Number() );
+ cur_group_count++;
+ if ( cur_group_count>=MAX_CHANNELS )
+ {
+ // start new group if group gets too large
+ cur_group_count=0;
+ channel_groups_names.push_back( std::string() );
+ channel_groups_numbers.push_back( std::vector<int>() );
+ }
+ }
+ catch ( const bad_lexical_cast & )
{
- // first entry in this group
- channel_groups_names.push_back( std::string() );
- channel_groups_numbers.push_back( std::vector<int>( MAX_CHANNELS) );
+ esyslog("Live: could not convert '%s' into a channel number", thisChannel.c_str());
+ continue;
}
- else channel_groups_names.back() += " - ";
-
- channel_groups_names.back() += std::string( listChannel->Name() );
- channel_groups_numbers.back()[ cur_group_count ] = listChannel->Number();
+ }
+ }
+ }
- cur_group_count++;
- if ( cur_group_count >= MAX_CHANNELS )
- // we need a new group next round
- cur_group_count = 0;
- }
if ( channel >= channel_groups_numbers.size() )
- channel = channel_groups_numbers.size()-1;
+ channel = 0;
channel_group = channel;
{
// build time list
@@ -151,11 +202,11 @@ pageTitle = trVDR("Schedule");
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];
- string channel_names[ MAX_CHANNELS];
+ std::vector<std::string> channel_names(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++)
- for ( int j = 0; j<MAX_CHANNELS; j++)
+ for ( unsigned int j = 0; j<channel_groups_numbers[ channel ].size(); j++)
{
int prev_row = -1;
@@ -245,7 +296,7 @@ pageTitle = trVDR("Schedule");
<td > <div class="boxheader"> <div><div><$ tr("Time") $></div></div> </div></td>
<td class="time spacer"> &nbsp; </td>
<%cpp>
- for ( int channel = 0; channel< MAX_CHANNELS ; channel++)
+ 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>
diff --git a/pages/setup.ecpp b/pages/setup.ecpp
index 98bf1eb..c1d328f 100644
--- a/pages/setup.ecpp
+++ b/pages/setup.ecpp
@@ -16,6 +16,7 @@ using namespace std;
string login;
string pass;
string times;
+ string channelGroups;
string startscreen;
string theme;
string localnetmask;
@@ -58,6 +59,7 @@ if (!cUser::CurrentUserHasRightTo(UR_EDITSETUP))
LiveSetup().CheckLocalNet(request.getPeerIp());
}
LiveSetup().SetTimes(times);
+ LiveSetup().SetChannelGroups(channelGroups);
LiveSetup().SetStartScreen(startscreen);
LiveSetup().SetTheme(theme);
LiveSetup().SetShowLogo(!showLogo.empty());
@@ -85,6 +87,7 @@ if (!cUser::CurrentUserHasRightTo(UR_EDITSETUP))
login = LiveSetup().GetAdminLogin();
useauth = LiveSetup().GetUseAuth();
times = LiveSetup().GetTimes();
+ channelGroups = LiveSetup().GetChannelGroups();
startscreen = LiveSetup().GetStartScreen();
theme = LiveSetup().GetTheme();
localnetmask = LiveSetup().GetLocalNetMask();
@@ -227,6 +230,11 @@ if (!cUser::CurrentUserHasRightTo(UR_EDITSETUP))
<& tooltip.help text=(tr("Format is HH:MM. Separate multiple times with a semicolon")) &></td>
</tr>
<tr>
+ <td class="label leftcol"><div class="withmargin"><$ tr("Channel groups for MultiSchedule") $>:</div></td>
+ <td class="rightcol"><input type="text" name="channelGroups" value="<$ channelGroups $>" id="channelGroups" />
+ <& 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("Show channels without EPG") $>:</div></td>
<td class="rightcol">
<input type="checkbox" name="showChannelsWithoutEPG" id="showChannelsWithoutEPG" value="1" <%cpp> CHECKIF(!showChannelsWithoutEPG.empty()); </%cpp>/>