diff --git a/CONTROL/control b/CONTROL/control
index a4fb4a8..ad7de5a 100644
--- a/CONTROL/control
+++ b/CONTROL/control
@@ -1,9 +1,9 @@
Package: webif
Priority: optional
Section: web
-Version: 0.9.5
+Version: 0.9.5-1
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
+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)
Suggests: ffmpeg,webif-iphone
Description: An evolving web interface for the Humax.
diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js
index 350724d..0f74961 100755
--- a/var/mongoose/cgi-bin/browse/browse.js
+++ b/var/mongoose/cgi-bin/browse/browse.js
@@ -582,7 +582,7 @@ var dmenuclick = function(action, el, pos)
// Buttons
$('#dedup').button().click(function() {
- window.location = '/cgi-bin/dedup.jim?dir='
+ window.location = '/dedup/dedup.jim?dir='
+ encodeURIComponent(dir);
});
diff --git a/var/mongoose/html/dedup/dedup b/var/mongoose/html/dedup/dedup
new file mode 100755
index 0000000..2197d09
--- /dev/null
+++ b/var/mongoose/html/dedup/dedup
@@ -0,0 +1,74 @@
+#!/mod/bin/jimsh
+
+source /mod/var/mongoose/lib/setup
+require ts.class
+
+source /mod/var/mongoose/html/dedup/normalise.jim
+source /mod/var/mongoose/html/dedup/process.jim
+
+set dirs {}
+
+set doit 0
+foreach arg $argv {
+ if {$arg eq "-yes"} {
+ set doit 1
+ } else {
+ lappend dirs $arg
+ }
+}
+if {![llength $dirs]} { lappend dirs [exec pwd] }
+
+foreach dir $dirs {
+ if {[string index $dir end] eq "/"} {
+ set dir [string range $dir 0 end-1]
+ }
+ puts "\[$dir\]"
+
+ foreach file [readdir $dir] {
+ if {[file extension $file] ne ".hmt"} { continue }
+
+ set file "$dir/$file"
+
+ set base [file tail [file rootname $file]]
+ lassign [dedupprocess $file] stat ts syn fn
+
+ puts -nonewline "$base -> "
+
+ switch $stat {
+ dup {
+ puts -nonewline "Duplicate"
+ if {$doit} {
+ set dupdir "$dir/_duplicates"
+ if {![file exists $dupdir]} {
+ file mkdir $dupdir
+ }
+ while {[file exists $dupdir/$fn.hmt]} {
+ append fn "~"
+ }
+ ts renamegroup $file "_duplicates/$fn"
+ puts -nonewline " - Renamed to _duplicates/$fn"
+ }
+ }
+ error {
+ puts -nonewline "Cannot process"
+ }
+ nothing {
+ puts -nonewline "Nothing to do"
+ }
+ preserve {
+ puts -nonewline "Preserving"
+ }
+ ok {
+ puts -nonewline $fn
+ if {$doit} {
+ # Dooooo, it.
+ $ts settitle $syn
+ ts renamegroup $file $fn
+ puts -nonewline "Done"
+ }
+ }
+ }
+ puts ""
+ }
+}
+
diff --git a/var/mongoose/cgi-bin/dedup.jim b/var/mongoose/html/dedup/dedup.jim
similarity index 53%
rename from var/mongoose/cgi-bin/dedup.jim
rename to var/mongoose/html/dedup/dedup.jim
index 4d10c59..97d6f17 100755
--- a/var/mongoose/cgi-bin/dedup.jim
+++ b/var/mongoose/html/dedup/dedup.jim
@@ -4,6 +4,9 @@ package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size altrow
+source normalise.jim
+source process.jim
+
puts "Content-Type: text/html"
puts ""
@@ -15,6 +18,8 @@ set doit [cgi_get doit 0]
header
+puts ""
+
puts "