VDRadmin-am-3.4.7 simple patch

Message ID 452AB03D.6000203@tut.fi
State New
Headers

Commit Message

Marko Kenttälä Oct. 9, 2006, 8:25 p.m. UTC
  Hullo,

Andreas: great work on vdradmin-am, I use it daily, thanks. Attached is 
a small patch for something I find useful. It shows rec image in EPG 
titles that are already scheduled for recording so you don't 
accidentally timer them twice. I'm sure it could be done better by 
someone who knows what he's doing but it works for me. Feel free to add 
this to your releases if you like.
  

Comments

Andreas Mair Oct. 10, 2006, 7:53 a.m. UTC | #1
Hi Marko,

thanks for the patch!
Showing the recording  status in every EPG view was planned for one of the 
next releases (after the epgsearch integration has been released).
At a first glance your patch looks almost the way I planned to do it, but I 
think it needs some investigation in performance optimisation.

Regards,
Andreas

On Monday 09 October 2006 22:25, Marko Kenttälä wrote:
> Hullo,
>
> Andreas: great work on vdradmin-am, I use it daily, thanks. Attached is
> a small patch for something I find useful. It shows rec image in EPG
> titles that are already scheduled for recording so you don't
> accidentally timer them twice. I'm sure it could be done better by
> someone who knows what he's doing but it works for me. Feel free to add
> this to your releases if you like.
  

Patch

diff -ru /tmp/vdradmin-am-3.4.7/template/default/prog_list2.html ./template/default/prog_list2.html
--- /tmp/vdradmin-am-3.4.7/template/default/prog_list2.html	2006-08-31 14:51:38.000000000 +0300
+++ ./template/default/prog_list2.html	2006-10-09 22:48:42.000000000 +0300
@@ -67,11 +67,12 @@ 
 					<td class="col_duration">
 						<a id="<?% bc.anchor %?>" name="<?% bc.anchor %?>"><?% bc.emit %?> - <?% bc.duration %?></a>
 					</td>
-					<td class="col_title">
+					<td class="col_name">
 						<div class="epg_title">
 							<?% IF bc.infurl %?>
 								<a href="javascript:popup('<?% bc.infurl %?>');" title="<?% gettext('More Information') %?>">
 							<?% END %?>
+							<?% IF bc.recording %?><img src="bilder/rec.gif">&nbsp;<?% END %?>
 							<?% bc.title %?>
 							<?% IF bc.infurl %?>
 								</a>
diff -ru /tmp/vdradmin-am-3.4.7/template/default/prog_list.html ./template/default/prog_list.html
--- /tmp/vdradmin-am-3.4.7/template/default/prog_list.html	2006-08-31 14:48:46.000000000 +0300
+++ ./template/default/prog_list.html	2006-10-09 22:28:19.000000000 +0300
@@ -61,11 +61,12 @@ 
 					<td class="col_duration">
 						<a name="<?% bc.anchor %?>"><?% bc.emit %?> - <?% bc.duration %?></a>
 					</td>
-					<td class="col_title">
+					<td class="col_name">
 						<div class="epg_title">
 						<?% IF bc.infurl %?>
 							<a href="javascript:popup('<?% bc.infurl %?>');" title="<?% gettext('More Information') %?>">
 						<?% END %?>
+						<?% IF bc.recording %?><img ali\gn="middle" src="bilder/rec.gif" border="0" alt="" />&nbsp;<?% END %?>
 						<?% bc.title %?>
 						<?% IF bc.infurl %?>
 							</a>
diff -ru /tmp/vdradmin-am-3.4.7/vdradmind.pl ./vdradmind.pl
--- /tmp/vdradmin-am-3.4.7/vdradmind.pl	2006-09-29 12:02:29.000000000 +0300
+++ ./vdradmind.pl	2006-10-09 21:50:15.000000000 +0300
@@ -2559,6 +2559,7 @@ 
     #
     my (@show, $progname, $cnumber);
     my $day = 0;
+    my @timers = ParseTimer(0);
     for my $event (@{ $EPG{$vdr_id} }) {
         if (my_strftime("%d", $event->{start}) != $day) {
 
@@ -2576,6 +2577,14 @@ 
         } 
         my $imdb_title = $event->{title};
         $imdb_title    =~ s/^.*\~\%*([^\~]*)$/$1/;
+        my $recording=0;
+        # go through timers to see if this event is recorded
+        foreach my $t (@timers) {
+            if ($event->{channel_name} eq $t->{cdesc} && $event->{start} > $t->{start} && $event->{stop} < $t->{stop}) {
+                $recording=1;
+                last;
+            }
+        }
         push(@show,
              {  ssse     => $event->{start},
                 emit     => my_strftime("%H:%M", $event->{start}),
@@ -2587,7 +2596,9 @@ 
                 find_title => uri_escape("/^" . quotemeta($event->{title} . "~" . ($event->{subtitle} ? $event->{subtitle} : "") . "~") . "/i"),
                 imdburl  => "http://akas.imdb.com/Tsearch?title=" . uri_escape($imdb_title),
                 newd     => 0,
-                anchor   => "id" . $event->{event_id}
+                anchor   => "id" . $event->{event_id},
+                # new recording flag
+                recording=> $recording
              }
         );
         $progname = $event->{progname};
@@ -2658,6 +2669,7 @@ 
     my $border;
     $border = timelocal(0, $minute, $hour, substr($day, 6, 2), substr($day, 4, 2) - 1, substr($day, 0, 4)) if($day);
     my $time = getStartTime($param_time ? $param_time : undef, undef, $border);
+    my @timers=ParseTimer(0);
     foreach (@channel) {    # loop through all channels
         $vdr_id = $_->{vdr_id};
 
@@ -2685,7 +2697,14 @@ 
                 $last_day = $event_day_long if ($event_day_long > $last_day);
                 $dayflag = 0;
             }
-
+            my $recording=0;
+            # go through timers to see if this event is recorded
+            foreach my $t (@timers) {
+                if ($event->{channel_name} eq $t->{cdesc} && $event->{start} > $t->{start} && $event->{stop} < $t->{stop}) {
+                    $recording=1;
+                    last;
+                }
+            }
             if ($dayflag == 1 && $time < $event->{stop}) {
                 push(@show,
                      {  channel_name => $event->{channel_name},
@@ -2693,7 +2712,8 @@ 
                         newd      => 1,
                         streamurl => $FEATURES{STREAMDEV} ? $MyStreamBase . $CONFIG{TV_EXT} . "?aktion=live_stream&amp;channel=" . $event->{vdr_id} : undef,
                         switchurl => "$MyURL?aktion=prog_switch&amp;channel=" . $event->{vdr_id},
-                        proglink  => "$MyURL?aktion=prog_list&amp;vdr_id=" . $event->{vdr_id}
+                        proglink  => "$MyURL?aktion=prog_list&amp;vdr_id=" . $event->{vdr_id},
+                        recording => $recording
                      }
                 );
 
@@ -2714,7 +2734,8 @@ 
                         find_title => uri_escape("/^" . quotemeta($event->{title} . "~" . ($event->{subtitle} ? $event->{subtitle} : "") . "~") . "/i"),
                         imdburl  => "http://akas.imdb.com/Tsearch?title=" . uri_escape($imdb_title),
                         newd     => 0,
-                        anchor   => "id" . $event->{event_id}
+                        anchor   => "id" . $event->{event_id},
+                        recording=> $recording
                      }
                 );
                 $progname = $event->{progname};