diff --git a/var/mongoose/cgi-bin/browse/audio.jim b/var/mongoose/cgi-bin/browse/audio.jim
deleted file mode 100755
index 959164e..0000000
--- a/var/mongoose/cgi-bin/browse/audio.jim
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/mod/bin/jimsh
-
-package require sqlite3
-package require cgi
-source /mod/var/mongoose/lib/setup
-require ts.class system.class
-
-puts "Content-Type: text/html\r\n\r\n"
-
-cgi_input
-#cgi_dump
-
-set rfile [cgi_get file]
-set ts [ts fetch $rfile]
-set dir [file dirname $rfile]
-set len [$ts duration 1]
-
-if {[cgi_get do] eq "it"} {
- set xstart [clock milliseconds]
-
- set base [file rootname $rfile]
- set shname [file tail $base]
- puts "Processing $shname"
-
- puts [exec /mod/bin/ffmpeg -y -benchmark -v 0 \
- -i $rfile -f mp3 \
- -vn -acodec copy "${base}.mp3"]
-
- if {[system pkginst id3v2]} {
- puts [exec /mod/bin/id3v2 \
- --song "[$ts get title]" \
- --comment "[$ts get synopsis]" \
- --album "[$ts get channel_name]" \
- --year "[clock format [$ts get start] -format {%Y}]" \
- "${base}.mp3"]
- }
-
- set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
- puts "Time taken: $xtime"
-
- exit
-}
-
-header
-
-puts "
-
-
-
-
-File: $rfile
-Length: [clock format $len -format "%T"]
-
-"
-
-puts {
-
-
-Perform audio extraction
-
-Extracting audio:
-}
-puts "
Back to media list "
-puts {
-
-
-
-
-
-
-}
-
diff --git a/var/mongoose/cgi-bin/browse/audio/audio.jim b/var/mongoose/cgi-bin/browse/audio/audio.jim
new file mode 100755
index 0000000..88667ce
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/audio/audio.jim
@@ -0,0 +1,52 @@
+#!/mod/bin/jimsh
+
+package require sqlite3
+package require cgi
+source /mod/var/mongoose/lib/setup
+require ts.class system.class
+
+puts "Content-Type: text/html\r\n\r\n"
+
+cgi_input
+#cgi_dump
+
+set rfile [cgi_get file]
+set ts [ts fetch $rfile]
+set dir [file dirname $rfile]
+set len [$ts duration 1]
+
+header
+
+puts "
+
+
+
+
+
+Audio Extraction
+
+
+File: $rfile
+Length: [clock format $len -format "%T"]
+
+
+
+
+
+Perform audio extraction
+
+
+
+
+Back to media list
+
+
+
+
+"
+
diff --git a/var/mongoose/cgi-bin/browse/audio/audio.js b/var/mongoose/cgi-bin/browse/audio/audio.js
new file mode 100755
index 0000000..61585a7
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/audio/audio.js
@@ -0,0 +1,35 @@
+
+var handle = 0;
+
+function update()
+{
+ $.get('progress.jim?file=' + $('#params').attr('rfile'),
+ function(data) {
+ if (handle)
+ $('#progressbar').reportprogress(data);
+ });
+}
+
+$(document).ready(function() {
+
+$('#progressbar').reportprogress(0);
+
+$('#back').button().click(function() {
+ window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
+});
+
+$('#audioit').button().click(function() {
+ $('#audiodiv').hide('slow');
+ $('#progressdiv').show('slow');
+ handle = setInterval("update()", 1000);
+ $('#output').load('execute.jim?file=' + $('#params').attr('rfile'),
+ function() {
+ clearInterval(handle);
+ handle = 0;
+ $('#back').show();
+ $('#progressbar').reportprogress(100);
+ });
+});
+
+});
+
diff --git a/var/mongoose/cgi-bin/browse/audio/execute.jim b/var/mongoose/cgi-bin/browse/audio/execute.jim
new file mode 100755
index 0000000..483e4af
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/audio/execute.jim
@@ -0,0 +1,39 @@
+#!/mod/bin/jimsh
+
+package require sqlite3
+package require cgi
+source /mod/var/mongoose/lib/setup
+require ts.class system.class
+
+puts "Content-Type: text/html\r\n\r\n"
+
+cgi_input
+#cgi_dump
+
+set rfile [cgi_get file]
+set ts [ts fetch $rfile]
+set dir [file dirname $rfile]
+set len [$ts duration 1]
+
+set xstart [clock milliseconds]
+
+set base [file rootname $rfile]
+set shname [file tail $base]
+puts "Processing $shname"
+
+puts [exec /mod/bin/ffmpeg -y -benchmark -v 0 \
+ -i $rfile -f mp3 \
+ -vn -acodec copy "${base}.mp3"]
+
+if {[system pkginst id3v2]} {
+ puts [exec /mod/bin/id3v2 \
+ --song "[$ts get title]" \
+ --comment "[$ts get synopsis]" \
+ --album "[$ts get channel_name]" \
+ --year "[clock format [$ts get start] -format {%Y}]" \
+ "${base}.mp3"]
+}
+
+set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
+puts "Time taken: $xtime"
+
diff --git a/var/mongoose/cgi-bin/browse/audio_progress.jim b/var/mongoose/cgi-bin/browse/audio/progress.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/audio_progress.jim
rename to var/mongoose/cgi-bin/browse/audio/progress.jim
diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js
index 2cdc6b4..0d7c8f8 100755
--- a/var/mongoose/cgi-bin/browse/browse.js
+++ b/var/mongoose/cgi-bin/browse/browse.js
@@ -366,7 +366,7 @@ var menuclick = function(action, el, pos)
break;
case 'crop':
- window.location.href = '/cgi-bin/browse/crop.jim?file=' +
+ window.location.href = '/cgi-bin/browse/crop/crop.jim?file=' +
file;
break;
@@ -376,12 +376,12 @@ var menuclick = function(action, el, pos)
break;
case 'decrypt':
- window.location.href = '/cgi-bin/browse/decrypt.jim?file=' +
- file;
+ window.location.href =
+ '/cgi-bin/browse/decrypt/decrypt.jim?file=' + file;
break;
case 'audio':
- window.location.href = '/cgi-bin/browse/audio.jim?file=' +
+ window.location.href = '/cgi-bin/browse/audio/audio.jim?file=' +
file;
break;
@@ -618,7 +618,7 @@ var dmenuclick = function(action, el, pos)
files.push($(this).attr('file'));
});
//console.log("%o", files);
- window.location.href = '/cgi-bin/browse/join.jim?files=' +
+ window.location.href = '/cgi-bin/browse/join/join.jim?files=' +
files.join();
});
diff --git a/var/mongoose/cgi-bin/browse/crop.jim b/var/mongoose/cgi-bin/browse/crop.jim
deleted file mode 100755
index 7b357e8..0000000
--- a/var/mongoose/cgi-bin/browse/crop.jim
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/mod/bin/jimsh
-
-package require cgi
-source /mod/var/mongoose/lib/setup
-require ts.class pretty_size
-
-puts "Content-Type: text/html\r\n\r\n"
-
-cgi_input
-#cgi_dump
-
-set rfile [cgi_get file]
-set ts [ts fetch $rfile]
-set dir [file dirname $rfile]
-
-set len [$ts duration 1]
-
-if {[cgi_get do] eq "it"} {
-
- set cropstart [clock milliseconds]
-
- set base [file rootname $rfile]
- set origdir "$dir/_original"
- if {![file exists $origdir]} { file mkdir $origdir }
-
- set shname [file tail $base]
- puts "Processing $shname"
-
- if {[file exists "$origdir/$shname.ts"]} {
- puts "This recording already exists within _original"
- puts "Cannot continue."
- exit
- }
-
- puts "Moving recording to $origdir"
- foreach f [glob -nocomplain "${base}.*"] {
- set tail [file tail $f]
- puts " $tail"
- file rename $f "$origdir/$tail"
- }
-
- puts [exec /mod/bin/nicesplice \
- -in "$origdir/$shname" \
- -out "$dir/$shname" \
- -cutBookMarks]
-
- set newname "$shname-[clock seconds]"
- puts "Renaming file group to $newname"
- ts renamegroup "$dir/$shname.ts" $newname
- exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
-
- set croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0]
- puts "Time taken: $croptime"
-
- exit
-}
-
-header
-
-puts "
-
-
-
-
-File: $rfile
-Length: [clock format $len -format "%T"]
-Size: [pretty_size [$ts size]] ([$ts get definition])
-Bookmarks: [$ts get bookmarks] @ "
-
-set flag 0
-foreach b [$ts bookmarks] {
- if $flag { puts -nonewline ", " }
- incr flag
- puts -nonewline [clock format $b -format "%T"]
-}
-
-puts " File "
-
-puts ""
-
-proc div {type left right} {
- set width $($right - $left)
- puts "
- $type
"
-}
-
-set keeping 0
-set last 0
-set start -1
-foreach b [$ts bookmarks] {
- if {$start < 0} {
- set start $b
- continue
- }
- set end $b
-
- incr keeping $($end - $start)
-
- set left $($start * 500 / $len)
- set right $($end * 500 / $len)
-
- div cut $last $($left - 1)
- div keep $left $($right - 1)
-
- set last $right
-
- set start -1
-}
-
-if {$start > 0} {
- incr keeping $($len - $start)
- set left $($start * 500 / $len)
- div cut $last $($left - 1)
- div keep $left 500
-} else {
- div cut $last 500
-}
-
-set keepperc $($keeping * 100.0 / $len)
-set esttime $(int($keeping * 0.025))
-if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) }
-
-puts "
-
-
-Keeping:
-[clock format $keeping -format "%T"] ([format "%.2f" $keepperc]%)
-
-Time:
-Cropping will take around [clock format $esttime -format "%T"]
-
-"
-
-puts "
-
-Perform crop operation
-
-
-Cropping:
-
Back to media list "
-puts {
-
-
-
-
-
-
-}
-
diff --git a/var/mongoose/cgi-bin/browse/crop/crop.jim b/var/mongoose/cgi-bin/browse/crop/crop.jim
new file mode 100755
index 0000000..f0c3d24
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/crop/crop.jim
@@ -0,0 +1,117 @@
+#!/mod/bin/jimsh
+
+package require cgi
+source /mod/var/mongoose/lib/setup
+require ts.class pretty_size
+
+puts "Content-Type: text/html\r\n\r\n"
+
+cgi_input
+#cgi_dump
+
+set rfile [cgi_get file]
+set ts [ts fetch $rfile]
+set dir [file dirname $rfile]
+
+set len [$ts duration 1]
+
+header
+
+puts "
+
+
+
+
+
+Crop recording
+
+
+File: $rfile
+Length: [clock format $len -format \"%T\"]
+Size: [pretty_size [$ts size]] ([$ts get definition])
+Bookmarks: [$ts get bookmarks] @ "
+
+set flag 0
+foreach b [$ts bookmarks] {
+ if $flag { puts -nonewline ", " }
+ incr flag
+ puts -nonewline [clock format $b -format "%T"]
+}
+
+puts " File "
+
+puts ""
+
+proc div {type left right} {
+ set width $($right - $left)
+ puts "
+ $type
"
+}
+
+set keeping 0
+set last 0
+set start -1
+foreach b [$ts bookmarks] {
+ if {$start < 0} {
+ set start $b
+ continue
+ }
+ set end $b
+
+ incr keeping $($end - $start)
+
+ set left $($start * 500 / $len)
+ set right $($end * 500 / $len)
+
+ div cut $last $($left - 1)
+ div keep $left $($right - 1)
+
+ set last $right
+
+ set start -1
+}
+
+if {$start > 0} {
+ incr keeping $($len - $start)
+ set left $($start * 500 / $len)
+ div cut $last $($left - 1)
+ div keep $left 500
+} else {
+ div cut $last 500
+}
+
+set keepperc $($keeping * 100.0 / $len)
+set esttime $(int($keeping * 0.025))
+if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) }
+
+puts "
+
+
+Keeping:
+[clock format $keeping -format "%T"] ([format "%.2f" $keepperc]%)
+
+Time:
+Cropping will take around [clock format $esttime -format "%T"]
+
+
+
+
+
+Perform crop operation
+
+
+
+
+Back to media list
+
+
+
+
+"
+
diff --git a/var/mongoose/cgi-bin/browse/crop/crop.js b/var/mongoose/cgi-bin/browse/crop/crop.js
new file mode 100755
index 0000000..708502a
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/crop/crop.js
@@ -0,0 +1,38 @@
+var handle = 0;
+
+function update()
+{
+ var perc = $('#params').attr('perc');
+ var file = $('#params').attr('file');
+
+ $.get('progress.jim' + '?perc=' + perc + '&file=' + file,
+ function(data) {
+ if (handle)
+ $('#progressbar').reportprogress(data);
+ });
+}
+
+$(document).ready(function() {
+
+$('#progressbar').reportprogress(0);
+
+$('#back').button().click(function() {
+ window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
+});
+
+$('#cropit').button().click(function() {
+ $('#cropdiv').hide('slow');
+ $('#progressdiv').show('slow');
+ handle = setInterval("update()", 1000);
+ $('#output').text('Please do not interrupt...')
+ .load('execute.jim?file=' + $('#params').attr('file'),
+ function() {
+ clearInterval(handle);
+ handle = 0;
+ $('#back').show();
+ $('#progressbar').reportprogress(100);
+ });
+});
+
+});
+
diff --git a/var/mongoose/cgi-bin/browse/crop/execute.jim b/var/mongoose/cgi-bin/browse/crop/execute.jim
new file mode 100755
index 0000000..581b51f
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/crop/execute.jim
@@ -0,0 +1,52 @@
+#!/mod/bin/jimsh
+
+package require cgi
+source /mod/var/mongoose/lib/setup
+require ts.class pretty_size
+
+puts "Content-Type: text/html\r\n\r\n"
+
+cgi_input
+#cgi_dump
+
+set rfile [cgi_get file]
+set ts [ts fetch $rfile]
+set dir [file dirname $rfile]
+
+set len [$ts duration 1]
+
+set cropstart [clock milliseconds]
+
+set base [file rootname $rfile]
+set origdir "$dir/_original"
+if {![file exists $origdir]} { file mkdir $origdir }
+
+set shname [file tail $base]
+puts "Processing $shname"
+
+if {[file exists "$origdir/$shname.ts"]} {
+ puts "This recording already exists within _original"
+ puts "Cannot continue."
+ exit
+}
+
+puts "Moving recording to $origdir"
+foreach f [glob -nocomplain "${base}.*"] {
+ set tail [file tail $f]
+ puts " $tail"
+ file rename $f "$origdir/$tail"
+}
+
+puts [exec /mod/bin/nicesplice \
+ -in "$origdir/$shname" \
+ -out "$dir/$shname" \
+ -cutBookMarks]
+
+set newname "$shname-[clock seconds]"
+puts "Renaming file group to $newname"
+ts renamegroup "$dir/$shname.ts" $newname
+exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
+
+set croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0]
+puts "Time taken: $croptime"
+
diff --git a/var/mongoose/cgi-bin/browse/crop_progress.jim b/var/mongoose/cgi-bin/browse/crop/progress.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/crop_progress.jim
rename to var/mongoose/cgi-bin/browse/crop/progress.jim
diff --git a/var/mongoose/cgi-bin/browse/decrypt.jim b/var/mongoose/cgi-bin/browse/decrypt.jim
deleted file mode 100755
index 458a79b..0000000
--- a/var/mongoose/cgi-bin/browse/decrypt.jim
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/mod/bin/jimsh
-
-package require sqlite3
-package require cgi
-source /mod/var/mongoose/lib/setup
-require ts.class
-
-puts "Content-Type: text/html\r\n\r\n"
-
-cgi_input
-#cgi_dump
-
-set rfile [cgi_get file]
-set ts [ts fetch $rfile]
-set dir [file dirname $rfile]
-set len [$ts duration 1]
-lassign [$ts dlnaloc] url
-
-if {[cgi_get do] eq "it"} {
- set xstart [clock milliseconds]
-
- set base [file rootname $rfile]
- set origdir "$dir/_original"
- if {![file exists $origdir]} { file mkdir $origdir }
-
- set shname [file tail $base]
- puts "Processing $shname"
-
- exec wget -O "$rfile.decrypting" $url
-
- puts "Moving recording to $origdir"
-
- foreach f [glob -nocomplain "${base}.*"] {
- if {[file extension $f] eq ".decrypting"} { continue }
- set tail [file tail $f]
- puts " $tail"
- file rename $f "${origdir}/$tail"
- }
-
- file rename "$rfile.decrypting" $rfile
-
- foreach ext {nts hmt thm} {
- set sidecar "$shname.$ext"
- if {[file exists "$origdir/$sidecar"]} {
- puts "Copying back sidecar $ext"
- file copy "$origdir/$sidecar" "$dir/$sidecar"
- }
- }
-
- if {[file exists "$dir/$shname.hmt"]} {
- exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
- }
-
- set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
- puts "Time taken: $xtime"
-
- exit
-}
-
-header
-
-puts "
-
-
-
-
-File: $rfile
-Length: [clock format $len -format "%T"]
-DLNA URL $url
-
-"
-
-if {$url eq ""} {
- puts "This file has not been indexed by the media server.
- Cannot decrypt."
- puts "Have you enabled Content Sharing in the Humax menus?"
- exit
-}
-
-puts {
-
-
-Perform decryption
-
-Decrypting:
-}
-puts "
Back to media list "
-puts {
-
-
-
-
-
-
-}
-
diff --git a/var/mongoose/cgi-bin/browse/decrypt/decrypt.jim b/var/mongoose/cgi-bin/browse/decrypt/decrypt.jim
new file mode 100755
index 0000000..5393b05
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/decrypt/decrypt.jim
@@ -0,0 +1,64 @@
+#!/mod/bin/jimsh
+
+package require sqlite3
+package require cgi
+source /mod/var/mongoose/lib/setup
+require ts.class
+
+puts "Content-Type: text/html\r\n\r\n"
+
+cgi_input
+#cgi_dump
+
+set rfile [cgi_get file]
+set ts [ts fetch $rfile]
+set dir [file dirname $rfile]
+set len [$ts duration 1]
+lassign [$ts dlnaloc] url
+
+header
+
+puts "
+
+
+
+
+
+Decrypt in-place
+
+
+File: $rfile
+Length: [clock format $len -format "%T"]
+DLNA URL $url
+
+"
+
+if {$url eq ""} {
+ puts "This file has not been indexed by the media server.
+ Cannot decrypt."
+ puts "Have you enabled Content Sharing in the Humax menus?"
+ exit
+}
+
+puts "
+
+
+
+
+Perform decryption
+
+
+
+
+Back to media list
+
+
+
+
+"
+
diff --git a/var/mongoose/cgi-bin/browse/decrypt/decrypt.js b/var/mongoose/cgi-bin/browse/decrypt/decrypt.js
new file mode 100755
index 0000000..701da58
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/decrypt/decrypt.js
@@ -0,0 +1,35 @@
+
+var handle = 0;
+
+function update()
+{
+ $.get('progress.jim?file=' + $('#params').attr('file'),
+ function(data) {
+ if (handle)
+ $('#progressbar').reportprogress(data);
+ });
+}
+
+$(document).ready(function() {
+
+$('#progressbar').reportprogress(0);
+
+$('#back').button().click(function() {
+ window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
+});
+
+$('#decryptit').button().click(function() {
+ $('#decryptdiv').hide('slow');
+ $('#progressdiv').show('slow');
+ handle = setInterval("update()", 1000);
+ $('#output').load('execute.jim?file=' + $('#params').attr('file'),
+ function() {
+ clearInterval(handle);
+ handle = 0;
+ $('#back').show();
+ $('#progressbar').reportprogress(100);
+ });
+});
+
+});
+
diff --git a/var/mongoose/cgi-bin/browse/decrypt/execute.jim b/var/mongoose/cgi-bin/browse/decrypt/execute.jim
new file mode 100755
index 0000000..a458f5b
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/decrypt/execute.jim
@@ -0,0 +1,55 @@
+#!/mod/bin/jimsh
+
+package require sqlite3
+package require cgi
+source /mod/var/mongoose/lib/setup
+require ts.class
+
+puts "Content-Type: text/html\r\n\r\n"
+
+cgi_input
+#cgi_dump
+
+set rfile [cgi_get file]
+set ts [ts fetch $rfile]
+set dir [file dirname $rfile]
+set len [$ts duration 1]
+lassign [$ts dlnaloc] url
+
+set xstart [clock milliseconds]
+
+set base [file rootname $rfile]
+set origdir "$dir/_original"
+if {![file exists $origdir]} { file mkdir $origdir }
+
+set shname [file tail $base]
+puts "Processing $shname"
+
+exec wget -O "$rfile.decrypting" $url
+
+puts "Moving recording to $origdir"
+
+foreach f [glob -nocomplain "${base}.*"] {
+ if {[file extension $f] eq ".decrypting"} { continue }
+ set tail [file tail $f]
+ puts " $tail"
+ file rename $f "${origdir}/$tail"
+}
+
+file rename "$rfile.decrypting" $rfile
+
+foreach ext {nts hmt thm} {
+ set sidecar "$shname.$ext"
+ if {[file exists "$origdir/$sidecar"]} {
+ puts "Copying back sidecar $ext"
+ file copy "$origdir/$sidecar" "$dir/$sidecar"
+ }
+}
+
+if {[file exists "$dir/$shname.hmt"]} {
+ exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
+}
+
+set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
+puts "Time taken: $xtime"
+
diff --git a/var/mongoose/cgi-bin/browse/decrypt_progress.jim b/var/mongoose/cgi-bin/browse/decrypt/progress.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/decrypt_progress.jim
rename to var/mongoose/cgi-bin/browse/decrypt/progress.jim
diff --git a/var/mongoose/cgi-bin/browse/join.jim b/var/mongoose/cgi-bin/browse/join.jim
deleted file mode 100755
index 74705de..0000000
--- a/var/mongoose/cgi-bin/browse/join.jim
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/mod/bin/jimsh
-
-package require cgi
-source /mod/var/mongoose/lib/setup
-require ts.class pretty_size
-
-puts "Content-Type: text/html\r\n\r\n"
-header
-
-cgi_input 1
-#cgi_dump
-
-puts {
-
-
-
-
-
-
-
-Drag the files below into order, enter a name for the resulting file and then
-click the Join button.
-}
-
-puts "
"
-set esize 0
-foreach file [split [cgi_get files] ","] {
- set file [cgi_unquote_input $file]
- set dir [file dirname $file]
- set ts [ts fetch $file]
- puts "
-
-
- $file ([clock format [$ts duration 1] -format "%T"])
- \[[pretty_size [$ts size]]\]
- [$ts get title]
-
- "
- incr esize [$ts size]
-}
-puts " "
-
-puts "
-
-
-
-Name for joined file:
-
-Join
-
-
-
-Joining:
-
Back to media list
-
-
-"
-
-puts {
-
-}
-
-footer
-
diff --git a/var/mongoose/cgi-bin/browse/join_backend.jim b/var/mongoose/cgi-bin/browse/join/execute.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/join_backend.jim
rename to var/mongoose/cgi-bin/browse/join/execute.jim
diff --git a/var/mongoose/cgi-bin/browse/join/join.css b/var/mongoose/cgi-bin/browse/join/join.css
new file mode 100644
index 0000000..8619fce
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/join/join.css
@@ -0,0 +1,6 @@
+#filelist { list-style-type: none; margin: 0; padding: 0; }
+#filelist li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em;
+ height: 35px; }
+#filelist li span { position: absolute; margin-left: -1.3em; }
+span.pl { padding-left: 2em; }
+
diff --git a/var/mongoose/cgi-bin/browse/join/join.jim b/var/mongoose/cgi-bin/browse/join/join.jim
new file mode 100755
index 0000000..1806f89
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/join/join.jim
@@ -0,0 +1,65 @@
+#!/mod/bin/jimsh
+
+package require cgi
+source /mod/var/mongoose/lib/setup
+require ts.class pretty_size
+
+puts "Content-Type: text/html\r\n\r\n"
+header
+
+cgi_input 1
+#cgi_dump
+
+puts "
+
+
+
+
+
+
+
+Drag the files below into order, enter a name for the resulting file and then
+click the Join button.
+"
+
+puts "
"
+set esize 0
+foreach file [split [cgi_get files] ","] {
+ set file [cgi_unquote_input $file]
+ set dir [file dirname $file]
+ set ts [ts fetch $file]
+ puts "
+
+
+ $file ([clock format [$ts duration 1] -format "%T"])
+ \[[pretty_size [$ts size]]\]
+ [$ts get title]
+
+ "
+ incr esize [$ts size]
+}
+puts " "
+
+puts "
+
+
+
+Name for joined file:
+
+Join
+
+
+
+Joining:
+
Back to media list
+
+
+"
+
+footer
+
diff --git a/var/mongoose/cgi-bin/browse/join/join.js b/var/mongoose/cgi-bin/browse/join/join.js
new file mode 100755
index 0000000..fbf080d
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/join/join.js
@@ -0,0 +1,62 @@
+
+$('#filelist li').hover(
+ function() { $(this).css('cursor', 'pointer'); },
+ function() { $(this).css('cursor', 'auto'); }
+);
+
+var handle = 0;
+
+function update()
+{
+ $.get('progress.jim'
+ + '?esize=' + $('#back').attr('esize')
+ + '&file=' + $('#back').attr('dir') + '/' + $('#dest').val(),
+ function(data) {
+ if (handle)
+ $('#progressbar').reportprogress(data);
+ });
+}
+
+$(document).ready(function() {
+
+$('#progressbar').reportprogress(0);
+
+$('#back').button().click(function() {
+ window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
+});
+
+$('#filelist').sortable().disableSelection();
+
+$('#dojoin').button().attr('disabled', true).addClass('ui-state-disabled')
+ .click(function() {
+ var files = $('#filelist').sortable('toArray');
+ var sfiles = new Array();
+ for (x in files)
+ sfiles.push(encodeURIComponent(files[x]));
+
+ $('#joindiv').hide('slow');
+ $('#progressdiv').show('slow');
+ handle = setInterval("update()", 1000);
+
+ $('#output').text('Please do not interrupt...')
+ .load('execute.jim?files=' +
+ sfiles.join() + '&dest=' + $('#dest').val(),
+ function() {
+ clearInterval(handle);
+ handle = 0;
+ $('#back').show();
+ $('#progressbar').reportprogress(100);
+ });
+});
+
+$('#dest').val('').keyup(function() {
+ if ($(this).val().length > 0)
+ $('#dojoin')
+ .removeProp('disabled').removeClass('ui-state-disabled');
+ else
+ $('#dojoin')
+ .prop('disabled', true).addClass('ui-state-disabled');
+});
+
+});
+
diff --git a/var/mongoose/cgi-bin/browse/join_progress.jim b/var/mongoose/cgi-bin/browse/join/progress.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/join_progress.jim
rename to var/mongoose/cgi-bin/browse/join/progress.jim