diff options
| author | anbr <vdr07@deltab.de> | 2015-09-06 17:32:44 +0200 |
|---|---|---|
| committer | anbr <vdr07@deltab.de> | 2015-09-06 17:32:44 +0200 |
| commit | d036005d73407887872b9321ae51fe8f7ee6f9a5 (patch) | |
| tree | 6993c71f63e55089318edba271e3f9299c441f54 /lib | |
| parent | 27436744df70f9ecd42a9ecdbef448cc65271706 (diff) | |
| download | xxv-d036005d73407887872b9321ae51fe8f7ee6f9a5.tar.gz xxv-d036005d73407887872b9321ae51fe8f7ee6f9a5.tar.bz2 | |
EPG: Show event duration on search results
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Tools.pm | 13 | ||||
| -rw-r--r-- | lib/XXV/MODULES/CHRONICLE.pm | 10 | ||||
| -rw-r--r-- | lib/XXV/MODULES/EPG.pm | 28 |
3 files changed, 35 insertions, 16 deletions
diff --git a/lib/Tools.pm b/lib/Tools.pm index 5a1bcc0..14e5155 100644 --- a/lib/Tools.pm +++ b/lib/Tools.pm @@ -37,7 +37,7 @@ use constant FRAMESPERSECOND => 25; &deleteDir &getip &convert &int &entities &reentities &bench &fmttime &getDataByTable &getDataById &getDataBySearch &getDataByFields &touch &url &con_err &con_msg &text2frame &frame2hms &gettext &setcharset &resolv_symlink - &connectDB &findttf + &connectDB &findttf &fmtSec2Time ); @@ -52,6 +52,17 @@ sub fmttime { return $ret; } +# ------------------ +sub fmtSec2Time { +# ------------------ + my $time = shift || 0; + + my $min = ($time / 60) % 60; + my $hour = CORE::int($time/3600); + + return sprintf('%d:%02d', $hour, $min); +} + use constant MONTHS => qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/; use constant WEEKDAYS => qw/Sun Mon Tue Wed Thu Fri Sat/; # ------------------ diff --git a/lib/XXV/MODULES/CHRONICLE.pm b/lib/XXV/MODULES/CHRONICLE.pm index ac6d499..18db980 100644 --- a/lib/XXV/MODULES/CHRONICLE.pm +++ b/lib/XXV/MODULES/CHRONICLE.pm @@ -188,7 +188,8 @@ SELECT SQL_CACHE UNIX_TIMESTAMP(starttime) as \'$f{'day'}\', DATE_FORMAT(starttime, '%H:%i') as \'$f{'start'}\', DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(starttime) + duration), '%H:%i') as \'$f{'stop'}\' - ,description as _description + ,duration as __duration + ,description as __description FROM CHRONICLE ORDER BY starttime |; @@ -227,7 +228,7 @@ ORDER BY starttime unless($console->typ eq 'AJAX') { map { - $_->[3] = datum($_->[3],'weekday'); + $_->[3] = datum($_->[3],'weekday'); } @$erg; unshift(@$erg, $fields); } @@ -270,7 +271,8 @@ SELECT SQL_CACHE UNIX_TIMESTAMP(starttime) as \'$f{'day'}\', DATE_FORMAT(starttime, '%H:%i') as \'$f{'start'}\', DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(starttime) + duration), '%H:%i') as \'$f{'stop'}\' - ,description as _description + ,duration as __duration + ,description as __description FROM CHRONICLE |; $sql .= sprintf("WHERE %s ORDER BY starttime",$query->{query}); @@ -311,7 +313,7 @@ FROM CHRONICLE unless($console->typ eq 'AJAX') { map { - $_->[3] = datum($_->[3],'weekday'); + $_->[3] = datum($_->[3],'weekday'); } @$erg; unshift(@$erg, $fields); } diff --git a/lib/XXV/MODULES/EPG.pm b/lib/XXV/MODULES/EPG.pm index fba4569..b3be04c 100644 --- a/lib/XXV/MODULES/EPG.pm +++ b/lib/XXV/MODULES/EPG.pm @@ -716,6 +716,7 @@ sub search { 'channel' => gettext('Channel'), 'start' => gettext('Start'), 'stop' => gettext('Stop'), + 'duration' => gettext('Duration'), 'day' => gettext('Day') ); @@ -728,6 +729,7 @@ sub search { c.hash as __position, DATE_FORMAT(e.starttime, '%H:%i') as \'$f{'start'}\', DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(e.starttime) + e.duration), '%H:%i') as \'$f{'stop'}\', + e.duration as \'$f{'duration'}\', UNIX_TIMESTAMP(e.starttime) as \'$f{'day'}\', IF(CHAR_LENGTH(e.description)>77,RPAD(LEFT(e.description,77),80,'.'),e.description) as __Description, IF(e.vpstime!=0,DATE_FORMAT(e.vpstime, '%H:%i'),'') as __PDC, @@ -798,7 +800,8 @@ sub search { unless($console->typ eq 'AJAX') { map { - $_->[7] = datum($_->[7],'weekday'); + $_->[7] = fmtSec2Time($_->[7]); + $_->[8] = datum($_->[8],'weekday'); } @$erg; unshift(@$erg, $fields); @@ -844,8 +847,7 @@ sub program { 'id' => gettext('Service'), 'title' => gettext('Title'), 'start' => gettext('Start'), - 'stop' => gettext('Stop'), - 'day' => gettext('Day') + 'stop' => gettext('Stop') ); my $sql = qq| @@ -855,7 +857,8 @@ SELECT SQL_CACHE e.subtitle as __Subtitle, DATE_FORMAT(e.starttime, '%H:%i') as \'$f{'start'}\', DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(e.starttime) + e.duration), '%H:%i') as \'$f{'stop'}\', - UNIX_TIMESTAMP(e.starttime) as \'$f{'day'}\', + e.duration as __duration, + UNIX_TIMESTAMP(e.starttime) as __day, IF(CHAR_LENGTH(e.description)>77,RPAD(LEFT(e.description,77),80,'.'),e.description) as __Description, IF(e.vpstime!=0,DATE_FORMAT(e.vpstime, '%H:%i'),'') as __PDC, ( SELECT @@ -925,7 +928,8 @@ order by unless($console->typ eq 'AJAX') { map { - $_->[5] = datum($_->[5],'weekday'); + $_->[5] = fmtSec2Time($_->[5]); + $_->[6] = datum($_->[6],'weekday'); } @$erg; unshift(@$erg, $fields); @@ -1138,6 +1142,7 @@ SELECT SQL_CACHE g.name as __Channelgroup, DATE_FORMAT(e.starttime, "%H:%i") as \'$f{'Start'}\', DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(starttime) + e.duration), "%H:%i") as \'$f{'Stop'}\', + e.duration as __duration, IF(CHAR_LENGTH(e.description)>77,RPAD(LEFT(e.description,77),80,'.'),e.description) as __Description, 999 as __Percent, ( SELECT @@ -1238,9 +1243,9 @@ ORDER BY g.pos, c.pos, c.vid my $fields = $sth->{'NAME'}; my $erg = $sth->fetchall_arrayref(); unless($console->typ eq 'AJAX') { -# map { -# $_->[5] = datum($_->[5],'short'); -# } @$erg; + map { + $_->[8] = fmtSec2Time($_->[8]); + } @$erg; unshift(@$erg, $fields); } @@ -1294,6 +1299,7 @@ SELECT SQL_CACHE g.name as __Channelgroup, DATE_FORMAT(e.starttime, "%H:%i") as \'$f{'Start'}\', DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(starttime) + e.duration), "%H:%i") as \'$f{'Stop'}\', + e.duration as __duration, IF(CHAR_LENGTH(e.description)>77,RPAD(LEFT(e.description,77),80,'.'),e.description) as __Description, (unix_timestamp(e.starttime) + e.duration - unix_timestamp())/e.duration*100 as \'$f{'Percent'}\', ( SELECT @@ -1398,9 +1404,9 @@ ORDER BY g.pos, c.pos, c.vid my $fields = $sth->{'NAME'}; my $erg = $sth->fetchall_arrayref(); unless($console->typ eq 'AJAX') { -# map { -# $_->[5] = datum($_->[5],'short'); -# } @$erg; + map { + $_->[8] = fmtSec2Time($_->[8]); + } @$erg; unshift(@$erg, $fields); } |
