fixes/improvements
git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3434 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
759b96e764
commit
1fc426cb1a
@ -1,7 +1,7 @@
|
|||||||
Package: webif
|
Package: webif
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: web
|
Section: web
|
||||||
Version: 1.3.4
|
Version: 1.3.4-1
|
||||||
Architecture: mipsel
|
Architecture: mipsel
|
||||||
Maintainer: af123@hpkg.tv
|
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)
|
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)
|
||||||
|
@ -6,7 +6,6 @@ export TZ=GMT+0BST,M3.5.0/1,M10.5.0/2
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
/mod/webif/lib/bin/update_queue
|
|
||||||
/mod/webif/lib/bin/manage_logs
|
/mod/webif/lib/bin/manage_logs
|
||||||
plog activity "System booted (`lbr_descr`)."
|
plog activity "System booted (`lbr_descr`)."
|
||||||
;;
|
;;
|
||||||
|
@ -883,7 +883,7 @@ $('#bmpdialogue').dialog({
|
|||||||
// Selection overlay
|
// Selection overlay
|
||||||
$seloverlay = $('#selectoverlay').dialog({
|
$seloverlay = $('#selectoverlay').dialog({
|
||||||
modal: false, autoOpen: false,
|
modal: false, autoOpen: false,
|
||||||
height: 85, width: 460,
|
height: 85, width: 485,
|
||||||
show: 'fade', hide: 'fade',
|
show: 'fade', hide: 'fade',
|
||||||
draggable: true, resizable: false
|
draggable: true, resizable: false
|
||||||
});
|
});
|
||||||
|
37
webif/html/diag/queue/fetch.jim
Executable file
37
webif/html/diag/queue/fetch.jim
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
#!/mod/bin/jimsh
|
||||||
|
|
||||||
|
source /mod/webif/lib/setup
|
||||||
|
require queue.class
|
||||||
|
|
||||||
|
httpheader "application/json"
|
||||||
|
|
||||||
|
puts "\["
|
||||||
|
set flag 0
|
||||||
|
foreach q [queue all] {
|
||||||
|
set name [string map {
|
||||||
|
"/mnt/hd2/My Video/" ""
|
||||||
|
"/media/drive1/Video/" ""
|
||||||
|
"/media/" ""
|
||||||
|
".ts" ""
|
||||||
|
} [$q get file]]
|
||||||
|
set dat [clock format [$q get dat] -format {%c}]
|
||||||
|
|
||||||
|
if {$flag} { puts "," } else { incr flag }
|
||||||
|
puts "{"
|
||||||
|
puts " \"qid\": [$q get id],"
|
||||||
|
puts " \"dat\": \"$dat\","
|
||||||
|
puts " \"file\": \"$name\","
|
||||||
|
puts " \"action\": \"[$q get action]\","
|
||||||
|
puts " \"status\": \"[$q get status]\","
|
||||||
|
puts " \"log\": \"[$q get log]\","
|
||||||
|
if {[$q get elapsed] > 0} {
|
||||||
|
set time [clock format [$q get elapsed] -format "%T"]
|
||||||
|
puts " \"elapsed\": \"$time\","
|
||||||
|
} else {
|
||||||
|
puts " \"elapsed\": \"0\","
|
||||||
|
}
|
||||||
|
puts " \"retry\": \"[$q get retry]\""
|
||||||
|
puts -nonewline "}"
|
||||||
|
}
|
||||||
|
puts "\n]"
|
||||||
|
|
@ -16,51 +16,27 @@ puts {
|
|||||||
</h3>
|
</h3>
|
||||||
<fieldset class=cleft>
|
<fieldset class=cleft>
|
||||||
<legend>Queued Tasks</legend>
|
<legend>Queued Tasks</legend>
|
||||||
<table class=borders cellpadding=5>
|
<table id=queuetab class=borders cellpadding=5>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th nowrap>ID<input type=checkbox id=selall></th>
|
<th nowrap>ID</th>
|
||||||
<th>Submitted</th>
|
<th>Submitted</th>
|
||||||
<th>File</th>
|
<th>File</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
|
<th>Time</th>
|
||||||
<th>Log</th>
|
<th>Log</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
}
|
|
||||||
|
|
||||||
foreach q [queue all] {
|
|
||||||
set name [string map {
|
|
||||||
"/mnt/hd2/My Video/" ""
|
|
||||||
"/media/drive1/Video/" ""
|
|
||||||
"/media/" ""
|
|
||||||
".ts" ""
|
|
||||||
} [$q get file]]
|
|
||||||
|
|
||||||
puts "
|
|
||||||
<tr>
|
|
||||||
<td><input type=checkbox class=qid value=[$q get id]>
|
|
||||||
[$q get id]
|
|
||||||
</td>
|
|
||||||
<td>[clock format [$q get dat] -format {%c}]</td>
|
|
||||||
<td>$name</td>
|
|
||||||
<td>[$q get action]</td>
|
|
||||||
<td class=\"status [$q get status]\">[$q get status]"
|
|
||||||
if {[$q get status] eq "RUNNING"} {
|
|
||||||
puts "<img src=/img/loading.gif>"
|
|
||||||
}
|
|
||||||
puts "</td>
|
|
||||||
<td>[$q get log]</td>
|
|
||||||
</tr>
|
|
||||||
"
|
|
||||||
}
|
|
||||||
|
|
||||||
puts {
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<button id=qdelete>Delete Selected</button>
|
<button id=qdelete>Delete Selected</button>
|
||||||
<button id=refresh>Refresh Page</button>
|
<button id=selcomplete>Select Completed</button>
|
||||||
|
<button id=selall>Select All</button>
|
||||||
|
<button id=selnone>Select None</button>
|
||||||
|
<button id=refresh>Refresh</button>
|
||||||
|
<span id=isloading><img src=/img/loading.gif></span>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,50 @@ function page_refresh(msg)
|
|||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function load()
|
||||||
|
{
|
||||||
|
$.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 + '>' +
|
||||||
|
v.qid + '</td>' +
|
||||||
|
'<td>' + v.dat + '</td>' +
|
||||||
|
'<td>' + v.file + '</td>' +
|
||||||
|
'<td>' + v.action + '</td>' +
|
||||||
|
'<td class="status ' + v.status + '">' + v.status;
|
||||||
|
if (v.status == 'RUNNING')
|
||||||
|
s += ' <img class=va src=/img/loading.gif>';
|
||||||
|
s += '</td><td>';
|
||||||
|
if (v.elapsed != '0')
|
||||||
|
s += v.elapsed;
|
||||||
|
s += '</td>' +
|
||||||
|
'<td>' + v.log + '</td>' +
|
||||||
|
'</tr>';
|
||||||
|
|
||||||
|
$('#queuetab > tbody').append(s);
|
||||||
|
});
|
||||||
|
var resort = true;
|
||||||
|
$('#queuetab').trigger('update', [resort]);
|
||||||
|
$('input.qid:checkbox').prop('checked', false).enable();
|
||||||
|
|
||||||
|
$('tr').each(function() {
|
||||||
|
var status = $(this).find('td.status').text();
|
||||||
|
|
||||||
|
if (status == 'RUNNING')
|
||||||
|
$(this).find('input.qid:checkbox').disable();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input.qid').first().trigger('change');
|
||||||
|
$('#isloading').hide('slow');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
$('table')
|
$('table')
|
||||||
@ -18,17 +62,9 @@ $('table')
|
|||||||
widgets: ['zebra', 'stickyHeaders']
|
widgets: ['zebra', 'stickyHeaders']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
load();
|
||||||
|
|
||||||
$('input.qid:checkbox').prop('checked', false).enable();
|
$('#queuetab').on('change', 'input.qid', function() {
|
||||||
|
|
||||||
$('tr').each(function() {
|
|
||||||
var status = $(this).find('td.status').text();
|
|
||||||
|
|
||||||
if (status == 'RUNNING')
|
|
||||||
$(this).find('input.qid:checkbox').disable();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('input.qid:checkbox').on('change', function() {
|
|
||||||
var num = $('input.qid:checked').size();
|
var num = $('input.qid:checked').size();
|
||||||
if (num)
|
if (num)
|
||||||
$('#qdelete').enable();
|
$('#qdelete').enable();
|
||||||
@ -47,7 +83,6 @@ $('#qdelete').button({icons:{primary:"ui-icon-trash"}})
|
|||||||
message: '<h1><img src=/img/loading.gif> Deleting... </h1>'
|
message: '<h1><img src=/img/loading.gif> Deleting... </h1>'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var slots = $('input.qid:checked').map(function() {
|
var slots = $('input.qid:checked').map(function() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}).get();
|
}).get();
|
||||||
@ -60,16 +95,27 @@ $('#qdelete').button({icons:{primary:"ui-icon-trash"}})
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#selnone').button({icons:{primary:"ui-icon-close"}})
|
||||||
|
.on('click', function() {
|
||||||
|
$('#queuetab input:checkbox').prop('checked', false);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#selall').button({icons:{primary:"ui-icon-check"}})
|
||||||
|
.on('click', function() {
|
||||||
|
$('#queuetab input:checkbox').prop('checked', true);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#selcomplete').button({icons:{primary:"ui-icon-stop"}})
|
||||||
|
.on('click', function() {
|
||||||
|
$('#queuetab input:checkbox[status="COMPLETE"]').prop('checked', true);
|
||||||
|
});
|
||||||
|
|
||||||
$('#refresh').button({icons:{primary:"ui-icon-refresh"}})
|
$('#refresh').button({icons:{primary:"ui-icon-refresh"}})
|
||||||
.on('click', function() {
|
.on('click', function() {
|
||||||
page_refresh();
|
load();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#selall').on('change', function() {
|
setInterval(load, 60000);
|
||||||
$('input.qid:checkbox').prop('checked', $(this).prop('checked'));
|
|
||||||
});
|
|
||||||
|
|
||||||
setInterval(function() { page_refresh() }, 60000);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ foreach mod $modules {
|
|||||||
proc plugin_callback {plugin hook} {
|
proc plugin_callback {plugin hook} {
|
||||||
puts "<h4>Settings for <i>[file tail $plugin]</i> package</h4>"
|
puts "<h4>Settings for <i>[file tail $plugin]</i> package</h4>"
|
||||||
puts "<div class=pluginsettings>"
|
puts "<div class=pluginsettings>"
|
||||||
if {[catch {source "$plugin/$hook"} msg]} {
|
if {[catch {uplevel source "$plugin/$hook"} msg]} {
|
||||||
puts "ERROR: $msg"
|
puts "ERROR: $msg"
|
||||||
}
|
}
|
||||||
puts "</div>"
|
puts "</div>"
|
||||||
|
@ -881,6 +881,7 @@ if {[lindex $argv 0] eq "-singledir"} {
|
|||||||
scansingle [lrange $argv 1 end]
|
scansingle [lrange $argv 1 end]
|
||||||
} elseif {[lindex $argv 0] eq "-queue"} {
|
} elseif {[lindex $argv 0] eq "-queue"} {
|
||||||
log "Processing queue..." 2
|
log "Processing queue..." 2
|
||||||
|
queue startup
|
||||||
while {[llength [set q [queue pop]]]} {
|
while {[llength [set q [queue pop]]]} {
|
||||||
oktorun
|
oktorun
|
||||||
|
|
||||||
@ -900,11 +901,14 @@ if {[lindex $argv 0] eq "-singledir"} {
|
|||||||
}
|
}
|
||||||
set func $::queue_actions($act)
|
set func $::queue_actions($act)
|
||||||
$q update RUNNING "Started at [clock format [clock seconds]]"
|
$q update RUNNING "Started at [clock format [clock seconds]]"
|
||||||
|
set start [clock seconds]
|
||||||
if {[catch {$func $ts} msg]} {
|
if {[catch {$func $ts} msg]} {
|
||||||
$q update FAILED $msg 1
|
$q update FAILED $msg 1
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
$q update COMPLETE "Completed at [clock format [clock seconds]]"
|
set elapsed $([clock seconds] - $start)
|
||||||
|
$q update COMPLETE \
|
||||||
|
"Completed at [clock format [clock seconds]]" 0 $elapsed
|
||||||
}
|
}
|
||||||
} elseif {[llength $argv] > 0} {
|
} elseif {[llength $argv] > 0} {
|
||||||
set loglevel 2
|
set loglevel 2
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#!/mod/bin/jimsh
|
|
||||||
|
|
||||||
source /mod/webif/lib/setup
|
|
||||||
require queue.class
|
|
||||||
|
|
||||||
queue boot
|
|
||||||
|
|
@ -4,7 +4,7 @@ proc eval_plugins {hook {verbose 0} {callback ""}} {
|
|||||||
if {[file exists "$plugin/.disabled"]} continue
|
if {[file exists "$plugin/.disabled"]} continue
|
||||||
if {[file isfile "$plugin/$hook.hook"]} {
|
if {[file isfile "$plugin/$hook.hook"]} {
|
||||||
if {$callback ne ""} {
|
if {$callback ne ""} {
|
||||||
$callback $plugin $hook.hook
|
uplevel $callback $plugin $hook.hook
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if {[catch \
|
if {[catch \
|
||||||
|
@ -10,6 +10,7 @@ class queue {
|
|||||||
log ""
|
log ""
|
||||||
status ""
|
status ""
|
||||||
retry 0
|
retry 0
|
||||||
|
elapsed 0
|
||||||
}
|
}
|
||||||
|
|
||||||
proc {queue dbhandle} {args} {
|
proc {queue dbhandle} {args} {
|
||||||
@ -36,6 +37,7 @@ proc {queue dbhandle} {args} {
|
|||||||
action text,
|
action text,
|
||||||
status text default 'PENDING',
|
status text default 'PENDING',
|
||||||
log text default '',
|
log text default '',
|
||||||
|
elapsed integer,
|
||||||
retry integer default 0
|
retry integer default 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -44,26 +46,39 @@ proc {queue dbhandle} {args} {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
set ::queue::db [sqlite3.open /mod/etc/queue.db]
|
set ::queue::db [sqlite3.open /mod/etc/queue.db]
|
||||||
|
# XXX - Remove before release
|
||||||
|
catch { $::queue::db query {
|
||||||
|
alter table queue
|
||||||
|
add column elapsed integer default 0
|
||||||
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $::queue::db
|
return $::queue::db
|
||||||
}
|
}
|
||||||
|
|
||||||
queue method update {_status {_log ""} {_retry 0}} {
|
queue method update {_status {_log ""} {_retry 0} {_elapsed 0}} {
|
||||||
set db [queue dbhandle]
|
set db [queue dbhandle]
|
||||||
$db query {
|
$db query {
|
||||||
update queue
|
update queue
|
||||||
set status = '%s', log = '%s', retry = retry + %s
|
set status = '%s',
|
||||||
|
log = '%s',
|
||||||
|
retry = retry + %s,
|
||||||
|
elapsed = %s
|
||||||
where id = %s
|
where id = %s
|
||||||
} $_status $_log $_retry $id
|
} $_status $_log $_retry $_elapsed $id
|
||||||
|
|
||||||
|
set status $_status
|
||||||
|
set log $_log
|
||||||
|
incr retry $_retry
|
||||||
|
set elapsed $_elapsed
|
||||||
}
|
}
|
||||||
|
|
||||||
proc {queue boot} {} {
|
proc {queue startup} {} {
|
||||||
set db [queue dbhandle]
|
set db [queue dbhandle]
|
||||||
$db query {
|
$db query {
|
||||||
update queue
|
update queue
|
||||||
set status = 'INTERRUPTED',
|
set status = 'INTERRUPTED',
|
||||||
log = 'System was shut down. Job will be retried automatically.',
|
log = 'Job will be retried automatically.',
|
||||||
retry = retry + 1
|
retry = retry + 1
|
||||||
where status in ('RUNNING', 'INTERRUPTED')
|
where status in ('RUNNING', 'INTERRUPTED')
|
||||||
}
|
}
|
||||||
@ -71,7 +86,7 @@ proc {queue boot} {} {
|
|||||||
delete from queue
|
delete from queue
|
||||||
where status in ('COMPLETE', 'FAILED')
|
where status in ('COMPLETE', 'FAILED')
|
||||||
and dat < %s
|
and dat < %s
|
||||||
} [expr [clock seconds] - 86400 * 3]
|
} [expr [clock seconds] - 86400 * 7]
|
||||||
}
|
}
|
||||||
|
|
||||||
proc {queue insert} {ts action} {
|
proc {queue insert} {ts action} {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user