updates
git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3440 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
097ed2d74c
commit
88c7f8cef9
@ -1,7 +1,7 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 1.3.4-4
|
||||
Version: 1.3.4-5
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hpkg.tv
|
||||
Depends: tcpfix,webif-channelicons(>=1.1.24),lighttpd(>=1.4.39-1),jim(>=0.77),jim-oo(>=0.77),jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.3),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.9),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,nugget(>=0.95),sqlite3(>=3.15.1)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
require queue.class
|
||||
require queue.class json
|
||||
|
||||
httpheader "application/json"
|
||||
|
||||
@ -23,7 +23,7 @@ foreach q [queue all] {
|
||||
puts " \"file\": \"$name\","
|
||||
puts " \"action\": \"[$q get action]\","
|
||||
puts " \"status\": \"[$q get status]\","
|
||||
puts " \"log\": \"[$q get log]\","
|
||||
puts " \"log\": \"[::json::escape [$q get log]]\","
|
||||
if {[$q get elapsed] > 0} {
|
||||
set time [clock format [$q get elapsed] -format "%T"]
|
||||
puts " \"elapsed\": \"$time\","
|
||||
|
@ -31,7 +31,8 @@ puts {
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<button id=qdelete>Delete Selected</button>
|
||||
<button id=qdelete class=needssel>Delete Selected</button>
|
||||
<button id=qresubmit class=needssel>Retry Selected</button>
|
||||
<button id=selcomplete>Select Completed</button>
|
||||
<button id=selall>Select All</button>
|
||||
<button id=selnone>Select None</button>
|
||||
|
14
webif/html/diag/queue/resubmit.jim
Executable file
14
webif/html/diag/queue/resubmit.jim
Executable file
@ -0,0 +1,14 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/webif/lib/setup
|
||||
require queue.class
|
||||
|
||||
httpheader
|
||||
|
||||
set slots [cgi_get slot 0]
|
||||
|
||||
foreach slot [split $slots ","] {
|
||||
queue resubmit $slot
|
||||
}
|
||||
|
@ -10,13 +10,12 @@ function page_refresh(msg)
|
||||
|
||||
function load()
|
||||
{
|
||||
$('#isloading').show('fast');
|
||||
$.getJSON('fetch.jim', function(data) {
|
||||
$('#queuetab > tbody').empty();
|
||||
|
||||
$.each(data, function(k, v) {
|
||||
|
||||
$('#isloading').show('fast');
|
||||
|
||||
s = '<tr>' +
|
||||
'<td><input type=checkbox class=qid status=' + v.status +
|
||||
' value=' + v.qid + '>' +
|
||||
@ -67,9 +66,9 @@ load();
|
||||
$('#queuetab').on('change', 'input.qid', function() {
|
||||
var num = $('input.qid:checked').size();
|
||||
if (num)
|
||||
$('#qdelete').enable();
|
||||
$('.needssel').enable();
|
||||
else
|
||||
$('#qdelete').disable();
|
||||
$('.needssel').disable();
|
||||
}).first().trigger('change');
|
||||
|
||||
$('#qdelete').button({icons:{primary:"ui-icon-trash"}})
|
||||
@ -95,6 +94,29 @@ $('#qdelete').button({icons:{primary:"ui-icon-trash"}})
|
||||
|
||||
});
|
||||
|
||||
$('#qresubmit').button({icons:{primary:"ui-icon-refresh"}})
|
||||
.on('click', function() {
|
||||
$(this).dojConfirmAction({
|
||||
question: 'Re-submit selected?',
|
||||
yesAnswer: 'Yes',
|
||||
cancelAnswer: 'No'
|
||||
}, function(el) {
|
||||
$.blockUI({
|
||||
message: '<h1><img src=/img/loading.gif> Re-submitting... </h1>'
|
||||
});
|
||||
|
||||
var slots = $('input.qid:checked').map(function() {
|
||||
return this.value;
|
||||
}).get();
|
||||
$.get('resubmit.jim', {
|
||||
slot: slots.join(',')
|
||||
}, function() {
|
||||
page_refresh();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#selnone').button({icons:{primary:"ui-icon-close"}})
|
||||
.on('click', function() {
|
||||
$('#queuetab input:checkbox').prop('checked', false);
|
||||
|
@ -4,6 +4,8 @@ set noautorec [$settings noautorec]
|
||||
set noautorecimm [$settings noautorecimm]
|
||||
set autorecperiod [$settings autorecperiod]
|
||||
if {$autorecperiod == 0} { set autorecperiod 10 }
|
||||
set autokeep [$settings autokeep]
|
||||
if {$autokeep == 0} { set autokeep 7 }
|
||||
set noautohours [$settings noautohours]
|
||||
|
||||
handle_int_update autolog $autolog "Auto-processing log level"
|
||||
@ -11,5 +13,7 @@ handle_int_update noautorec $noautorec "Auto-processing during recording"
|
||||
handle_int_update noautorecimm $noautorecimm "Auto-processing before recording"
|
||||
handle_int_update autorecperiod $autorecperiod \
|
||||
"Auto-processing recording wait period" 1 1 $(60 * 24)
|
||||
handle_int_update autokeep $autokeep \
|
||||
"Auto-processing queue period" 1 1 365
|
||||
handle_str_update noautohours $noautohours "Auto processing hours" ascii
|
||||
|
||||
|
@ -46,6 +46,10 @@ setting_toggle "Suspend automatic processing if will record soon?" \
|
||||
setting_number autorecperiod "...how many minutes is soon?" $autorecperiod \
|
||||
1 $(60 * 24)
|
||||
|
||||
setting_number autokeep \
|
||||
"How many days should completed entries stay in the queue?" $autokeep \
|
||||
1 365
|
||||
|
||||
puts -nonewline "
|
||||
<tr>
|
||||
<form class=auto id=noautohours method=get action=$env(SCRIPT_NAME)>
|
||||
@ -53,7 +57,7 @@ puts -nonewline "
|
||||
automatic processing runs:
|
||||
</th>
|
||||
<td>
|
||||
<input name=\"noautohours\[]\" value=dummy>
|
||||
<input class=hidden name=\"noautohours\[]\" value=dummy>
|
||||
<select name=\"noautohours\[]\" id=s_noautohours
|
||||
multiple size=8
|
||||
class=\"text ui-widget-content ui-corner-all\">
|
||||
@ -79,8 +83,8 @@ puts {
|
||||
|
||||
<script type=text/javascript>
|
||||
$('#s_noautohours').multiSelect({
|
||||
selectableHeader: "<div class=odd>Enable during</div>",
|
||||
selectionHeader: "<div class=odd>Disable during</div>"
|
||||
selectableHeader: '<div class=odd>Enable during</div>',
|
||||
selectionHeader: '<div class=odd>Disable during</div>'
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
@ -881,7 +881,7 @@ if {[lindex $argv 0] eq "-singledir"} {
|
||||
scansingle [lrange $argv 1 end]
|
||||
} elseif {[lindex $argv 0] eq "-queue"} {
|
||||
log "Processing queue..." 2
|
||||
queue startup
|
||||
queue startup [$settings autokeep]
|
||||
while {[llength [set q [queue pop]]]} {
|
||||
oktorun
|
||||
|
||||
@ -903,7 +903,7 @@ if {[lindex $argv 0] eq "-singledir"} {
|
||||
$q update RUNNING "Started at [clock format [clock seconds]]"
|
||||
set start [clock seconds]
|
||||
if {[catch {$func $ts} msg]} {
|
||||
$q update FAILED $msg 1
|
||||
$q update FAILED "$msg" 1
|
||||
continue
|
||||
}
|
||||
set elapsed $([clock seconds] - $start)
|
||||
|
22
webif/lib/json
Normal file
22
webif/lib/json
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
# Initialise a map from control characters to JSON escaped characters.
|
||||
# Initially all non-null control characters to \u00xx sequences.
|
||||
for {set i 1} {$i < 32} {incr i} {
|
||||
set ::json::escape_map([format %c $i]) \\u[format %04x $i]
|
||||
}
|
||||
|
||||
# Then overwrite certain well known control characters with shorter versions.
|
||||
set ::json::escape_map([format %c 8]) \\b; # backspace
|
||||
set ::json::escape_map([format %c 9]) \\t; # tab
|
||||
set ::json::escape_map([format %c 10]) \\n; # lf
|
||||
set ::json::escape_map([format %c 12]) \\f; # ff
|
||||
set ::json::escape_map([format %c 13]) \\r; # cr
|
||||
# Other special sequences
|
||||
set ::json::escape_map(\") {\"}
|
||||
set ::json::escape_map(\\) {\\}
|
||||
set ::json::escape_map(/) {\/}
|
||||
|
||||
proc ::json::escape {in} {
|
||||
return [string map $::json::escape_map $in]
|
||||
}
|
||||
|
@ -73,7 +73,8 @@ queue method update {_status {_log ""} {_retry 0} {_elapsed 0}} {
|
||||
set elapsed $_elapsed
|
||||
}
|
||||
|
||||
proc {queue startup} {} {
|
||||
proc {queue startup} {{days 7}} {
|
||||
if {$days == 0} { set days 7 }
|
||||
set db [queue dbhandle]
|
||||
$db query {
|
||||
update queue
|
||||
@ -86,7 +87,7 @@ proc {queue startup} {} {
|
||||
delete from queue
|
||||
where status in ('COMPLETE', 'FAILED')
|
||||
and dat < %s
|
||||
} [expr [clock seconds] - 86400 * 7]
|
||||
} [expr [clock seconds] - 86400 * $days]
|
||||
}
|
||||
|
||||
proc {queue insert} {ts action} {
|
||||
@ -127,6 +128,19 @@ proc {queue delete_by_id} {id} {
|
||||
$db query $q $id
|
||||
}
|
||||
|
||||
proc {queue resubmit} {id} {
|
||||
set db [queue dbhandle]
|
||||
|
||||
set q "
|
||||
update queue
|
||||
set status = 'PENDING'
|
||||
where id = '%s'
|
||||
and status in ('FAILED')
|
||||
"
|
||||
|
||||
$db query $q $id
|
||||
}
|
||||
|
||||
proc {queue status} {ts} {
|
||||
if {$ts eq "0"} { return "" }
|
||||
|
||||
|
@ -39,6 +39,7 @@ class settings {
|
||||
noautorec 0
|
||||
noautorecimm 0
|
||||
autorecperiod 10
|
||||
autokeep 7
|
||||
noautohours ""
|
||||
changechangenc 0
|
||||
audiomp3 0
|
||||
@ -242,6 +243,10 @@ settings method autorecperiod {{val -1}} {
|
||||
return [$self _nval_setting autorecperiod $val]
|
||||
}
|
||||
|
||||
settings method autokeep {{val -1}} {
|
||||
return [$self _nval_setting autokeep $val]
|
||||
}
|
||||
|
||||
settings method noautohours {{val -1}} {
|
||||
set val [$self _tval_setting noautohours $val]
|
||||
return $val
|
||||
|
Loading…
Reference in New Issue
Block a user