forked from hummypkg/webif
4e42dcf655
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@211 2a923420-c742-0410-a762-8d5b09965624
35 lines
638 B
Plaintext
Executable File
35 lines
638 B
Plaintext
Executable File
#!/mod/bin/jimsh
|
|
|
|
package require cgi
|
|
package require pack
|
|
|
|
puts "Content-Type: application/json"
|
|
puts ""
|
|
|
|
cgi_input
|
|
#cgi_dump
|
|
|
|
#set _cgi(dir) "/media/My Video"
|
|
|
|
set root [dict get $_cgi dir]
|
|
# Strip double slashes
|
|
regsub -all -- {\/+} "$root/*" "/" root
|
|
|
|
puts "{"
|
|
foreach dir [glob -nocomplain "$root"] {
|
|
if {[file exists "$dir/.series"]} {
|
|
set fd [open "$dir/.series"]
|
|
set bytes [read $fd 8]
|
|
set recs [unpack $bytes -uintle 0 32]
|
|
set plays [unpack $bytes -uintle 32 32]
|
|
set diff $($recs - $plays)
|
|
if {$diff != 0} {
|
|
set node [lindex [split $dir /] end]
|
|
puts "\"$node\": $diff,"
|
|
}
|
|
}
|
|
}
|
|
puts "\"dummy\" : 0"
|
|
puts "}"
|
|
|