summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2008-11-09 17:16:40 +0000
committerAndreas Brachold <vdr07@deltab.de>2008-11-09 17:16:40 +0000
commitda0a0b776fbe8fb9c4c1746f452148f0da0f4c8a (patch)
treea6bee1ee8f5702e9deb7d4658af5c683314e2662 /lib
parentdd4bfdc1adf6cf36330687d7268ab44900fc77cb (diff)
downloadxxv-da0a0b776fbe8fb9c4c1746f452148f0da0f4c8a.tar.gz
xxv-da0a0b776fbe8fb9c4c1746f452148f0da0f4c8a.tar.bz2
* EPG: replace direct access to epg images by cmd=eimage&data<imageid>
Diffstat (limited to 'lib')
-rw-r--r--lib/XXV/MODULES/EPG.pm34
-rw-r--r--lib/XXV/MODULES/HTTPD.pm10
2 files changed, 31 insertions, 13 deletions
diff --git a/lib/XXV/MODULES/EPG.pm b/lib/XXV/MODULES/EPG.pm
index 3fcd683..f1d49a4 100644
--- a/lib/XXV/MODULES/EPG.pm
+++ b/lib/XXV/MODULES/EPG.pm
@@ -2,6 +2,7 @@ package XXV::MODULES::EPG;
use strict;
use Tools;
+use File::Basename;
# This module method must exist for XXV
# ------------------
@@ -110,6 +111,12 @@ sub module {
hidden => 'yes',
callback => sub{ $self->suggest(@_) },
},
+ eimage => {
+ hidden => 'yes',
+ short => 'ei',
+ callback => sub{ $self->image(@_) },
+ binary => 'cache'
+ }
},
};
return $args;
@@ -424,7 +431,7 @@ sub compareEpgData {
# Exists in DB .. update
if(exists $db_data->{$eid}) {
# Compare fields
- foreach my $field (qw/title subtitle ldescription duration starttime vpstime video audio/) {
+ foreach my $field (qw/title subtitle ldescription duration starttime vpstime video audio image/) {
next if(not exists $row->{$field} or not $row->{$field});
if((not exists $db_data->{$eid}->{$field})
or (not $db_data->{$eid}->{$field})
@@ -552,11 +559,11 @@ sub readEpgData {
# Ok, Datarow complete...
if($line eq 'e' and $event->{eventid} and $event->{channel}) {
if(-e sprintf('%s/%d.png', $self->{epgimages}, $event->{eventid})) {
- my $firstimage = sprintf('%d.png',$event->{eventid});
+ my $firstimage = sprintf('%d',$event->{eventid});
$event->{image} = $firstimage."\n";
my $imgpath = sprintf('%s/%d_?.png',$self->{epgimages},$event->{eventid});
foreach my $img (glob($imgpath)) {
- $event->{image} .= sprintf("%s.png\n", basename($img, '.png'));
+ $event->{image} .= basename($img, '.png')."\n";;
}
}
@@ -987,7 +994,6 @@ where
} @$erg;
}
unshift(@$erg, $fields);
-
$console->table($erg);
}
@@ -1671,4 +1677,24 @@ LIMIT 25
}
}
+# ------------------
+sub image {
+# ------------------
+ my $self = shift || return error('No object defined!');
+ my $console = shift || return error('No console defined!');
+ my $data = shift;
+
+ return $console->err(gettext("Sorry, get image is'nt supported"))
+ if ($console->{TYP} ne 'HTML');
+
+ return $console->status404('NULL','Wrong image parameter')
+ unless($data);
+
+ my ($eventid) = $data =~ /^([0-9_]+)$/si;
+
+ return $console->status404('NULL','Wrong image parameter')
+ unless($eventid);
+ return $console->datei(sprintf('%s/%s.png',$self->{epgimages},$eventid));
+}
+
1;
diff --git a/lib/XXV/MODULES/HTTPD.pm b/lib/XXV/MODULES/HTTPD.pm
index ef6bc54..8887290 100644
--- a/lib/XXV/MODULES/HTTPD.pm
+++ b/lib/XXV/MODULES/HTTPD.pm
@@ -298,15 +298,7 @@ sub communicator {
$request =~ s/\.\.\///g;
$request =~ s/\/\.\.//g;
$request =~ s/\/+/\//g;
- if($request =~ /epgimages\//) {
- my $epgMod = main::getModule('EPG');
- if($epgMod) {
- $request =~ s/.*epgimages\//$epgMod->{epgimages}\//;
- $console->datei($request, $typ);
- } else {
- $self->ModulNotLoaded($console,'EPG');
- }
- } elsif($request =~ /tempimages\//) {
+ if($request =~ /tempimages\//) {
my $tmp = $userMod->userTmp;
$request =~ s/.*tempimages\//$tmp\//;
$console->datei($request, $typ);