updates for RT scheduling

git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3187 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2016-08-19 18:26:23 +00:00
parent daa345cac9
commit a6f35d4fdb
18 changed files with 214 additions and 137 deletions

View File

@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
Version: 1.3.1-5
Version: 1.3.2
Architecture: mipsel
Maintainer: af123@hpkg.tv
Depends: tcpfix,webif-channelicons(>=1.1.24),lighttpd(>=1.4.39-1),jim(>=0.76-2),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.3),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.3),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl
Depends: tcpfix,webif-channelicons(>=1.1.24),lighttpd(>=1.4.39-1),jim(>=0.76-2),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.3),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.5),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl
Suggests:
Description: An evolving web interface for the Humax.
Tags: http://hummy.tv/forum/threads/7116/

View File

@ -44,6 +44,7 @@ This event conflicts with the following items in your scheduled recording list.
}
puts "
<div id=epginfo_extra></div>
<table class=keyval>
<tr>
<th>Programme</th>
@ -170,8 +171,6 @@ puts "
</a>
"
puts "<div id=epginfo_extra class=footnote></div>"
epg cleanup
if {![cgi_exists bare]} footer

View File

@ -21,14 +21,9 @@ if {$event eq ""} {
puts "Error, cannot find event to schedule."
exit
}
if {[$event percent] > 0} {
puts "Error, cannot record programme which has already started showing"
puts "or occurred in the past."
exit
}
set r [rsv construct $event $type]
if {[catch {$r insert pending 1} msg]} {
if {[catch {$r insert pending} msg]} {
puts "Error encountered while scheduling: <i>$msg</i>"
} else {
puts "Successfully scheduled <i>[$event get name]</i>"

View File

@ -604,6 +604,15 @@ img.rollimg
clear: right;
}
#epginfo_extra
{
color: #ff4000 !important;
background: transparent;
font-size: 1.3em;
font-weight: bold;
padding-bottom: 2px;
}
/* Minimal tabs */
#minimaltabbar

View File

@ -2,17 +2,19 @@ $(function() {
function doschedule(type)
{
$('#epginfo_extra').load('/cgi-bin/epg/schedule.jim?' +
'service=' +
encodeURIComponent($('#epgpopup_dialogue').attr('xs')) +
'&event=' +
encodeURIComponent($('#epgpopup_dialogue').attr('xe')) +
'&type=' + type, function() {
$('#epginfo_extra')
.empty()
.html('<img src=/img/loading.gif> Processing request...')
.load('/cgi-bin/epg/schedule.jim', {
'service': $('#epgpopup_dialogue').attr('xs'),
'event': $('#epgpopup_dialogue').attr('xe'),
'type': type
}, function() {
$.getJSON('/cgi-bin/pending.jim', function(data) {
if (data.pending > 0)
$('#restart_block').slideDown('slow');
});
});
});
$(":button:contains('Record')").fadeOut('slow');
$(":button:contains('Reminder')").fadeOut('slow');
}

View File

@ -26,6 +26,11 @@ puts {
<input type=hidden id=paddingsid name=slot value=0>
<table class=keyval>
<tr>
<td colspan=2 class=blood>
Set a value for start or end<br>
padding (or both) to disable AR.
</td>
</tr><tr>
<th>Start Padding</th>
<td><select id=prepadding name=pre
class="ui-widget-content ui-corner-all">

View File

@ -91,6 +91,12 @@ proc eventrow {event {table TBL_RESERVATION}} {
set ended 0
}
if {$d > 0 && $n >= $s && $n < $e} {
set showing 1
} else {
set showing 0
}
set attrs "table=$table sid=[$event get ulslot] \
reckind=[$event get ucRecKind] rsvtype=[$event get ersvtype] \
ar=[expr ! [$event padded]] ended=$ended"
@ -191,12 +197,13 @@ proc eventrow {event {table TBL_RESERVATION}} {
puts "<span class=ds>$ds</span>"
}
if {$d > 0 && $n > $s && $n < $e} {
puts "<br>"
if {$showing} {
set perc [expr [expr $n - $s] * 100 / $d]
puts "<br>"
puts "<img class=va
src=/images/745_1_11_Video_1REC.png>"
puts [progressbar $perc]
set opts 0
}
set c [llength $elist]

View File

@ -19,7 +19,7 @@ foreach slot [split $slots ","] {
$event clear_ulslot
$event set_delete
$event insert pending 0 1
puts [$event insert pending 0 1]
}
rsv commit

View File

@ -0,0 +1,23 @@
if {[cgi_get act] eq "xtelnet"} {
set val [cgi_get val off]
if {$val in {0 off}} {
file delete /mod/boot/xtelnet
puts "Telnet server expert mode will be disabled after next reboot."
} else {
exec /mod/bin/busybox/touch /mod/boot/xtelnet
puts "Telnet server expert mode will be enabled after next reboot."
}
exit
}
set pkgdev [$settings pkgdev]
set rtschedule [$settings rtschedule]
set logsize [$settings logsize]
set logkeep [$settings logkeep]
handle_int_update pkgdev $pkgdev "Development Package Display"
handle_int_update rtschedule $rtschedule "Real-time scheduling"
handle_int_update logsize $logsize "Log rotation size"
handle_int_update logkeep $logkeep "Logs to keep"

View File

@ -0,0 +1,16 @@
set epg_style [$settings epg_style]
set service_style [$settings service_style]
set channel_group [$settings channel_group]
set xepghours [$settings xepghours]
if {$xepghours == 0} { set xepghours 4 }
set epgscroll [$settings epgscroll]
set genrededup [$settings genrededup]
handle_str_update epg_style $epg_style "EPG Type"
handle_str_update service_style $service_style "EPG Channel Type"
handle_int_update channel_group $channel_group "Channel Group"
handle_int_update xepghours $xepghours "Grid EPG Hours"
handle_int_update epgscroll $epgscroll "Fixed EPG Scrolling"
handle_int_update genrededup $genrededup "Genre search dedup"

View File

@ -0,0 +1,24 @@
set hostname [$settings hostname]
set notoolbar [$settings notoolbar]
set nomobile [$settings nomobile]
set nohelplinks [$settings nohelplinks]
set notwitfeed [$settings notwitfeed]
set nounwatchedcount [$settings nounwatchedcount]
set hidevisualota [$settings hidevisualota]
set chanchangenc [$settings chanchangenc]
set autolog [$settings autolog]
set audiomp3 [$settings audiomp3]
handle_str_update hostname $hostname Hostname
handle_int_update notoolbar $notoolbar "Disable toolbar"
handle_int_update nomobile $nomobile "Disable mobile link"
handle_int_update nohelplinks $nohelplinks "Disable help links"
handle_int_update notwitfeed $notwitfeed "Disable twitter feed ticker"
handle_int_update nounwatchedcount $nounwatchedcount "Disable unwatched count"
handle_int_update hidevisualota $hidevisualota "Hide OTA from visual view"
handle_int_update chanchangenc $chanchangenc \
"Disable channel change confirmation"
handle_int_update autolog $autolog "Auto-processing log level"
handle_int_update audiomp3 $audiomp3 "MP3 type"

View File

@ -0,0 +1,8 @@
set tvdb [$settings tvdb]
set tvdb_debug [$settings tvdb_debug]
set dedup_template [$settings dedup_template]
handle_int_update tvdb $tvdb "Enable tvdb"
handle_int_update tvdb_debug $tvdb_debug "Enable tvdb debugging"
handle_str_update dedup_template $dedup_template "Dedup Template" print 0

View File

@ -0,0 +1,41 @@
if {[cgi_get act] eq "https"} {
set val [cgi_get val off]
if {$val in {0 off}} {
exec /mod/webif/lib/bin/mkcert -delete
puts "HTTPS Server will be disabled after next reboot."
} else {
exec /mod/webif/lib/bin/mkcert
puts "HTTPS Server will be enabled after next reboot."
}
exit
}
set acluser [cgi_get acluser "-"]
set aclpass [cgi_get aclpass "-"]
set aclpassc [cgi_get aclpassc "-"]
if {$acluser ne "-" && $aclpass ne "-"} {
if {![string length $acluser]} {
puts "No username provided."
exit
}
if {$aclpass ne $aclpassc} {
puts "Passwords do not match."
exit
}
if {[string length $aclpass] < 4} {
puts "Password is too short (< 4 characters)"
exit
}
puts [$settings addacluser $acluser $aclpass]
exit
}
set aclact [cgi_get aclact "-"]
if {$aclact ne "-" && $acluser ne "-"} {
switch $aclact {
"del" { puts [$settings delacluser $acluser] }
}
exit
}

View File

@ -4,62 +4,11 @@ package require cgi
source /mod/webif/lib/setup
require settings.class plugin system.class spinner.class
cgi_input
httpheader
if {[cgi_get act] eq "https"} {
set val [cgi_get val off]
if {$val in {0 off}} {
exec /mod/webif/lib/bin/mkcert -delete
puts "HTTPS Server will be disabled after next reboot."
} else {
exec /mod/webif/lib/bin/mkcert
puts "HTTPS Server will be enabled after next reboot."
}
exit
}
if {[cgi_get act] eq "xtelnet"} {
set val [cgi_get val off]
if {$val in {0 off}} {
file delete /mod/boot/xtelnet
puts "Telnet server expert mode will be disabled after next reboot."
} else {
exec /mod/bin/busybox/touch /mod/boot/xtelnet
puts "Telnet server expert mode will be enabled after next reboot."
}
exit
}
set settings [settings new]
set hostname [$settings hostname]
set smtp_server [$settings smtp_server]
set channel_group [$settings channel_group]
set epg_style [$settings epg_style]
set epgscroll [$settings epgscroll]
set service_style [$settings service_style]
set notoolbar [$settings notoolbar]
set tvdb [$settings tvdb]
set tvdb_debug [$settings tvdb_debug]
set rtschedule [$settings rtschedule]
set nomobile [$settings nomobile]
set nohelplinks [$settings nohelplinks]
set notwitfeed [$settings notwitfeed]
set nounwatchedcount [$settings nounwatchedcount]
set hidevisualota [$settings hidevisualota]
set chanchangenc [$settings chanchangenc]
set xepghours [$settings xepghours]
if {$xepghours == 0} { set xepghours 4 }
set genrededup [$settings genrededup]
set audiomp3 [$settings audiomp3]
set autolog [$settings autolog]
set pkgdev [$settings pkgdev]
set logsize [$settings logsize]
set logkeep [$settings logkeep]
set dedup_template [$settings dedup_template]
# Handle updates
if {![dict exists $env SCRIPT_NAME]} { set env(SCRIPT_NAME) "" }
proc _handle_update {class var old text {trim 1}} {
@ -91,59 +40,19 @@ proc handle_str_update {var old {text "Value"} {class alnum} {trim 1}} {
_handle_update $class $var $old $text $trim
}
handle_str_update hostname $hostname Hostname
_handle_update ascii smtp_server $smtp_server "SMTP Server"
handle_int_update channel_group $channel_group "Channel Group"
handle_int_update xepghours $xepghours "Grid EPG Hours"
handle_int_update epgscroll $epgscroll "Fixed EPG Scrolling"
handle_str_update epg_style $epg_style "EPG Type"
handle_str_update service_style $service_style "EPG Channel Type"
handle_int_update pkgdev $pkgdev "Development Package Display"
handle_int_update logsize $logsize "Log rotation size"
handle_int_update logkeep $logkeep "Logs to keep"
handle_int_update notoolbar $notoolbar "Disable toolbar"
handle_int_update tvdb $tvdb "Enable tvdb"
handle_int_update tvdb_debug $tvdb_debug "Enable tvdb debugging"
handle_int_update rtschedule $rtschedule "Enable real-time scheduling"
handle_int_update nomobile $nomobile "Disable mobile link"
handle_int_update nohelplinks $nohelplinks "Disable help links"
handle_int_update notwitfeed $notwitfeed "Disable twitter feed ticker"
handle_int_update chanchangenc $chanchangenc \
"Disable channel change confirmation"
handle_int_update nounwatchedcount $nounwatchedcount "Disable unwatched count"
handle_int_update hidevisualota $hidevisualota "Hide OTA from visual view"
handle_int_update genrededup $genrededup "Genre search dedup"
handle_int_update autolog $autolog "Auto-processing log level"
handle_int_update audiomp3 $audiomp3 "MP3 type"
handle_str_update dedup_template $dedup_template "Dedup Template" print 0
######################################################################
# Settings Modules
set acluser [cgi_get acluser "-"]
set aclpass [cgi_get aclpass "-"]
set aclpassc [cgi_get aclpassc "-"]
if {$acluser ne "-" && $aclpass ne "-"} {
if {![string length $acluser]} {
puts "No username provided."
exit
set moddir /mod/webif/html/settings/modules
foreach mod {general tvdb web epg network advanced} {
if {[file exists "$moddir/$mod/.disabled"]} continue
if {[catch {source "$moddir/$mod/init.hook"} msg]} {
puts "ERROR: $msg"
}
if {$aclpass ne $aclpassc} {
puts "Passwords do not match."
exit
}
if {[string length $aclpass] < 4} {
puts "Password is too short (< 4 characters)"
exit
}
puts [$settings addacluser $acluser $aclpass]
exit
}
set aclact [cgi_get aclact "-"]
if {$aclact ne "-" && $acluser ne "-"} {
switch $aclact {
"del" { puts [$settings delacluser $acluser] }
}
exit
}
######################################################################
# Web Page
jqplugin form actual iphone-style-checkboxes touchpunch
jscss settings.js
@ -178,7 +87,6 @@ proc setting_toggle {name attr checked {invert 0} {val 0}} {
######################################################################
# Settings Modules
set moddir /mod/webif/html/settings/modules
foreach mod {general tvdb web epg network advanced} {
if {[file exists "$moddir/$mod/.disabled"]} continue
if {[catch {source "$moddir/$mod/settings.hook"} msg]} {

View File

@ -19,7 +19,7 @@
};
})(jQuery);
$(document).ready(function () {
$(function() {
$(":submit").button();
$('form.auto').each(function(i, el) {
var id = $(this).attr('id');

View File

@ -10,7 +10,7 @@ proc helplink {title icon link} {
<img src=$icon style=\"padding: 1em\" border=0 height=100>
</a>
<br>
<a href=\"$link target=_blank\">
<a href=\"$link\" target=_blank>
<b>$title</b>
</a>
<br>

View File

@ -265,11 +265,37 @@ rsv method set_skip {event} {
set crid "[$event get channel_crid][$event get event_crid]"
set szRecordedProgCrid "1$crid|$szRecordedProgCrid"
set szEventToRecord [string map "1$crid| {}" $szEventToRecord]
set aulEventToRecordInfo ""
set event_hsvc [$event get channel_hsvc]
set event_id [$event get event_id]
set newaul ""
set next_event -1
foreach aul [$self aul] {
lassign $aul _hsvc _start _end _eid
if {$_hsvc == $event_hsvc && $_eid == $event_id} continue
# Track the next event which should be recorded.
if {$next_event == -1} {
set next_event $_eid
set next_hsvc $_hsvc
set next_time $_start
}
append newaul [binary format iiii \
$_hsvc $_start $_end $_eid]
}
set aulEventToRecordInfo $newaul
set nsttime [$event get start]
set nduration [$event get duration]
if {[$event get event_id] eq $usevtid} {
set ucVolume $usevtid
# Handle skipping the next up-coming instance.
if {$event_id eq $usevtid} {
# (mis)use some fields to hold the next event which
# should be recorded.
set ucVolume "$next_hsvc:$next_event:$next_time"
}
}
@ -303,21 +329,30 @@ rsv method cleanvars {} {
rsv method insert {{table pending} {force 0} {defer 0}} {
global rsvdb
# In-progress check
set now [clock seconds]
if {$nsttime <= $now && [expr $nsttime + $nduration] >= $now} {
throw 20 "Event already in progress."
return
# In-progress check
if {$nsttime <= $now} {
if {$nsttime + $nduration >= $now} {
# Still showing - OK if real-time scheduling addition.
if {$action != 0 || ![rsv rtsched]} {
throw 20 "Event already in progress."
return
}
} elseif {$action == 0} {
throw 20 "Event has finished."
return
}
}
# Duplicate check - all tables
if {!$force && $szCRID ne "" && $action == 0} {
if {!$force && $action == 0} {
foreach tab {pending TBL_RESERVATION} {
set rec [$rsvdb query "
select ulslot from $tab
where szCRID = '%s'
where usevtid = '%s'
and hsvc = '%s'
" $szCRID $hsvc]
" $usevtid $hsvc]
if {[llength $rec] > 0} {
throw 20 "Duplicate reservation."
return
@ -539,9 +574,14 @@ proc {rsv cleanup} {} {
catch {$::rsvdb close}
}
proc {rsv rtsched} {} {
if {![system pkginst nugget]} { return 0 }
if {![[settings] rtschedule]} { return 0 }
return 1
}
proc {rsv commit} {} {
if {![system pkginst nugget]} return
if {![[settings] rtschedule]} return
if {![rsv rtsched]} return
if {[catch {
exec /mod/boot/rsvsync -realtime >> /tmp/rsvsync.log} msg]} {
puts "Scheduling: $msg"