diff --git a/CONTROL/control b/CONTROL/control
index 755a60f..fded687 100644
--- a/CONTROL/control
+++ b/CONTROL/control
@@ -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)
diff --git a/etc/recmon.d/autotrigger b/etc/recmon.d/autotrigger
index 079ccb7..58e2a43 100755
--- a/etc/recmon.d/autotrigger
+++ b/etc/recmon.d/autotrigger
@@ -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]} {
diff --git a/webif/html/log/fetch.jim b/webif/html/log/fetch.jim
index 633a4a1..c7c31f4 100755
--- a/webif/html/log/fetch.jim
+++ b/webif/html/log/fetch.jim
@@ -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 "
$l | [quote $line] |
"
- 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 "$l | [quote $line] |
"
+ incr l
+ }
}
$fp close
diff --git a/webif/html/log/index.jim b/webif/html/log/index.jim
index 3d5f0fa..ac35715 100755
--- a/webif/html/log/index.jim
+++ b/webif/html/log/index.jim
@@ -61,7 +61,8 @@ puts "
-
+
+
diff --git a/webif/html/log/script.js b/webif/html/log/script.js
index ef6a104..c18a676 100644
--- a/webif/html/log/script.js
+++ b/webif/html/log/script.js
@@ -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');
diff --git a/webif/lib/bin/auto b/webif/lib/bin/auto
index 9f856de..86aa1ac 100755
--- a/webif/lib/bin/auto
+++ b/webif/lib/bin/auto
@@ -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
}