forked from hummypkg/webif
d3e7adfd1f
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif@161 2a923420-c742-0410-a762-8d5b09965624
48 lines
1.0 KiB
Plaintext
Executable File
48 lines
1.0 KiB
Plaintext
Executable File
#!/mod/bin/jimsh
|
|
|
|
set pid [exec pgrep humaxtv]
|
|
|
|
if {[catch {set data [exec lsof -p $pid | grep Video | fgrep .ts]} ]} {
|
|
exit
|
|
}
|
|
|
|
set lines [split $data "\n"]
|
|
foreach line $lines {
|
|
regsub -all -- {[[:space:]]+} $line " " line
|
|
set fields [split $line " "]
|
|
set name [lindex [split $line "/"] end]
|
|
set size($name) [lindex $fields 6]
|
|
set seen($name) 0
|
|
}
|
|
|
|
sleep 2
|
|
|
|
set data [exec lsof -p $pid | grep Video | fgrep .ts]
|
|
regsub -all -- {[[:space:]]+} $line " " line
|
|
set lines [split $data "\n"]
|
|
foreach line $lines {
|
|
regsub -all -- {[[:space:]]+} $line " " line
|
|
set fields [split $line " "]
|
|
set name [lindex [split $line "/"] end]
|
|
set size2 [lindex $fields 6]
|
|
|
|
if { $size2 > $size($name) && $seen($name) < 1 } {
|
|
set mode "Recording"
|
|
set icon "745_1_11_Video_1REC.png"
|
|
} else {
|
|
set mode "Watching"
|
|
set icon "745_1_10_Video_2Live.png"
|
|
}
|
|
|
|
incr seen($name)
|
|
|
|
lappend output "<img src=/images/$icon>$mode $name"
|
|
}
|
|
|
|
if {[llength $output]} {
|
|
puts "Content-Type: text/html"
|
|
puts ""
|
|
puts [join $output "<br>\n"]
|
|
}
|
|
|