diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2008-01-03 11:56:27 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2008-01-03 11:56:27 +0000 |
| commit | 51899785cc76d32a71b043b6a19d3c8e904355e2 (patch) | |
| tree | d817e1b7f77bafe84b1418474213eda1140a92bf /lib | |
| parent | 8222d826a768795076a655fcc057a218b7f8e933 (diff) | |
| download | xxv-51899785cc76d32a71b043b6a19d3c8e904355e2.tar.gz xxv-51899785cc76d32a71b043b6a19d3c8e904355e2.tar.bz2 | |
* STREAM: Add embed player of playback (selectable widget)
* GRAB: Check range of parameter width/height
* HTTPD: Some times missing footer
* EPG: display deliver channelid for stream
* Skins: remove skin.cfg / global.playbackmode
* Skins: add skin.cfg / global.preferedlocal as default button for Switch inside VDR or web cast
* Skins: format images to common size
* Skins: Add more images (mute,loud,quiet)
* Skins: Player with selectable widget (vlc/default media)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/XXV/MODULES/CHANNELS.pm | 4 | ||||
| -rw-r--r-- | lib/XXV/MODULES/EPG.pm | 3 | ||||
| -rw-r--r-- | lib/XXV/MODULES/GRAB.pm | 40 | ||||
| -rw-r--r-- | lib/XXV/MODULES/HTTPD.pm | 5 | ||||
| -rw-r--r-- | lib/XXV/MODULES/RECORDS.pm | 15 | ||||
| -rw-r--r-- | lib/XXV/MODULES/STREAM.pm | 130 | ||||
| -rw-r--r-- | lib/XXV/OUTPUT/Html.pm | 3 |
7 files changed, 152 insertions, 48 deletions
diff --git a/lib/XXV/MODULES/CHANNELS.pm b/lib/XXV/MODULES/CHANNELS.pm index f1e4464..d0719e8 100644 --- a/lib/XXV/MODULES/CHANNELS.pm +++ b/lib/XXV/MODULES/CHANNELS.pm @@ -1014,12 +1014,12 @@ sub _brandNewChannels { foreach my $chpos (sort {$erg->{$a} <=> $erg->{$b}} keys %$erg) { my $c = $erg->{$chpos}; $text .= sprintf(gettext('New %s channel: %s on position: %d %s'), - ($c->{VPID} > 5 or index('+', $c->{VPID}) + ($c->{VPID} ? gettext('TV') : gettext('Radio')), $c->{Name}, $c->{POS}, - (index('+', $c->{VPID}) || $c->{VPID} == 1 ? gettext('(encrypted)') : ''), + (($c->{CA} && $c->{CA} > 5) ? gettext('(encrypted)') : ''), ); } diff --git a/lib/XXV/MODULES/EPG.pm b/lib/XXV/MODULES/EPG.pm index 98470a4..a5f0e4d 100644 --- a/lib/XXV/MODULES/EPG.pm +++ b/lib/XXV/MODULES/EPG.pm @@ -778,7 +778,8 @@ SELECT SQL_CACHE (unix_timestamp(e.starttime) + e.duration - unix_timestamp())/duration*100 as \'$f{'Percent'}\', e.video as __Video, e.audio as __Audio, - IF(e.vpstime!=0,$vps,'') as __PDC + IF(e.vpstime!=0,$vps,'') as __PDC, + e.channel_id as __channel_id from $table as e,CHANNELS as c where diff --git a/lib/XXV/MODULES/GRAB.pm b/lib/XXV/MODULES/GRAB.pm index b341a76..c1582a4 100644 --- a/lib/XXV/MODULES/GRAB.pm +++ b/lib/XXV/MODULES/GRAB.pm @@ -28,12 +28,28 @@ sub module { default => 320, type => 'integer', required => gettext('This is required!'), + check => sub{ + my $value = shift || 0; + if($value =~ /^\d+$/sig and $value >= 8 and $value < 4096) { + return int($value); + } else { + return undef, gettext('Value incorrect!'); + } + }, }, ysize => { description => gettext('Image height'), default => 240, type => 'integer', required => gettext('This is required!'), + check => sub{ + my $value = shift || 0; + if($value =~ /^\d+$/sig and $value >= 8 and $value < 4096) { + return int($value); + } else { + return undef, gettext('Value incorrect!'); + } + } }, overlay => { description => gettext('Text to display in the grabbed picture.'), @@ -49,6 +65,14 @@ sub module { description => gettext('Vertical position of displayed text, in pixels.'), default => 10, type => 'integer', + check => sub{ + my $value = shift || 0; + if($value =~ /^\d+$/sig and $value >= 8 and $value < 4096) { + return int($value); + } else { + return undef, gettext('Value incorrect!'); + } + } }, font => { description => gettext('TrueType font to draw overlay text'), @@ -60,11 +84,27 @@ sub module { description => gettext('Font size to draw image text (only for ttf font!).'), default => 10, type => 'integer', + check => sub{ + my $value = shift || 0; + if($value =~ /^\d+$/sig and $value >= 1 and $value < 100) { + return int($value); + } else { + return undef, gettext('Value incorrect!'); + } + } }, imgquality => { description => gettext('Quality from image in percent.'), default => 80, type => 'integer', + check => sub{ + my $value = shift || 0; + if($value =~ /^\d+$/sig and $value >= 1 and $value < 100) { + return int($value); + } else { + return undef, gettext('Value incorrect!'); + } + } }, }, Commands => { diff --git a/lib/XXV/MODULES/HTTPD.pm b/lib/XXV/MODULES/HTTPD.pm index 26fb07c..be18755 100644 --- a/lib/XXV/MODULES/HTTPD.pm +++ b/lib/XXV/MODULES/HTTPD.pm @@ -317,14 +317,12 @@ sub communicator } } else { $obj->handleInput($watcher, $console, $cgi); - $console->footer() - unless($console->{TYP} eq 'AJAX' - or $console->{noFooter}); } } else { $obj->ModulNotLoaded($console,'USER'); } + $console->footer() if($console->{inclFooter}); $console->printout(); # make entry more readable @@ -481,7 +479,6 @@ sub handleInput { if($cmdobj and not $shorterr) { if($cmdobj->{binary}) { - $console->{noFooter} = 1; $console->{nocache} = 1 if($cmdobj->{binary} eq 'nocache'); } diff --git a/lib/XXV/MODULES/RECORDS.pm b/lib/XXV/MODULES/RECORDS.pm index 0b447d3..705984f 100644 --- a/lib/XXV/MODULES/RECORDS.pm +++ b/lib/XXV/MODULES/RECORDS.pm @@ -2118,12 +2118,25 @@ ORDER BY # ------------------ +sub IdToData { +# ------------------ + my $obj = shift || return error('No object defined!'); + my $id = shift || return undef; + + my $sth = $obj->{dbh}->prepare('SELECT SQL_CACHE * from RECORDS as r, OLDEPG as e where e.eventid = r.eventid and RecordMD5 = ?'); + $sth->execute($id) + or return error sprintf("Couldn't execute query: %s.",$sth->errstr); + my $erg = $sth->fetchrow_hashref(); + return $erg; +} + +# ------------------ sub IdToPath { # ------------------ my $obj = shift || return error('No object defined!'); my $id = shift || return undef; - my $sth = $obj->{dbh}->prepare('SELECT SQL_CACHE Path from RECORDS where RecordMD5 = ?'); + my $sth = $obj->{dbh}->prepare('SELECT SQL_CACHE Path from RECORDS where RecordMD5 = ?'); $sth->execute($id) or return error sprintf("Couldn't execute query: %s.",$sth->errstr); my $erg = $sth->fetchrow_hashref(); diff --git a/lib/XXV/MODULES/STREAM.pm b/lib/XXV/MODULES/STREAM.pm index 2267017..7928dfd 100644 --- a/lib/XXV/MODULES/STREAM.pm +++ b/lib/XXV/MODULES/STREAM.pm @@ -32,36 +32,64 @@ sub module { type => 'host', required => gettext('This is required!'), }, - streamtyp => { + method => { description => gettext('Typ of streaming'), - default => 1, + default => 'http', type => 'list', - choices => sub { - my $erg = $obj->_get_streamtyp(); - map { my $x = $_->[1]; $_->[1] = $_->[0]; $_->[0] = $x; } @$erg; - return @$erg; - }, + choices => [ + [ gettext('HTTP Streaming'), 'http' ], + [ gettext('Remote SMB/NFS share'),'smb' ], + ], required => gettext('This is required!'), - check => sub { - my $value = int(shift) || 0; - my $erg = $obj->_get_streamtyp(); - unless($value >= $erg->[0]->[0] and $value <= $erg->[-1]->[0]) { - return undef, - sprintf(gettext('Sorry, but value must be between %d and %d'), - $erg->[0]->[0],$erg->[-1]->[0]); - } - return $value; - }, + }, + mimetyp => { + description => gettext('Used mime type to deliver video streams'), + default => 'video/x-mpegurl', + type => 'string', }, netvideo => { description => gettext('Base directory of remote SMB/NFS share.'), default => '\\\\vdr\\video', type => 'string', }, - mimetyp => { - description => gettext('Used mime type to deliver video streams'), - default => 'video/x-mpegurl', - type => 'string', + widget => { + description => gettext('Used stream widget'), + type => 'list', + default => 'vlc', + choices => [ + [gettext("Other external player"), 'external'], + [gettext('Embed media player'), 'media'], + [gettext('Embed vlc player'), 'vlc'], + ], + required => gettext("This is required!"), + }, + width => { + description => gettext('Stream widget width'), + default => 720, + type => 'integer', + required => gettext('This is required!'), + check => sub{ + my $value = shift || 0; + if($value =~ /^\d+$/sig and $value >= 8 and $value < 4096) { + return int($value); + } else { + return undef, gettext('Value incorrect!'); + } + }, + }, + height => { + description => gettext('Stream widget height'), + default => 576, + type => 'integer', + required => gettext('This is required!'), + check => sub{ + my $value = shift || 0; + if($value =~ /^\d+$/sig and $value >= 8 and $value < 4096) { + return int($value); + } else { + return undef, gettext('Value incorrect!'); + } + }, }, }, Commands => { @@ -131,6 +159,7 @@ sub livestream { my $watcher = shift || return error('No watcher defined!'); my $console = shift || return error('No console defined!'); my $channel = shift || return con_err($console,gettext("No channel defined for streaming!")); + my $params = shift; return $console->err(gettext("Can't stream files!")) unless($console->can('datei')); @@ -141,6 +170,18 @@ sub livestream { return $console->err(sprintf(gettext("This channel '%s' does not exist!"),$channel)) unless($ch); + if($obj->{widget} ne 'external' && (!$params || !(exists $params->{player}))) { + my $data = sprintf("?cmd=livestream&__player=1&data=%s",$ch); + + my $param = { + title => $cmod->ChannelToName($ch), + widget => $obj->{widget}, + width => $obj->{width}, + height => $obj->{height}, + }; + return $console->player($data, $param); + } + my $cpos = $cmod->ChannelToPos($ch); debug sprintf('Live stream with channel "%s"%s', $cmod->ChannelToName($ch), @@ -171,20 +212,39 @@ sub playrecord { my $params = shift; my $rmod = main::getModule('RECORDS'); - my $videopath = $rmod->{videodir}; - my $path = $rmod->IdToPath($recid) + my $result = $rmod->IdToData($recid) or return $console->err(gettext(sprintf("Couldn't find recording: '%s'", $recid))); - my @files = bsd_glob("$path/[0-9][0-9][0-9].vdr"); - - return $console->err(gettext(sprintf("Couldn't find recording: '%s'", $recid))) - unless scalar(@files); - my $start = 0; my $offset = 0; if($params && exists $params->{start}) { $start = &text2frame($params->{start}); } + + if($obj->{widget} ne 'external' && (!$params || !(exists $params->{player}))) { + my $data = sprintf("?cmd=playrecord&__player=1&data=%s",$recid); + $data .= sprintf("&__start=%d", $start) if($start); + + my $param = { + title => $result->{title}, + widget => $obj->{widget}, + width => $obj->{width}, + height => $obj->{height}, + }; + $param->{title} .= '~' . $result->{subtitle} if($result->{subtitle}); + + return $console->player($data, $param); + } + + return $console->err(gettext(sprintf("Couldn't find recording: '%s'", $recid))) + unless $result->{Path}; + + my $path = $result->{Path}; + my @files = bsd_glob("$path/[0-9][0-9][0-9].vdr"); + + return $console->err(gettext(sprintf("Couldn't find recording: '%s'", $recid))) + unless scalar(@files); + if($start) { my ($filenumber,$fileoffset) = $rmod->frametofile($path,$start); splice(@files, 0, $filenumber-1) if($filenumber && ($filenumber - 1) > 0); @@ -196,7 +256,7 @@ sub playrecord { ( $console->{USER} && $console->{USER}->{Name} ? sprintf(' from user: %s', $console->{USER}->{Name}) : "" ) ); - if($obj->{streamtyp} != 1) { + if($obj->{method} eq 'http') { return $console->err(gettext("Can't stream files!")) unless($console->can('stream')); @@ -207,6 +267,8 @@ sub playrecord { return $console->err(gettext("Can't stream files!")) unless($console->can('datei')); + my $videopath = $rmod->{videodir}; + my $data; $data = "#EXTM3U\r\n"; foreach my $file (@files) { @@ -229,14 +291,4 @@ sub playrecord { } } -# ------------------ -sub _get_streamtyp { -# ------------------ - my $obj = shift || return error('No object defined!'); - - return [ - [ 1, gettext('Remote SMB/NFS share') ], - [ 2, gettext('HTTP Streaming') ], - ]; -} 1; diff --git a/lib/XXV/OUTPUT/Html.pm b/lib/XXV/OUTPUT/Html.pm index 2d8d1bc..af98b59 100644 --- a/lib/XXV/OUTPUT/Html.pm +++ b/lib/XXV/OUTPUT/Html.pm @@ -47,7 +47,6 @@ sub AUTOLOAD { my $output = $obj->parseTemplate($name, $data, $params); $obj->out( $output ); - $obj->{call} = ''; } @@ -139,6 +138,8 @@ sub parseTemplate { my $output; unless(defined $obj->{header}) { $output .= $obj->parseTemplateFile("start", $data, $params); + # we must add footer on any template generated output + $obj->{inclFooter} = 1; } $output .= $obj->parseTemplateFile($name, $data, $params,((exists $obj->{call}) ? $obj->{call} : 'nothing')); return $output; |
