diff --git a/CONTROL/control b/CONTROL/control
index 3dd73fd..852869c 100644
--- a/CONTROL/control
+++ b/CONTROL/control
@@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
-Version: 1.4.9
+Version: 1.4.9-3
Architecture: mipsel
Maintainer: af123@hpkg.tv
Depends: tcpfix,webif-channelicons(>=1.1.27),lighttpd(>=1.4.39-1),jim(>=0.79),jim-pack(>=0.79),jim-oo(>=0.77),jim-sqlite3(>=0.77),jim-cgi(>=0.7-2),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),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.13),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv,zip(>=3.0-1),wget
diff --git a/webif/cgi-bin/epg/info.jim b/webif/cgi-bin/epg/info.jim
index 31bbac7..713a2ac 100755
--- a/webif/cgi-bin/epg/info.jim
+++ b/webif/cgi-bin/epg/info.jim
@@ -31,7 +31,7 @@ if {[$record get sched_type] < 1} {
[system tuners]]
if {[llength $conflicts]} {
puts {
-
+
This event conflicts with the following items in your scheduled recording list.
}
diff --git a/webif/cgi-bin/opkg.jim b/webif/cgi-bin/opkg.jim
index ca776d0..fc1ff8f 100755
--- a/webif/cgi-bin/opkg.jim
+++ b/webif/cgi-bin/opkg.jim
@@ -2,7 +2,7 @@
package require cgi
source /mod/webif/lib/setup
-require pkg.class system.class
+require pkg.class system.class settings.class
cgi_input
#cgi_dump
@@ -61,6 +61,11 @@ if {$cmd eq "dependinfo"} {
}
if {$cmd eq "upgrade"} { opkg update }
+
+if {$cmd eq "remove" && [[settings] noautoremove] ne "1"} {
+ append cmd " --autoremove"
+}
+
opkg "$cmd $cmdargs"
if {$cmd eq "update" || $cmd eq "upgrade"} {
diff --git a/webif/cgi-bin/status.jim b/webif/cgi-bin/status.jim
index 45db75e..f1e92eb 100755
--- a/webif/cgi-bin/status.jim
+++ b/webif/cgi-bin/status.jim
@@ -7,7 +7,7 @@ require system.class epg.class rsv.class svc.class plugin
set runmode cli
if {[string match {*jim} $argv0]} { set runmode cgi }
-set schedtime 1200
+set schedtime 1200
switch $runmode {
cgi {
set type [cgi_get type "full"]
@@ -15,8 +15,7 @@ switch $runmode {
}
cli {
set type "full"
- if {"-X" in $argv} { set schedtime 7200 }
- if {"-x" in $argv} { set schedtime 7200 }
+ if {[lsearch -nocase $argv "-x"] >= 0} { set schedtime 7200 }
}
}
@@ -61,11 +60,11 @@ proc register_statusop {op name icon} {
eval_plugins status 1
proc get_data {} {
- global pid exts
+ global pid exts stream tsr tsrcnt
set ret {}
if {[catch {set data \
- [exec /mod/webif/lib/bin/lsof -X -Fns -p $pid]} msg]} {
+ [exec /mod/webif/lib/bin/lsof -Fnsa -p $pid]} msg]} {
debug "Error: $msg"
set ret {}
} else {
@@ -73,35 +72,64 @@ proc get_data {} {
foreach line [split $data "\n"] {
set typ [string index $line 0]
switch $typ {
+ a {
+ set access [string index $line 1]
+ }
s {
set size [string range $line 1 end]
}
n {
- if {[string first Video/ $line] == -1 && \
- [string first /media/ $line] == -1} {
+ # strip initial n and trailing " (...)" if
+ # present
+ regsub -all -- {(^n)|( \([^\)]+\)$)} \
+ $line "" line
+ set file [subst -nocommands -novariables $line]
+ set ext [file extension $line]
+ # Note but skip TSR buffers
+ if {[file rootname $file] eq $tsr} {
+ if {$ext eq ".nts"} {
+ incr tsrcnt
+ }
continue
}
- regsub -- { \([^\)]+\)$} $line "" line
- set ext [file extension $line]
- if {$ext ni $exts} continue
- set file [subst -nocommands -novariables \
- [string range $line 1 end]]
- # Skip HD-Fox TSR buffer
- if {$file eq "/media/drive1/.tsr/0.ts"} {
+
+ if {[string first Video/ $line] >= 0 ||
+ [string first /media/ $line] >= 0} {
+ if {$ext ni $exts} {
+ continue
+ }
+ } elseif {[string first $line /] >= 0} {
+ # fast skip other files
+ continue
+ } elseif {[regexp -- {[A-Za-z0-9._-]+:([0-9]+)->([A-Za-z0-9._-]+):([0-9]+)} $line _ sprt host dprt]} {
+ if {$sprt == 9000} {
+ incr stream
+ continue
+ } elseif {$dprt == 9000} {
+ set file [\
+ format "DLNA from %s" $host]
+ set size 0
+ set ext ""
+ } else {
+ continue
+ }
+ } else {
continue
}
# Handle chase play (same file open twice
# and recently written)
- if {[dict exists $ret $file] && \
+ if {[dict exists $ret $file] &&
$ext eq ".ts"} {
- set age [expr [clock seconds] - \
- [file mtime $file]]
+ set age [expr [clock seconds] \
+ - [file mtime $file]]
if {$age < 60} {
- set ret($file) -1
+ set access [lindex \
+ [dict get $ret $file] 1]
+ set ret($file) [list -1 $access]
}
- } else {
- debug "$file = $size"
- set ret($file) $size
+ } else {
+ debug "$file = $size,$access"
+ set ret($file) [list $size $access]
}
}
}
@@ -109,11 +137,9 @@ proc get_data {} {
}
foreach file [dict keys $::ops] {
if {![dict exists $ret $file]} {
- if {[file exists $file]} {
- set ret($file) [file size $file]
- } else {
- set ret($file) 0
- }
+ set sz 0
+ if {[file exists $file]} { set sz [file size $file] }
+ set ret($file) [list $sz u]
}
}
return $ret
@@ -139,9 +165,12 @@ proc add_output {icon mode name} {
set play 0
set rec 0
+set stream 0
set output {}
set ops {}
set model [system model]
+set tsr [file rootname [system tsr]]
+set tsrcnt 0
foreach opfile [glob -nocomplain -directory /tmp -tails -- ".bgop.*"] {
set op [string range $opfile 6 end]
@@ -179,8 +208,9 @@ if {[llength $data]} {
debug " NDATA: ($ndata)"
set rr 0
}
+ set bnames [lsort [lmap x [array names data] { file tail $x }]]
foreach file [array names data] {
- set bname [file rootname [file tail $file]]
+ set bname [file tail $file]
set name [string map {
"/mnt/hd2/My Video/" ""
@@ -189,17 +219,22 @@ if {[llength $data]} {
".ts" ""
} $file]
- if {$data($file) == -1} {
+ if {[lindex $data($file) 0] == -1} {
set mode chase
} elseif {$rr} {
if {$file in $recs} {
set mode rec
+ } elseif {[llength [\
+ lsearch -all $bnames $bname]] == 2} {
+ # two different files having same file.ext open
+ set mode copy
} else {
set mode play
}
} else {
if {![dict exists $ndata $file]} continue
- if {$ndata($file) > $data($file)} {
+ if {[lindex $ndata($file) 0] > \
+ [lindex $data($file) 0]} {
set mode rec
} else {
set mode play
@@ -231,8 +266,20 @@ if {[llength $data]} {
}
play {
incr play
- set mode "Playing"
- set icon "745_1_10_Video_2Live.png"
+ if {$play > $stream} {
+ set mode "Playing"
+ set icon "745_1_10_Video_2Live.png"
+ } else {
+ set mode "Streaming"
+ set icon "/img/dlna.png"
+ }
+ }
+ copy {
+ if {[lindex $data($file) 1] ne "r"} {
+ continue
+ }
+ set mode "Copying"
+ set icon "/img/dlna.png"
}
default {
if {[dict exists $statusops $mode]} {
@@ -272,23 +319,33 @@ if {![system instandby] && $play < 1} {
if {[llength $epgs] == 1} {
lassign $epgs epg
set prog "- [$epg get name] ("
- append prog "[clock format [$epg get start] -format %H:%M] - "
- append prog "[clock format $([$epg get start] + [$epg get duration]) -format %H:%M]"
+ append prog "[clock format [\
+ $epg get start] -format %H:%M] - "
+ append prog "[clock format $([$epg get start] \
+ + [$epg get duration]) -format %H:%M]"
append prog ") \[[$epg percent]%\]"
}
- if {$runmode eq "cgi"} {
- set s "
-
- [epg channelicon $name 30 \
- {vertical-align: middle; padding: 0 4px 0 2px}]
- Watching $lcn: $name $prog
- "
- append s ""
- lappend output $s
+ # 0 => no TSR; >=2 => TSR
+ if {$tsrcnt == 0 || $tsrcnt == 2} {
+ set s "Watching"
+ } elseif {$tsrcnt == 3} {
+ set s "Watching (delayed)"
} else {
- set s "Watching $lcn: $name $prog"
- lappend output $s
+ debug "tsrcnt=$tsrcnt"
+ set s "Not watching"
+ }
+ if {$runmode eq "cgi"} {
+ lappend output [format "
+
+ [epg channelicon %s 30 \
+ {vertical-align: middle; padding: 0 4px 0 2px}]
+ %s %s: %s %s
+
+ " $name $s $lcn $name $prog]
+ } else {
+ lappend output [format "%s %s: %s %s" \
+ $s $lcn $name $prog]
}
}
}
@@ -314,7 +371,7 @@ if {[system instandby]} {
# Upcoming recordings
set events [rsv list tbl_reservation \
- " where ersvtype = 3 and nsttime - [clock seconds] < $schedtime
+ " where ersvtype = 3 and nsttime - [clock seconds] < $schedtime
and nsttime > [clock seconds] "]
foreach event $events {
if {$runmode eq "cgi"} {
diff --git a/webif/html/browse/assets.jim b/webif/html/browse/assets.jim
index d08b4f4..0fc652b 100755
--- a/webif/html/browse/assets.jim
+++ b/webif/html/browse/assets.jim
@@ -103,6 +103,8 @@ if {[llength $plugins(dmenu)]} {
}
}
+# the maxlength values for title and synopsis are 1 less than the maximum to
+# allow for an extra byte to indicate character encoding (see rename.jim)
puts {
@@ -131,20 +133,51 @@ puts {
|
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
|
-
+ |
|
diff --git a/webif/html/browse/bookmarks/index.jim b/webif/html/browse/bookmarks/index.jim
index b12c937..f81650d 100755
--- a/webif/html/browse/bookmarks/index.jim
+++ b/webif/html/browse/bookmarks/index.jim
@@ -2,7 +2,7 @@
package require cgi
source /mod/webif/lib/setup
-require ts.class pretty_size
+require ts.class system.class pretty_size
jscss script.js style.css
jqplugin touchpunch
@@ -15,6 +15,10 @@ set erfile [string map {' \\'} $rfile]
set len [$ts duration 1]
+set start -1
+set incr 1
+set limit $(1-$start)
+
puts "