forked from hummypkg/webif
updates
git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2408 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
547f825f54
commit
37e979787e
@ -1,7 +1,7 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 1.2.2-7
|
||||
Version: 1.2.2-8
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif-channelicons(>=1.1.18),lighttpd(>=1.4.35-2),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=2.0.3),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.3)
|
||||
|
@ -9,7 +9,10 @@ set file [lindex $argv 0]
|
||||
set dir [file dirname $file]
|
||||
|
||||
set prefix "autotrigger\[[pid]\]"
|
||||
if {$loglevel > 0} { system plog auto "$prefix: will run for $dir" }
|
||||
if {$loglevel > 0} {
|
||||
system plog auto "$prefix: $file"
|
||||
system plog auto "$prefix: will run for $dir"
|
||||
}
|
||||
|
||||
# Wait up to 10 minutes for any existing auto process to finish...
|
||||
if {![acquire_lock webif_auto 600 5]} {
|
||||
|
@ -5,10 +5,16 @@ source /mod/webif/lib/setup
|
||||
|
||||
source _lib.jim
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
set dload [cgi_get dload -]
|
||||
set file [cgi_get file "-"]
|
||||
if {$file eq "-"} { set file "/var/log/humaxtv.log" }
|
||||
if {$file ni $loglist} { exit }
|
||||
|
||||
httpheader
|
||||
if {$dload ne "-"} {
|
||||
httpheader "application/force-download" 0 "Content-Disposition: attachment; filename=\"[file tail $file].txt\"\r\n"
|
||||
} else {
|
||||
httpheader
|
||||
}
|
||||
|
||||
proc quote {s} {
|
||||
return [string map {
|
||||
@ -19,10 +25,6 @@ proc quote {s} {
|
||||
} $s]
|
||||
}
|
||||
|
||||
set file [cgi_get file "-"]
|
||||
if {$file eq "-"} { set file "/var/log/humaxtv.log" }
|
||||
if {$file ni $loglist} { exit }
|
||||
|
||||
set lines [cgi_get lines 0]
|
||||
|
||||
if {$lines} {
|
||||
@ -30,12 +32,20 @@ if {$lines} {
|
||||
} else {
|
||||
set fp [open $file r]
|
||||
}
|
||||
set l 1
|
||||
while {![$fp eof]} {
|
||||
$fp gets line
|
||||
if {[$fp eof]} break
|
||||
puts "<tr><td>$l</td><td>[quote $line]</td></tr>"
|
||||
incr l
|
||||
if {$dload ne "-"} {
|
||||
while {![$fp eof]} {
|
||||
$fp gets line
|
||||
if {[$fp eof]} break
|
||||
puts $line
|
||||
}
|
||||
} else {
|
||||
set l 1
|
||||
while {![$fp eof]} {
|
||||
$fp gets line
|
||||
if {[$fp eof]} break
|
||||
puts "<tr><td>$l</td><td>[quote $line]</td></tr>"
|
||||
incr l
|
||||
}
|
||||
}
|
||||
$fp close
|
||||
|
||||
|
@ -61,7 +61,8 @@ puts "
|
||||
|
||||
<div class=left id=buttons>
|
||||
<button id=reload>Reload</button>
|
||||
<button id=clear>Clear Log</button>
|
||||
<button id=clear>Clear</button>
|
||||
<button id=download>Download</button>
|
||||
</div>
|
||||
|
||||
<div id=logarea class=\"cleft hidden\">
|
||||
|
@ -132,6 +132,12 @@ $('#clear').button({icons: { primary: "ui-icon-trash" }})
|
||||
});
|
||||
});
|
||||
|
||||
$('#download').button({icons: { primary: "ui-icon-disk" }})
|
||||
.on('click', function() {
|
||||
window.open('fetch.jim?dload=yes&file=' +
|
||||
encodeURIComponent(logfile));
|
||||
});
|
||||
|
||||
$('#reload').button({icons: { primary: "ui-icon-refresh" }})
|
||||
.on('click', function() {
|
||||
$('#log').trigger('change');
|
||||
|
@ -63,6 +63,16 @@ proc log {msg {level 1}} {
|
||||
flush $::logfd
|
||||
}
|
||||
|
||||
proc inuse {ts} {
|
||||
set retries 5
|
||||
while {$retries > 0 && [$ts inuse]} {
|
||||
log "inuse($retries) - [$ts get file]"
|
||||
incr retries -1
|
||||
sleep 1
|
||||
}
|
||||
return [$ts inuse]
|
||||
}
|
||||
|
||||
proc elapsed {start} {
|
||||
return $(([clock milliseconds] - $start) / 1000.0)
|
||||
}
|
||||
@ -90,7 +100,7 @@ proc register {type fn {priority 50}} {
|
||||
global "hook_$type"
|
||||
if {[info exists "hook_$type"]} {
|
||||
lappend "hook_$type" [list $fn $priority]
|
||||
log "Registered $fn for $type hook with priority $priority." 1
|
||||
log "Registered $fn for $type hook with priority $priority."
|
||||
} else {
|
||||
log "Unknown hook hook_$type" 0
|
||||
}
|
||||
@ -218,14 +228,14 @@ proc do_shrink {ts} {
|
||||
if {[file exists "$dir/.autodecrypt"] || [scanup $dir decrypt] == 1} {
|
||||
log " $dir is also set for decryption." 2
|
||||
if {[$ts flag "ODEncrypted"]} {
|
||||
log " $file - deferring shrink until decrypted." 1
|
||||
log " $file - deferring shrink until decrypted."
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
set file [file rootname [$ts get file]]
|
||||
|
||||
if {[$ts inuse]} {
|
||||
if {[inuse $ts]} {
|
||||
log " $file - in use." 2
|
||||
return
|
||||
}
|
||||
@ -321,7 +331,7 @@ proc do_decrypt {ts} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[$ts inuse]} {
|
||||
if {[inuse $ts]} {
|
||||
log " $file - In use."
|
||||
return
|
||||
}
|
||||
@ -375,7 +385,7 @@ proc do_decrypt {ts} {
|
||||
|
||||
# Check if the file is in use. It is possible that the file is
|
||||
# now being played even though it was free when decryption started.
|
||||
if {[$ts inuse]} {
|
||||
if {[inuse $ts]} {
|
||||
log " $file - In use."
|
||||
file tdelete "$tmp/$bfile"
|
||||
endop
|
||||
@ -451,7 +461,7 @@ proc do_mpg {ts} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[$ts inuse]} {
|
||||
if {[inuse $ts]} {
|
||||
log " $file - In use."
|
||||
return
|
||||
}
|
||||
@ -504,7 +514,7 @@ proc do_mp3 {ts} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[$ts inuse]} {
|
||||
if {[inuse $ts]} {
|
||||
log " $file - In use."
|
||||
return
|
||||
}
|
||||
@ -619,7 +629,7 @@ proc expire {dir} {
|
||||
break
|
||||
}
|
||||
log " [file tail $file]"
|
||||
if {[$ts inuse]} {
|
||||
if {[inuse $ts]} {
|
||||
log " In use, skipping."
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user