Difference between revisions of "Vdradmin-initial-lookup-patch"

From VDR Wiki
Jump to: navigation, search
m (Patch)
m (Protected "Vdradmin-initial-lookup-patch" [edit=autoconfirmed:move=autoconfirmed])
 
(12 intermediate revisions by 10 users not shown)
Line 137: Line 137:
   
 
<diff>
 
<diff>
diff -Nur vdradmin-am-3.4.4/template/default/prog_summary.html vdradmin-am-3.4.4-biglist/template/default/prog_summary.html
+
diff -Nur vdradmin-am-3.5.3/template/default/prog_summary.html vdradmin-am-3.5.3-biglist/template/default/prog_summary.html
--- vdradmin-am-3.4.4/template/default/prog_summary.html
+
--- vdradmin-am-3.5.3/template/default/prog_summary.html
+++ vdradmin-am-3.4.4-biglist/template/default/prog_summary.html
+
+++ vdradmin-am-3.5.3-biglist/template/default/prog_summary.html
@@ -23,7 +23,7 @@
+
@@ -30,7 +30,7 @@
  +
<option value="<?% time.id %?>" <?% IF time.sel %?>selected="selected"<?% END %?>><?% time.name %?></option>
<td class="col_other">
 
  +
<?% END %?>
<%! What's on: !%>&nbsp;<a href="<tmpl_var nowurl>"><%! now !%></a>&nbsp;|<%! at: !%>&nbsp;
 
  +
</select>
<input type="text" name="time" size="5" value="<tmpl_var now>" />
 
  +
- <?% gettext('at') %?>&nbsp;<input type="text" name="time" size="5" value="<?% now %?>" />&nbsp;<?% gettext('o\'clock') %?>
- &nbsp;<%! o'clock !%>
 
  +
+ <?% gettext('at') %?>&nbsp;<input type="text" name="time" size="5" value="<?% now %?>" />
+
 
 
</td>
 
</td>
  +
<?% END %?>
<td class="col_right"></td>
 
 
</tr>
 
</tr>
diff -Nur vdradmin-am-3.4.4/vdradmind.pl vdradmin-am-3.4.4-biglist/vdradmind.pl
+
diff -Nur vdradmin-am-3.5.3/vdradmind.pl vdradmin-am-3.5.3-biglist/vdradmind.pl
--- vdradmin-am-3.4.4/vdradmind.pl
+
--- vdradmin-am-3.5.3/vdradmind.pl
+++ vdradmin-am-3.4.4-biglist/vdradmind.pl
+
+++ vdradmin-am-3.5.3-biglist/vdradmind.pl
@@ -2522,6 +2522,8 @@
+
@@ -3365,6 +3365,8 @@
my $last_day = 0;
+
my $last_day = 0;
my $day = $current_day;
+
my $day = $current_day;
$day = $q->param("day") if ($q->param("day"));
+
$day = $q->param("day") if ($q->param("day"));
+ my $prefix = 'a';
+
+ my $prefix = 'a';
+ $prefix = $q->param("prefix") if ($q->param("prefix"));
+
+ $prefix = $q->param("prefix") if ($q->param("prefix"));
  +
my $param_time = $q->param("time");
 
 
#
+
#
  +
@@ -3384,7 +3386,8 @@
my $vdr_id;
 
  +
}
@@ -2539,7 +2541,8 @@
 
}
 
 
# skip channels without EPG data
 
- if(ChannelHasEPG($channel->{vdr_id})) {
 
+ if(ChannelHasEPG($channel->{vdr_id})
 
+ &&$channel->{name}=~/^$prefix/i) {
 
push(@channel, {
 
name => $channel->{name},
 
vdr_id => $channel->{vdr_id},
 
@@ -2608,8 +2611,13 @@
 
 
 
  +
# skip channels without EPG data
#
 
  +
- if (ChannelHasEPG($channel->{vdr_id})) {
my($template) = TemplateNew("prog_list2.html");
 
  +
+ if (ChannelHasEPG($channel->{vdr_id})
+ my $switcher="<a href='vdradmin.pl?aktion=prog_list2&prefix=%5B%5Ea%2Dz%5D'>#</a> ";
 
  +
+ &&$channel->{name}=~/^$prefix/i) {
+ foreach(('a','b','c','d','e','f','g','h','i','j','k','l','m',
 
  +
push(@channel,
+ 'n','o','p','q','r','s','t','u','v','w','x','y','z')) {
 
  +
{ name => $channel->{name},
+ $switcher.="<a href='vdradmin.pl?aktion=prog_list2&prefix=$_'>$_</a> ";
 
  +
vdr_id => $channel->{vdr_id}
+ }
 
  +
@@ -3491,8 +3494,13 @@
my $vars = {
 
  +
}
- title => $day == $current_day ? gettext("Playing Today") : ($day == $current_day + 1 ? gettext("Playing Tomorrow") : sprintf(gettext("Playing on the %d."), $day)),
 
+ title => ($day == $current_day ? gettext("Playing Today") : ($day == $current_day + 1 ? gettext("Playing Tomorrow") : sprintf(gettext("Playing on the %d."), $day)))." $switcher",
 
usercss => $UserCSS,
 
url => $MyURL,
 
loop => \@show,
 
@@ -3800,6 +3808,9 @@
 
return if(UptoDate());
 
my $time = $q->param("time");
 
my $search = $q->param("search");
 
+ my $prefix = 'a';
 
+ $prefix = '' if ($q->param("search"));
 
+ $prefix = $q->param("prefix") if ($q->param("prefix"));
 
 
 
# zeitpunkt bestimmen
+
#
  +
+ my $switcher="<a href='vdradmin.pl?aktion=prog_list2&prefix=%5B%5Ea%2Dz%5D'>#</a> ";
my $event_time;
 
  +
+ foreach(('a','b','c','d','e','f','g','h','i','j','k','l','m',
@@ -3907,7 +3918,9 @@
 
  +
+ 'n','o','p','q','r','s','t','u','v','w','x','y','z')) {
$displaysubtitle =~ s/\|/<br \/>\n/g;
 
  +
+ $switcher.="<a href='vdradmin.pl?aktion=prog_list2&prefix=$_'>$_</a> ";
}
 
  +
+ }
my $myself = Encode_Referer($MyURL . "?" . $Query);
 
- push(@show, {
+
my $vars = {
  +
- title => $day == $current_day ? gettext("Playing Today") : ($day == $current_day + 1 ? gettext("Playing Tomorrow") : sprintf(gettext("Playing on the %s"), $hash_days{$day})),
+ if ($event->{channel_name}=~/^$prefix/i)
 
  +
+ title => ($day == $current_day ? gettext("Playing Today") : ($day == $current_day + 1 ? gettext("Playing Tomorrow") : sprintf(gettext("Playing on the %s"), $hash_days{$day})))." $switcher",
+ {
 
  +
now => my_strftime("%H:%M", $time),
+ push(@show, {
 
date => my_strftime("%x", $event->{start}),
+
day => $day,
  +
days => \@days,
longdate => my_strftime("%A, %x", $event->{start}),
 
  +
@@ -4631,6 +4639,9 @@
start => my_strftime("%H:%M", $event->{start}),
 
  +
return if (UptoDate());
@@ -3927,6 +3940,7 @@
 
anchor => "id" . $event->{event_id}
+
my $time = $q->param("time");
  +
my $search = $q->param("search");
});
 
  +
+ my $prefix = 'a';
last if(!$search);
 
  +
+ $prefix = '' if ($q->param("search"));
+ }
 
  +
+ $prefix = $q->param("prefix") if ($q->param("prefix"));
}
 
  +
my $next = $q->param("next");
}
 
  +
my $view = $CONFIG{PS_VIEW};
  +
$view = $q->param("view") if($q->param("view"));
  +
@@ -4715,7 +4726,9 @@
  +
$imdb_title =~ s/^.*\~\%*([^\~]*)$/$1/;
  +
my $myself = Encode_Referer($MyURL . "?" . $Query);
  +
my $running = $event->{start} <= $now && $now <= $event->{stop};
  +
- push(@show,
  +
+ if ($event->{channel_name}=~/^$prefix/i)
  +
+ {
  +
+ push(@show,
  +
{ date => my_strftime("%x", $event->{start}),
  +
longdate => my_strftime("%A, %x", $event->{start}),
  +
start => my_strftime("%H:%M", $event->{start}),
  +
@@ -4742,6 +4755,7 @@
  +
}
  +
);
  +
last if (!$search);
  +
+ }
  +
}
  +
}
 
 
@@ -3947,12 +3961,17 @@
+
@@ -4782,10 +4796,15 @@
}
 
 
 
#
+
#
  +
my $label = $next ? gettext("What's on after") : gettext("What's on at");
+ my $switcher="<a href='vdradmin.pl?aktion=prog_list2&prefix=%5B%5Ea%2Dz%5D'>#</a> ";
 
  +
+ my $switcher="<a href='vdradmin.pl?aktion=prog_list2&prefix=%5B%5Ea%2Dz%5D'>#</a> ";
+ foreach(('a','b','c','d','e','f','g','h','i','j','k','l','m',
 
+ 'n','o','p','q','r','s','t','u','v','w','x','y','z')) {
+
+ foreach(('a','b','c','d','e','f','g','h','i','j','k','l','m',
  +
+ 'n','o','p','q','r','s','t','u','v','w','x','y','z')) {
+ $switcher.="<a href='vdradmin.pl?aktion=prog_summary&prefix=$_'>$_</a> ";
 
  +
+ $switcher.="<a href='vdradmin.pl?aktion=prog_summary&prefix=$_'>$_</a> ";
+ }
 
  +
+ }
my $template = TemplateNew("prog_summary.html");
 
my $vars = {
+
my $vars = { rows => \@show,
  +
now => $displayed_time,
usercss => $UserCSS,
 
  +
title => ($search ? gettext("Suitable matches for:") . " <i>" . CGI::escapeHTML($search) . "</i>"
rows => \@shows,
 
now => strftime("%H:%M", localtime($event_time)),
+
- : $label . " " . strftime("%H:%M", localtime($event_time)) . " " . gettext("o'clock")),
- title => $search ? gettext("Suitable matches for:") . " " . $search : strftime("%H:%M", localtime($event_time)) . " " . gettext("o'clock"),
+
+ : $label . " " . strftime("%H:%M", localtime($event_time)) . " " . gettext("o'clock")) . " " . $switcher,
  +
switchview_url => $MyURL . "?aktion=prog_summary&amp;view=" . ($view eq "ext" ? "sml" : "ext") . ($next ? "&amp;next=1" : "") . ($search ? "&amp;search=" . uri_escape($search) : "") . ($time ? "&amp;time=$time" : ""),
+ title => $search ? gettext("Suitable matches for:") . " " . $search : strftime("%H:%M", localtime($event_time)) . " " . gettext("o'clock") . " " . $switcher,
 
  +
switchview_text => ($view eq "ext" ? gettext("short view") : gettext("long view")),
nowurl => $MyURL . "?aktion=prog_summary",
 
url => $MyURL
+
times => \@times,
};
 
 
 
</diff>
 
</diff>
   

Latest revision as of 18:32, 27 September 2008

Description

When using the big summary pages of VDRadmin on a big channels.conf list, loading takes a while and it needs quite some resources. This patch enables categorizing the channels by initial letters.

Hardware requirements

Software requirements

  • patch
  • vdradmin

Installation

You can install it with

cd $SOURCEDIR/vdradmin
patch -p 1 < /path/to/patch

Note, VDRadmin has to be reinstalled now.

Problems

Patch

Version for vdradmin:

<diff> diff -Nur vdradmin-0.97-am3.4.2/debian/vdradmin/usr/share/vdradmin/template/default/prog_summary.html vdradmin-0.97-am3.4.2-biglist2/debian/vdradmin/usr/share/vdradmin/template/default/prog_summary.html --- vdradmin-0.97-am3.4.2/debian/vdradmin/usr/share/vdradmin/template/default/prog_summary.html +++ vdradmin-0.97-am3.4.2-biglist2/debian/vdradmin/usr/share/vdradmin/template/default/prog_summary.html @@ -18,7 +18,7 @@

-

<tmpl_var now> <%! o'clock !%>

+

<tmpl_var now><%! !%>

					<%! What's on: !%> <a href="<tmpl_var nowurl>"><%! now !%></a> |<%! at: !%> 

diff -Nur vdradmin-0.97-am3.4.2/template/default/prog_summary.html vdradmin-0.97-am3.4.2-biglist2/template/default/prog_summary.html --- vdradmin-0.97-am3.4.2/template/default/prog_summary.html +++ vdradmin-0.97-am3.4.2-biglist2/template/default/prog_summary.html @@ -18,7 +18,7 @@

-

<tmpl_var now> <%! o'clock !%>

+

<tmpl_var now>

					<%! What's on: !%> <a href="<tmpl_var nowurl>"><%! now !%></a> |<%! at: !%> 

diff -Nur vdradmin-0.97-am3.4.2/vdradmind.pl vdradmin-0.97-am3.4.2-biglist2/vdradmind.pl --- vdradmin-0.97-am3.4.2/vdradmind.pl +++ vdradmin-0.97-am3.4.2-biglist2/vdradmind.pl @@ -2418,6 +2418,8 @@

	my $last_day = 0;
	my $day = $current_day;
	$day = $q->param("day") if ($q->param("day"));

+ my $prefix = 'a'; + $prefix = $q->param("prefix") if ($q->param("prefix"));

	#
  my $vdr_id;

@@ -2434,7 +2436,8 @@

    } 
    
    # skip channels without EPG data

- if(ChannelHasEPG($channel->{vdr_id})) { + if(ChannelHasEPG($channel->{vdr_id}) + &&$channel->{name}=~/^$prefix/i) {

			push(@channel, {
				name       => $channel->{name},
				vdr_id     => $channel->{vdr_id},

@@ -2504,8 +2507,13 @@

  # 
  my($template) = TemplateNew("prog_list2.html");

+ my $switcher="<a href='vdradmin.pl?aktion=prog_list2&prefix=%5B%5Ea%2Dz%5D'>#</a> "; + foreach(('a','b','c','d','e','f','g','h','i','j','k','l','m', + 'n','o','p','q','r','s','t','u','v','w','x','y','z')) { + $switcher.="<a href='vdradmin.pl?aktion=prog_list2&prefix=$_'>$_</a> "; + }

  my $vars = {

- title => $day == $current_day ? gettext("Playing Today") : ($day == $current_day + 1 ? gettext("Playing Tomorrow") : sprintf(gettext("Playing on the %d."), $day)), + title => ($day == $current_day ? gettext("Playing Today") : ($day == $current_day + 1 ? gettext("Playing Tomorrow") : sprintf(gettext("Playing on the %d."), $day)))." $switcher",

		usercss        => $UserCSS,
    url            => $MyURL,
    loop           => \@show,

@@ -3686,6 +3694,9 @@

  return if(UptoDate());
  my $time = $q->param("time");
  my $search = $q->param("search");

+ my $prefix = 'a'; + $prefix = if ($q->param("search")); + $prefix = $q->param("prefix") if ($q->param("prefix"));

  # zeitpunkt bestimmen
  my $event_time;

@@ -3762,7 +3773,9 @@

			$displaytitle =~ s/\|/
\n/g; $displaysubtitle =~ s/\n/
\n/g; $displaysubtitle =~ s/\|/
\n/g;

- push(@show, { + if ($event->{channel_name}=~/^$prefix/i) + { + push(@show, {

				date           => my_strftime("%x", $event->{start}),
				longdate       => my_strftime("%A, %x", $event->{start}),
				start          => my_strftime("%H:%M", $event->{start}),

@@ -3782,6 +3795,7 @@

        anchor         => "id" . $event->{event_id}
				});
				last if(!$search);

+ }

			}
		}

@@ -3802,11 +3816,17 @@

		}

		#

+ my $switcher="<a href='vdradmin.pl?aktion=prog_list2&prefix=%5B%5Ea%2Dz%5D'>#</a> "; + foreach(('a','b','c','d','e','f','g','h','i','j','k','l','m', + 'n','o','p','q','r','s','t','u','v','w','x','y','z')) { + $switcher.="<a href='vdradmin.pl?aktion=prog_summary&prefix=$_'>$_</a> "; + }

		my $template = TemplateNew("prog_summary.html");
  my $vars = {
		usercss => $UserCSS,
    rows    => \@shows,

- now => strftime("%H:%M", localtime($event_time)), + now => strftime("%H:%M", localtime($event_time)) + ." o'clock $switcher",

    nowurl  => $MyURL . "?aktion=prog_summary",
    url     => $MyURL
  };

</diff>

Version for vdradmin-am:

<diff> diff -Nur vdradmin-am-3.5.3/template/default/prog_summary.html vdradmin-am-3.5.3-biglist/template/default/prog_summary.html --- vdradmin-am-3.5.3/template/default/prog_summary.html +++ vdradmin-am-3.5.3-biglist/template/default/prog_summary.html @@ -30,7 +30,7 @@

						<option value="<?% time.id %?>" <?% IF time.sel %?>selected="selected"<?% END %?>><?% time.name %?></option>
	<?% END %?>
					</select>

- <?% gettext('at') %?> <input type="text" name="time" size="5" value="<?% now %?>" /> <?% gettext('o\'clock') %?> + <?% gettext('at') %?> <input type="text" name="time" size="5" value="<?% now %?>" />

<?% END %?> diff -Nur vdradmin-am-3.5.3/vdradmind.pl vdradmin-am-3.5.3-biglist/vdradmind.pl --- vdradmin-am-3.5.3/vdradmind.pl +++ vdradmin-am-3.5.3-biglist/vdradmind.pl @@ -3365,6 +3365,8 @@ my $last_day = 0; my $day = $current_day; $day = $q->param("day") if ($q->param("day")); + my $prefix = 'a'; + $prefix = $q->param("prefix") if ($q->param("prefix")); my $param_time = $q->param("time"); # @@ -3384,7 +3386,8 @@ } # skip channels without EPG data - if (ChannelHasEPG($channel->{vdr_id})) { + if (ChannelHasEPG($channel->{vdr_id}) + &&$channel->{name}=~/^$prefix/i) { push(@channel, { name => $channel->{name}, vdr_id => $channel->{vdr_id} @@ -3491,8 +3494,13 @@ } # + my $switcher="<a href='vdradmin.pl?aktion=prog_list2&prefix=%5B%5Ea%2Dz%5D'>#</a> "; + foreach(('a','b','c','d','e','f','g','h','i','j','k','l','m', + 'n','o','p','q','r','s','t','u','v','w','x','y','z')) { + $switcher.="<a href='vdradmin.pl?aktion=prog_list2&prefix=$_'>$_</a> "; + } my $vars = { - title => $day == $current_day ? gettext("Playing Today") : ($day == $current_day + 1 ? gettext("Playing Tomorrow") : sprintf(gettext("Playing on the %s"), $hash_days{$day})), + title => ($day == $current_day ? gettext("Playing Today") : ($day == $current_day + 1 ? gettext("Playing Tomorrow") : sprintf(gettext("Playing on the %s"), $hash_days{$day})))." $switcher", now => my_strftime("%H:%M", $time), day => $day, days => \@days, @@ -4631,6 +4639,9 @@ return if (UptoDate()); my $time = $q->param("time"); my $search = $q->param("search"); + my $prefix = 'a'; + $prefix = if ($q->param("search")); + $prefix = $q->param("prefix") if ($q->param("prefix")); my $next = $q->param("next"); my $view = $CONFIG{PS_VIEW}; $view = $q->param("view") if($q->param("view")); @@ -4715,7 +4726,9 @@ $imdb_title =~ s/^.*\~\%*([^\~]*)$/$1/; my $myself = Encode_Referer($MyURL . "?" . $Query); my $running = $event->{start} <= $now && $now <= $event->{stop}; - push(@show, + if ($event->{channel_name}=~/^$prefix/i) + { + push(@show, { date => my_strftime("%x", $event->{start}), longdate => my_strftime("%A, %x", $event->{start}), start => my_strftime("%H:%M", $event->{start}), @@ -4742,6 +4755,7 @@ } ); last if (!$search); + } } } @@ -4782,10 +4796,15 @@ # my $label = $next ? gettext("What's on after") : gettext("What's on at"); + my $switcher="<a href='vdradmin.pl?aktion=prog_list2&prefix=%5B%5Ea%2Dz%5D'>#</a> "; + foreach(('a','b','c','d','e','f','g','h','i','j','k','l','m', + 'n','o','p','q','r','s','t','u','v','w','x','y','z')) { + $switcher.="<a href='vdradmin.pl?aktion=prog_summary&prefix=$_'>$_</a> "; + } my $vars = { rows => \@show, now => $displayed_time, title => ($search ? gettext("Suitable matches for:") . " " . CGI::escapeHTML($search) . "" -  : $label . " " . strftime("%H:%M", localtime($event_time)) . " " . gettext("o'clock")), +  : $label . " " . strftime("%H:%M", localtime($event_time)) . " " . gettext("o'clock")) . " " . $switcher, switchview_url => $MyURL . "?aktion=prog_summary&view=" . ($view eq "ext" ? "sml" : "ext") . ($next ? "&next=1" : "") . ($search ? "&search=" . uri_escape($search) : "") . ($time ? "&time=$time" : ""), switchview_text => ($view eq "ext" ? gettext("short view") : gettext("long view")), times => \@times, </diff>