git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3507 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2017-01-09 19:23:13 +00:00
parent 26ceff2ad2
commit caeabd15d0
15 changed files with 83 additions and 23 deletions

View File

@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
Version: 1.3.5-1
Version: 1.3.5-2
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.5),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.21),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.5),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.21-1),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)
Suggests:
Description: An evolving web interface for the Humax.
Tags: http://hummy.tv/forum/threads/7619/

View File

@ -409,7 +409,8 @@ if {$nicesplice} {
# Queue
set queueactions(decrypt) "Decryption"
set queueactions(shrink) "Shrink"
set queueactions(mp3) "Audio-Extraction"
set queueactions(mp2) "Audio-Extraction (mp2, fast)"
set queueactions(mp3) "Audio-Extraction (mp3, slow)"
set queueactions(mpg) "Conversion to MPG"
eval_plugins queueactions
@ -419,7 +420,9 @@ Queue for</button>
<select id=so_queueactions
class="tsonesel text ui-widget-content ui-corner-all">
}
foreach {k v} $queueactions {
set rqueueactions [lreverse $queueactions]
foreach v [lsort [dict keys $rqueueactions]] {
set k $rqueueactions($v)
puts "<option value=$k>$v</option>"
}
puts {

View File

@ -27,7 +27,16 @@ foreach file [cgi_get files] {
set ts [ts fetch $file]
if {$ts eq "0"} continue
queue insert $ts $act
if {$act eq "mp2"} {
set q [queue insert $ts mp3]
} else {
set q [queue insert $ts $act]
}
switch -- $act {
mp2 { $q set args "-mp2" }
mp3 { $q set args "-mp3" }
}
puts "</li>"
}
puts "</ul>"

View File

@ -1,11 +1,19 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require queue.class json
require queue.class json settings.class
httpheader "application/json"
puts "\["
set s [settings]
set autolast [$s autolast]
set autofreq [$s autofreq]
puts "{"
puts " \"autofreq\": \"$autofreq\","
puts " \"autolast\": \"[clock format $autolast] ([clock format [expr \
[clock seconds] - $autolast] -format %T] ago)\","
puts " \"data\": \["
set flag 0
foreach q [queue all] {
set name [string map {
@ -41,4 +49,5 @@ foreach q [queue all] {
puts -nonewline "}"
}
puts "\n]"
puts "}"

View File

@ -50,6 +50,8 @@ There are no tasks in the queue.
<button id=refresh>Refresh</button>
<span id=isloading><img src=/img/loading.gif></span>
</div>
<div class=blood>Last scan: <span id=autolast>retrieving...</span> -
scanning every <span id=autofreq>TBC</span> minutes.</div>
</fieldset>
}

View File

@ -14,6 +14,11 @@ function load()
$.getJSON('fetch.jim', function(data) {
$('#queuetab > tbody').empty();
$('#autolast').html(data.autolast);
$('#autofreq').html(data.autofreq);
data = data.data;
$.each(data, function(k, v) {
s = '<tr>' +

View File

@ -188,7 +188,7 @@ for {set qq [::auto::pending]} {[llength $qq]} {set qq [::auto::pending]} {
$q update "FAILED" "Plugin failure" 1
}
"OK" {
$q update "COMPLETE" "[::auto::date] $msg" 1 $elapsed
$q update "COMPLETE" "$msg ([::auto::date])" 1 $elapsed
::auto::runplugins dequeued $plugin $q $ts
}
"DEFER" {

View File

@ -7,15 +7,16 @@ proc ::decrypt::ts {ts} {
return
}
if {[$ts flag "Encrypted"]} {
::auto::log " $file - Protected (Enc flag)." 2
return
}
if {[queue check $ts decrypt]} {
::auto::log " $file - Already queued." 2
return
}
if {[::auto::inuse $ts]} {
::auto::log " $file - In use." 2
return
}
# Check that the file is not already decrypted by analysing it.
set anencd [exec /mod/bin/stripts -qE [file rootname $file]]
if {$anencd != "1"} {

View File

@ -11,25 +11,25 @@ proc ::decrypt::dequeue {q ts} {
return {"OK" "Already decrypted"}
}
if {[$ts flag "Encrypted"]} {
return {"DEFER" "Protected (Enc flag)"}
}
if {![system dlnastatus]} {
if {[system instandby]} {
# Prevent polling every minute
return [list "DEFER" "Cannot decrypt in standby" +300]
return [list "DEFER" "Cannot decrypt in standby" +120]
}
return {"DEFER" "DLNA Server not running"}
}
if {[::auto::inuse $ts]} {
if {[clock seconds] < [$ts get end]} {
if {[$ts get scheddur] == 5700} {
# Likely to be instant-recording.
if {[$ts tsr]} {
return [list "DEFER" \
"Instant-recording in-progress" +300]
"Time-shifted recording in-progress" +120]
}
# if {[$ts get scheddur] == 5700} {
# # Likely to be instant-recording.
# return [list "DEFER" \
# "Instant-recording in-progress" +120]
# }
# Recording in progress, defer until near expected
# end.
set left $([$ts get end] - [clock seconds])
@ -51,6 +51,10 @@ proc ::decrypt::dequeue {q ts} {
"Already decrypted but the HMT flag was wrong (fixed)"}
}
if {[$ts flag "Encrypted"]} {
return {"DEFER" "Protected (Enc flag)"}
}
lassign [$ts dlnaloc "127.0.0.1"] url
if {$url ne ""} {
log " $file - has been indexed."

View File

@ -18,6 +18,11 @@ proc ::mp3::ts {ts} {
return
}
if {[::auto::inuse $ts]} {
::auto::log " $file - In use." 2
return
}
# Enqueue file
set q [queue insert $ts mp3]
#$q set args "-mp2"

View File

@ -29,16 +29,20 @@ proc ::mp3::dequeue {q ts} {
system startop mp3 [$ts get file]
::auto::dsc [$ts size]
set mp3mode $audiomp3
if {"-mp2" in [$q get args]} { set mp3mode 0 }
if {"-mp3" in [$q get args]} { set mp3mode 1 }
::auto::startclock
log " MP3: $file" 0
log " Converting... [$::auto::settings \
audiomp3descr $audiomp3]" 0
audiomp3descr $mp3mode]" 0
if {[catch {
set cmd [list nice -n 19 \
/mod/bin/ffmpeg -y -benchmark -v 0 -i "$file.ts" \
-f mp3 -vn]
if {!$audiomp3} { lappend cmd -acodec copy }
if {!$mp3mode} { lappend cmd -acodec copy }
lappend cmd "$tmp/mp3.mp3"
foreach line [split [exec {*}$cmd] "\n"] {
log [string trim $line] 0

View File

@ -18,6 +18,11 @@ proc ::mpg::ts {ts} {
return
}
if {[::auto::inuse $ts]} {
::auto::log " $file - In use." 2
return
}
# Enqueue file
queue insert $ts mpg
::auto::log " $file - Queued for mpg." 0

View File

@ -12,6 +12,11 @@ proc ::shrink::ts {ts} {
return
}
if {[::auto::inuse $ts]} {
::auto::log " $file - In use." 2
return
}
if {[catch {
set perc [exec /mod/bin/stripts -aq [file rootname $file]]
} msg]} {

View File

@ -175,7 +175,7 @@ proc {queue hold} {id} {
update queue
set status = 'HOLD'
where id = '%s'
and status != 'RUNNING'
and status not in ('RUNNING', 'COMPLETE')
"
$db query $q $id

View File

@ -722,3 +722,11 @@ ts method epstr {{format "s%se%E/%n"}} {
return [string map $map $format]
}
ts method tsr {} {
set fd [open "[file rootname $file].nts"]
set bytes [read $fd 0x20]
close $fd
set tsr [unpack $bytes -uintle $(8 * 0x1f) 8]
return $tsr
}