forked from hummypkg/webif
update to new lsof and fix things
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1949 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
68f98c8a65
commit
aeb96c2c8a
@ -1,10 +1,10 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 1.0.14-6
|
||||
Version: 1.0.14-7
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif-channelicons(>=1.1.11),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.13),hmt(>=1.1.19),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),mongoose
|
||||
Depends: webif-channelicons(>=1.1.11),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.19),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),mongoose
|
||||
Suggests:
|
||||
Description: An evolving web interface for the Humax.
|
||||
Tags: http://hummy.tv/forum/threads/5031/
|
||||
|
@ -140,3 +140,5 @@ $(document).ready(function() {
|
||||
</script>
|
||||
}
|
||||
|
||||
footer
|
||||
|
||||
|
@ -31,23 +31,39 @@ proc get_data {} {
|
||||
|
||||
set ret {}
|
||||
if {[catch {set data \
|
||||
[exec /mod/bin/lsof -p $pid | grep Video]} msg]} {
|
||||
[exec /mod/webif/lib/bin/lsof -X -Fns -p $pid]} msg]} {
|
||||
set ret {}
|
||||
} else {
|
||||
|
||||
#aw
|
||||
#s583700480
|
||||
#n/mnt/hd2/My Video/Real Lives Reunited_20140610_1002.ts
|
||||
|
||||
# Unfortunately, the access flag isn't reliable for
|
||||
# some reason. If it were, the sleep could be removed!
|
||||
|
||||
set size 0
|
||||
foreach line [split $data "\n"] {
|
||||
regsub -all -- {[[:space:]]+} $line " " line
|
||||
regsub -- { \([^\)]+\)$} $line "" line
|
||||
set file [file tail $line]
|
||||
set ext [file extension $line]
|
||||
if {$ext ni $exts} continue
|
||||
set name [file rootname $file]
|
||||
if {[dict exists $ret $name]} {
|
||||
if {$ext eq ".ts"} {
|
||||
set ret($name) -1
|
||||
set typ [string index $line 0]
|
||||
switch $typ {
|
||||
s {
|
||||
set size [string range $line 1 end]
|
||||
}
|
||||
n {
|
||||
if {[string first Video $line] == -1} {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
set size [lindex [split $line " "] 6]
|
||||
set ret($name) $size
|
||||
set ext [file extension $line]
|
||||
if {$ext ni $exts} continue
|
||||
set name [file tail [file rootname $line]]
|
||||
# Handle chase play (same file open twice)
|
||||
if {[dict exists $ret $name] && \
|
||||
$ext eq ".ts"} {
|
||||
set ret($name) -1
|
||||
} else {
|
||||
set ret($name) $size
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,15 +75,15 @@ set rec 0
|
||||
set seen {}
|
||||
set output {}
|
||||
|
||||
set data {}
|
||||
if {$type eq "full"} {
|
||||
set data [get_data]
|
||||
} else {
|
||||
set data {}
|
||||
}
|
||||
|
||||
if {[llength $data]} {
|
||||
sleep 3
|
||||
set ndata [get_data]
|
||||
# puts " DATA: ($data)"
|
||||
# puts " NDATA: ($ndata)"
|
||||
foreach name [array names ndata] {
|
||||
if {![dict exists $seen $name]} { set seen($name) 0 }
|
||||
if {![dict exists $data $name]} { set data($name) 0 }
|
||||
@ -104,6 +120,9 @@ if {[llength $data]} {
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Live viewing information
|
||||
|
||||
if {![system instandby] && $play < 1} {
|
||||
set hsvc [system param CUR_SVC Value USERCONFIG]
|
||||
|
||||
@ -144,6 +163,9 @@ if {![system instandby] && $play < 1} {
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# In standby
|
||||
|
||||
if {[system instandby]} {
|
||||
if {$runmode eq "cgi"} {
|
||||
lappend output [concat \
|
||||
@ -158,6 +180,9 @@ if {[system instandby]} {
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Upcoming recordings
|
||||
|
||||
set events [rsv list tbl_reservation \
|
||||
" where ersvtype = 3 and nsttime - [clock seconds] < $schedtime
|
||||
and nsttime > [clock seconds] "]
|
||||
@ -181,6 +206,9 @@ foreach event $events {
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Output
|
||||
|
||||
if {[llength $output]} {
|
||||
if {$runmode eq "cgi"} {
|
||||
puts [join $output "\n<br>\n"]
|
||||
|
@ -93,7 +93,7 @@ set dircount 0
|
||||
set filecount 0
|
||||
|
||||
proc entry {file} {{i 0}} {
|
||||
global dircount filecount
|
||||
global dircount filecount dinuse
|
||||
|
||||
set bfile [file tail $file]
|
||||
regsub -all " +" $bfile "" tbfile
|
||||
@ -174,7 +174,7 @@ proc entry {file} {{i 0}} {
|
||||
set dlna 0
|
||||
set shrunk 0
|
||||
if {$type eq "ts"} {
|
||||
if {[$ts inuse]} {
|
||||
if {$bfile in $dinuse} {
|
||||
icon "/img/inuse.png"
|
||||
}
|
||||
set genre [$ts get genre]
|
||||
@ -322,6 +322,7 @@ switch $order {
|
||||
default { set files [lsort -nocase $files] }
|
||||
}
|
||||
|
||||
set dinuse [system dirinuse $dir]
|
||||
foreach file $files { entry "$dir/$file" }
|
||||
|
||||
puts "
|
||||
|
6
webif/lib/bin/lsof
Executable file
6
webif/lib/bin/lsof
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# stderr is always unbuffered so use that...
|
||||
/mod/bin/lsof "$@" 2>&1
|
||||
exit 0
|
||||
|
@ -218,7 +218,8 @@ proc {system busy} {} {
|
||||
return 0
|
||||
}
|
||||
set c 0
|
||||
foreach line [split [exec /mod/bin/lsof -p $pid] "\n"] {
|
||||
foreach line [split [\
|
||||
exec /mod/webif/lib/bin/lsof -X -Fn -p $pid] "\n"] {
|
||||
if {[string match {*Video*.ts} $line]} { incr c }
|
||||
}
|
||||
if {$c > 0} { return 1 }
|
||||
@ -226,23 +227,22 @@ proc {system busy} {} {
|
||||
}
|
||||
|
||||
proc {system inuse} {file} {
|
||||
# Is anything using the file?
|
||||
set file [file rootname [file tail $file]]
|
||||
|
||||
# Escape any unicode characters to match lsof output.
|
||||
foreach range [lreverse [\
|
||||
regexp -inline -indices -all -- {[\x80-\xff]} $file]] {
|
||||
set i [lindex $range 0]
|
||||
binary scan [string index $file $i] H2 hex
|
||||
set file [string replace $file $i $i "\\x$hex"]
|
||||
set op [exec /mod/webif/lib/bin/lsof -X -Fn $file]
|
||||
if {$op eq ""} {
|
||||
return 0
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
set c 0
|
||||
foreach line [split [exec /mod/bin/lsof] "\n"] {
|
||||
if {[string first $file $line] >= 0} { incr c }
|
||||
proc {system dirinuse} {dir} {
|
||||
set files {}
|
||||
foreach line [split [\
|
||||
exec /mod/webif/lib/bin/lsof -X -Fn +d $dir] "\n"] {
|
||||
if {[string index $line 0] ne "n"} continue
|
||||
lappend files [file tail $line]
|
||||
}
|
||||
if {$c > 0} { return 1 }
|
||||
return 0
|
||||
return $files
|
||||
}
|
||||
|
||||
proc {system reboot} {} {
|
||||
|
@ -58,8 +58,7 @@ ts method lastmod {} {
|
||||
}
|
||||
|
||||
ts method inuse {} {
|
||||
if {[system inuse [file rootname $file]]} { return 1 }
|
||||
return 0
|
||||
return [system inuse $file]
|
||||
}
|
||||
|
||||
ts method bookmarks {} {
|
||||
|
Loading…
Reference in New Issue
Block a user