diff options
| author | Andreas Brachold <vdr07@deltab.de> | 2008-10-06 09:00:44 +0000 |
|---|---|---|
| committer | Andreas Brachold <vdr07@deltab.de> | 2008-10-06 09:00:44 +0000 |
| commit | 0d66c4b5d972e6e439bec0a3028c8de70e137db8 (patch) | |
| tree | a2ce6741ac448a310e1021675a481d7f55de796e | |
| parent | 2b6688ca3d2e21c7339e39a98109b3e2cebc75ee (diff) | |
| download | xxv-0d66c4b5d972e6e439bec0a3028c8de70e137db8.tar.gz xxv-0d66c4b5d972e6e439bec0a3028c8de70e137db8.tar.bz2 | |
* TIMER/tlist: display used recorder
* CONFIG: Remove double reconfigure
* CONFIG: Remove unusable command write configuation
* Base: remove command restart
| -rwxr-xr-x | bin/xxvd | 48 | ||||
| -rw-r--r-- | html/help.tmpl | 3 | ||||
| -rw-r--r-- | html/tlist.tmpl | 6 | ||||
| -rw-r--r-- | lib/XXV/MODULES/CONFIG.pm | 53 | ||||
| -rw-r--r-- | lib/XXV/MODULES/EVENTS.pm | 3 | ||||
| -rw-r--r-- | lib/XXV/MODULES/TIMERS.pm | 15 | ||||
| -rw-r--r-- | lib/XXV/OUTPUT/NEWS/MAIL.pm | 4 |
7 files changed, 39 insertions, 93 deletions
@@ -5,7 +5,6 @@ use strict; use FindBin qw($RealBin); my $TEMPLMOD; -my $START = time; # Test on Template Modul in normale Path BEGIN { @@ -181,8 +180,6 @@ $MODULES->{'XXV::MODULES::General'}->{MOD} = &module; &docu; -my $starttime = time - $START; - while(Event::loop(1)) {}; # THE MAIN PROGRAM --------------------------------- END @@ -392,14 +389,6 @@ sub getGeneralConfig { return $Config->{General}; } - -# ------------------ -sub getStartTime { -# ------------------ - return $START; -} - - # ------------------ sub getVersion { # ------------------ @@ -513,27 +502,6 @@ sub more { } # ------------------ -sub restart { -# ------------------ - my $watcher = shift; - my $console = shift; - - if(-x $Config->{General}->{initscript}) { - my $msg = sprintf(gettext("The xxv system will restart now. Please try to re-login in %d seconds."), $starttime); - $console->message($msg); - debug $msg; - $console->redirect({url => '/', wait => $starttime, parent => 'top'}) - if($console->typ eq 'HTML'); - my $initscript = $Config->{General}->{initscript}; - my $run = sprintf('echo "%s restart" | at now', $initscript); - - my $erg = `$run`; - } else { - $console->err(gettext("Couldn't restart the xxv system! Script for initialization couldn't be executed.")); - } -} - -# ------------------ sub getDBVersion { # ------------------ return $DBVERSION if($DBVERSION); @@ -734,12 +702,6 @@ sub module { } }, }, - initscript => { - description => gettext('Initialization script to restart xxv'), - default => '/etc/init.d/xxvd', - type => 'file', - required => gettext("This is required!"), - }, }, Commands => { doc => { @@ -756,16 +718,6 @@ sub module { }, }, }; - # Only as superuser - if(0 == $<) - { - $args->{'Commands'}->{'restart'} = { - description => gettext('Call initialization script to restart the xxv system.'), - short => 'restart', - callback => sub{ restart(@_) }, - Level => 'admin', - }; - } return $args; } diff --git a/html/help.tmpl b/html/help.tmpl index b03f955..d7a8c72 100644 --- a/html/help.tmpl +++ b/html/help.tmpl @@ -107,14 +107,13 @@ logger.add(new WebFXTreeItem("<?% gettext("Standard") %?>", "?cmd=logger&data=m logger.add(new WebFXTreeItem("<?% gettext("Syslog") %?>", "?cmd=logger&data=syslog")); <?% END %?> -<?% IF allow('ul') || allow('uprefs') || allow('vl') || allow('cl') || allow('rel') || allow('restart') %?> +<?% IF allow('ul') || allow('uprefs') || allow('vl') || allow('cl') || allow('rel') %?> var admin = new WebFXTreeItem("<?% gettext("Administration") %?>",0,tree); <?% IF allow('vl') %?>admin.add(new WebFXTreeItem("<?% gettext("Video disk recorder",12) %?>", "?cmd=vl"));<?% END %?> <?% IF allow('cl') %?>admin.add(new WebFXTreeItem("<?% gettext("Channels",12) %?>", "?cmd=cl"));<?% END %?> <?% IF allow('ul') %?>admin.add(new WebFXTreeItem("<?% gettext("User") %?>","?cmd=ul")); <?% ELSIF allow('uprefs') %?>admin.add(new WebFXTreeItem("<?% gettext("Personality") %?>","?cmd=uprefs"));<?% END %?> <?% IF allow('rel') %?>admin.add(new WebFXTreeItem("<?% gettext("Reload") %?>","?cmd=rel"));<?% END %?> -<?% IF allow('restart') %?>admin.add(new WebFXTreeItem("<?% gettext("Restart") %?>","?cmd=restart"));<?% END %?> <?% END %?> <?% IF allow('configedit') %?> diff --git a/html/tlist.tmpl b/html/tlist.tmpl index 0b0ef33..9485bf1 100644 --- a/html/tlist.tmpl +++ b/html/tlist.tmpl @@ -47,6 +47,9 @@ <?% NEXT IF field.match('^__') or c == 4 %?> <th><?% field %?></th> <?% END %?> +<?% IF param.recorder > 1 %?> + <th><?% gettext("Video disk recorder") %?></th> +<?% END %?> <?% IF enableform %?> <th width="64"><?% gettext("Selection",7) %?></th> <?% END %?> @@ -127,6 +130,9 @@ <td><?% field %?></td> <?% END %?> <?% END %?> +<?% IF param.recorder > 1 %?> + <td><div class="<?% myclass %?>"><?% zeile.15 %?></div></td> +<?% END %?> <?% IF enableform %?> <td> <input type="checkbox" value="<?% zeile.0 %?>" name="<?% zeile.7 | replace('~',' ') %?>" /> diff --git a/lib/XXV/MODULES/CONFIG.pm b/lib/XXV/MODULES/CONFIG.pm index ff9de48..b1277b6 100644 --- a/lib/XXV/MODULES/CONFIG.pm +++ b/lib/XXV/MODULES/CONFIG.pm @@ -26,24 +26,12 @@ sub module { callback => sub{ $obj->edit(@_) }, Level => 'admin', }, - configwrite => { - description => gettext('Saves the configuration.'), - short => 'cw', - callback => sub{ $obj->write(@_) }, - Level => 'admin', - }, configget => { description => gettext("Get configuration from 'modname'"), short => 'cg', callback => sub{ $obj->get(@_) }, Level => 'admin', }, - reconfigure => { - description => gettext('Edit all processes'), - short => 'cr', - callback => sub{ $obj->reconfigure(@_) }, - Level => 'admin', - }, help => { description => gettext("This will display all commands or description of module 'name'."), short => 'h', @@ -133,14 +121,6 @@ sub menu { link => "?cmd=configedit&data=$name", }; } - $ret->{links}->{'reconfigure'} = { - text => gettext("Save configuration"), - link => "?cmd=reconfigure", - }; - $ret->{links}->{'write'} = { - text => gettext("Saves the configuration."), - link => "?cmd=configwrite", - }; return $console->littlemenu($ret); } @@ -194,12 +174,12 @@ sub edit { if(ref $cfg eq 'HASH') { $obj->{config}->{$sector} = $cfg; - $obj->reconfigure(); - $obj->write(); - con_msg($console, sprintf(gettext("Section: '%s' saving ... please wait."), $sector)); - $console->redirect({url => sprintf('?cmd=configedit&data=%s',$sector), wait => 1}) - if($console->typ eq 'HTML'); + my $success = $obj->write($watcher, $console); + + $console->redirect({url => '?cmd=configedit', wait => 1}) + if($success eq 'ok' + && $console->typ eq 'HTML'); } } @@ -210,15 +190,16 @@ sub write { my $watcher = shift; my $console = shift; - $obj->reconfigure($watcher, $console); + my $success = $obj->reconfigure($watcher, $console); my $configfile = main::getUsrConfigFile; - $obj->{config}->write( $configfile ) - or return con_err($console, sprintf ("Couldn't write '%s': %s", $configfile , $! )); + if($success eq 'ok' + && !$obj->{config}->write( $configfile )) { + con_err($console, sprintf ("Couldn't write '%s': %s", $configfile , $! )); + return 'failed'; + } con_msg($console, sprintf(gettext("Configuration written to '%s'."), $configfile)); - - $console->redirect({url => '?cmd=configedit', wait => 2}) - if(ref $console and $console->typ eq 'HTML'); + return $success; } # ------------------ @@ -253,6 +234,8 @@ sub reconfigure { my $watcher = shift; my $console = shift; + my $success = 'ok'; + my $cfg = $obj->{config}; foreach my $moduleName (keys %$cfg) { if($moduleName eq 'General') { @@ -273,20 +256,22 @@ sub reconfigure { unless($ok || not $err) { my $message = sprintf("Config -> %s -> %s: %s %s", $moduleName, $parameter, $mod->{$parameter}, $err); con_err($console, $message); + $success = 'failed'; } } } } else { con_err($console, sprintf(gettext("Couldn't find %s in %s!"), $parameter, $moduleName)); + $success = 'failed'; } } } } - $obj->menu( $watcher, $console ) - if(ref $console and $console->{TYP} eq 'HTML'); - con_msg($console, gettext('Edit successful!')); + con_msg($console, gettext('Edit successful!')) + if($success eq 'ok'); + return $success; } # ------------------ diff --git a/lib/XXV/MODULES/EVENTS.pm b/lib/XXV/MODULES/EVENTS.pm index b848d5b..77ffbc4 100644 --- a/lib/XXV/MODULES/EVENTS.pm +++ b/lib/XXV/MODULES/EVENTS.pm @@ -172,10 +172,9 @@ sub _init { $self->callEvent(@_); }; - my $start = main::getStartTime; $self->news( sprintf(gettext('XXVD System %s started'), main::getVersion), - sprintf(gettext('Start time: %s'), datum($start)), + sprintf(gettext('Start time: %s'), datum()), undef, undef, 'harmless' diff --git a/lib/XXV/MODULES/TIMERS.pm b/lib/XXV/MODULES/TIMERS.pm index 9a0cfec..f99a741 100644 --- a/lib/XXV/MODULES/TIMERS.pm +++ b/lib/XXV/MODULES/TIMERS.pm @@ -1026,7 +1026,7 @@ sub _insert { q|REPLACE INTO TIMERS VALUES (?,?,?,?,?,?,?,?,?,?,?,?,FROM_UNIXTIME(?), FROM_UNIXTIME(?),0,?,?,?,?,0,NOW()) |); - my $id = md5_hex($timer->{vid} . $timer->{channel} . $nexttime->{start} . $nexttime->{stop} ); + my $id = md5_hex($timer->{vid} . $timer->{channel} . $nexttime->{start} . $nexttime->{stop} . $timer->{file} ); $sth->execute( $id, $timer->{vid}, @@ -1213,7 +1213,6 @@ sub _list { my $search = shift || ''; my $term = shift; my $params = shift; - my $table = shift || ''; my %f = ( 'id' => gettext('Service'), @@ -1245,15 +1244,17 @@ SELECT SQL_CACHE FROM EPG as e WHERE t.eventid = e.eventid LIMIT 1) as __description, - NOW() between starttime and stoptime AND (flags & 1) as __running + NOW() between starttime and stoptime AND (flags & 1) as __running, + r.host as __host FROM TIMERS as t, - CHANNELS as c - $table + CHANNELS as c, + RECORDER as r WHERE t.stoptime > NOW() AND t.channel = c.id AND t.vid = c.vid + AND t.vid = r.id $search ORDER BY t.starttime @@ -1307,9 +1308,13 @@ ORDER BY unshift(@$erg, $fields); } + # More then one host defined + my $hostlist = $self->{svdrp}->list_hosts(); + $console->setCall('tlist'); $console->table($erg, { capacity => main::getModule('RECORDS')->{CapacityFree}, + recorder => scalar @$hostlist, keywords => $keywords, keywordsmax => $keywordmax, keywordsmin => $keywordmin, diff --git a/lib/XXV/OUTPUT/NEWS/MAIL.pm b/lib/XXV/OUTPUT/NEWS/MAIL.pm index 60ae109..7b5be0b 100644 --- a/lib/XXV/OUTPUT/NEWS/MAIL.pm +++ b/lib/XXV/OUTPUT/NEWS/MAIL.pm @@ -198,7 +198,7 @@ sub init { my $self = shift || return error('No object defined!'); $self->{INITE} = 1; - $self->{LastReportTime} = main::getStartTime(); + $self->{LastReportTime} = time; # Interval to send the next mail $self->{TIMER} = Event->timer( @@ -262,7 +262,7 @@ sub parseHeader { my $vars = { msgnr => $self->{COUNT}, - date => datum(time), + date => datum(), anzahl=> $newscnt, }; |
