2011-06-29 23:53:16 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
|
|
|
package require cgi
|
|
|
|
package require pack
|
2013-02-09 22:46:15 +00:00
|
|
|
source /mod/webif/lib/setup
|
2011-06-29 23:53:16 +00:00
|
|
|
|
2013-02-09 22:46:15 +00:00
|
|
|
httpheader "application/json"
|
2011-06-29 23:53:16 +00:00
|
|
|
|
2013-02-09 22:46:15 +00:00
|
|
|
set root [cgi_get dir]
|
2011-06-29 23:53:16 +00:00
|
|
|
# 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]
|
2013-07-30 20:07:13 +00:00
|
|
|
$fd close
|
2011-06-29 23:53:16 +00:00
|
|
|
set recs [unpack $bytes -uintle 0 32]
|
|
|
|
set plays [unpack $bytes -uintle 32 32]
|
|
|
|
set diff $($recs - $plays)
|
2013-09-25 22:41:40 +00:00
|
|
|
if {$diff > 0} {
|
2011-06-29 23:53:16 +00:00
|
|
|
set node [lindex [split $dir /] end]
|
|
|
|
puts "\"$node\": $diff,"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
puts "\"dummy\" : 0"
|
|
|
|
puts "}"
|
|
|
|
|