diff --git a/CONTROL/control b/CONTROL/control
index 953dd1fe..adee78d4 100644
--- a/CONTROL/control
+++ b/CONTROL/control
@@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
-Version: 0.9.6
+Version: 0.9.6-2
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons,mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.6),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.1)
diff --git a/var/mongoose/cgi-bin/backup/restore.jim b/var/mongoose/cgi-bin/backup/restore.jim
index 5b01a43b..533ecd21 100755
--- a/var/mongoose/cgi-bin/backup/restore.jim
+++ b/var/mongoose/cgi-bin/backup/restore.jim
@@ -53,6 +53,9 @@ foreach line $data {
lappend vars $f [lindex $vals $i]
}
+ # Don't restore DSO events.
+ if {$vars(ersvtype) == 11} { continue }
+
set rsv [rsv new $vars]
# Need to fix up channel and CRID mappings in case something has
diff --git a/var/mongoose/cgi-bin/browse/assets.jim b/var/mongoose/cgi-bin/browse/assets.jim
index 2c2ac4af..d73abda4 100755
--- a/var/mongoose/cgi-bin/browse/assets.jim
+++ b/var/mongoose/cgi-bin/browse/assets.jim
@@ -39,6 +39,7 @@ puts {
Cut to clipboard
Copy to clipboard
Rename
+ Reset new flag
}
if $flatten {
diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js
index 0f74961a..75beeb88 100755
--- a/var/mongoose/cgi-bin/browse/browse.js
+++ b/var/mongoose/cgi-bin/browse/browse.js
@@ -432,7 +432,12 @@ var dmenuclick = function(action, el, pos)
break;
case 'flat':
- var url = '/cgi-bin/browse/flat.jim?file=' + file;
+ var url = '/cgi-bin/browse/flat.jim?dir=' + file;
+ $.get(url, function() { window.location.reload(true); });
+ break;
+
+ case 'resetnew':
+ var url = '/cgi-bin/browse/resetnew.jim?dir=' + file;
$.get(url, function() { window.location.reload(true); });
break;
diff --git a/var/mongoose/cgi-bin/browse/flat.jim b/var/mongoose/cgi-bin/browse/flat.jim
index 3b83219e..33f2f37f 100755
--- a/var/mongoose/cgi-bin/browse/flat.jim
+++ b/var/mongoose/cgi-bin/browse/flat.jim
@@ -9,7 +9,7 @@ puts ""
cgi_input
#cgi_dump
-set dir [cgi_get file]
+set dir [cgi_get dir]
if {![file isdirectory $dir]} { exit }
set noflat 0
if {[string match {\[*\]} [file tail $dir]]} {
diff --git a/var/mongoose/cgi-bin/browse/new.jim b/var/mongoose/cgi-bin/browse/new.jim
index 44960094..01b6c336 100755
--- a/var/mongoose/cgi-bin/browse/new.jim
+++ b/var/mongoose/cgi-bin/browse/new.jim
@@ -1,7 +1,8 @@
#!/mod/bin/jimsh
package require cgi
-source /mod/var/mongoose/lib/ts.class
+source /mod/var/mongoose/lib/setup
+require ts.class
puts "Content-Type: text/html"
puts ""
diff --git a/var/mongoose/cgi-bin/browse/resetnew.jim b/var/mongoose/cgi-bin/browse/resetnew.jim
new file mode 100755
index 00000000..5bf9dab8
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/resetnew.jim
@@ -0,0 +1,49 @@
+#!/mod/bin/jimsh
+
+package require cgi
+package require pack
+source /mod/var/mongoose/lib/setup
+require ts.class hexdump
+
+puts "Content-Type: text/html"
+puts ""
+
+cgi_input
+#cgi_dump
+
+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
+
diff --git a/var/mongoose/cgi-bin/status.jim b/var/mongoose/cgi-bin/status.jim
index 6184f3a7..7a47aa48 100755
--- a/var/mongoose/cgi-bin/status.jim
+++ b/var/mongoose/cgi-bin/status.jim
@@ -36,6 +36,7 @@ proc get_data {} {
set play 0
set rec 0
set seen {}
+set output {}
set data [get_data]
if {[llength $data]} {
diff --git a/var/mongoose/lib/hexdump b/var/mongoose/lib/hexdump
new file mode 100644
index 00000000..aecf4610
--- /dev/null
+++ b/var/mongoose/lib/hexdump
@@ -0,0 +1,30 @@
+package require binary
+
+proc hexdump {str} {
+ set s ""
+ set addr 0
+
+ append s "[format "%07x" $addr]: "
+ set t ""
+ for {set i 0} {$i < [string length $str]} {incr i} {
+ if {$i > 0 && [expr $i % 16] == 0} {
+ append s " $t\n"
+ append s "[format "%07x" $addr]: "
+ incr addr 16
+ set t ""
+ } elseif {$i > 0 && [expr $i % 2] == 0} {
+ append s " "
+ }
+
+ set char [string index $str $i]
+ binary scan $char H2 cc
+ append s $cc
+ if {[string is print $char]} {
+ append t $char
+ } else {
+ append t "."
+ }
+ }
+ puts $s
+}
+