webif/var/mongoose/cgi-bin/browse/resetnew.jim
hummypkg 2ab6f7caa2 0.12.0
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1398 2a923420-c742-0410-a762-8d5b09965624
2013-02-09 22:46:15 +00:00

46 lines
843 B
Plaintext
Executable File

#!/mod/bin/jimsh
package require cgi
package require pack
source /mod/webif/lib/setup
require ts.class hexdump
httpheader
set dir [cgi_get dir]
if {![file isdirectory $dir]} { exit }
if {![file exists "$dir/.series"]} { exit }
set tot 0
set watched 0
foreach file [readdir -nocomplain $dir] {
if {![string match {*.ts} $file]} { continue }
#puts "FILE: $file"
incr tot
if {[set ts [ts fetch "$dir/$file"]] != 0} {
if {![$ts flag "New"]} { incr watched }
}
}
set fd [open "$dir/.series"]
set bytes [read $fd]
close $fd
set recs [unpack $bytes -uintle 0 32]
set played [unpack $bytes -uintle 32 32]
puts "Current: $played/$recs"
#hexdump $bytes
puts "Calculated: $watched/$tot"
pack bytes $tot -intle 32 0
pack bytes $watched -intle 32 32
#hexdump $bytes
set fd [open "$dir/.series" "w"]
puts -nonewline $fd $bytes
close $fd