diff --git a/CONTROL/control b/CONTROL/control
index 8b1208b..18558f6 100644
--- a/CONTROL/control
+++ b/CONTROL/control
@@ -4,7 +4,7 @@ Section: web
Version: 0.8.2
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
-Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.7),hmt(>=1.1.1),ssmtp
+Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4-1),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.7),hmt(>=1.1.1),ssmtp
Replaces: af123-webif
Conflicts: af123-webif
Suggests: ffmpeg,webif-iphone,nicesplice
diff --git a/var/mongoose/cgi-bin/browse.jim b/var/mongoose/cgi-bin/browse.jim
index 698317e..9dbe074 100755
--- a/var/mongoose/cgi-bin/browse.jim
+++ b/var/mongoose/cgi-bin/browse.jim
@@ -7,6 +7,8 @@ require ts.class pretty_size system.class
puts "Content-Type: text/html"
puts ""
+set nicesplice [system pkginst nicesplice]
+
set ignore {.nts .thm .hmt .hmi}
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov}
@@ -162,7 +164,7 @@ puts {
if {[system model] eq "HDR"} {
puts {
Decrypt }
}
-if {[file exists /mod/bin/nicesplice]} {
+if $nicesplice {
puts { Crop }
}
puts {
@@ -271,28 +273,40 @@ foreach file [lsort [glob -nocomplain "$dir"]] {
entry $file
}
+puts "Select all | none"
+
puts ""
+puts ""
+
+puts {
+
+}
+
+# Join
+if $nicesplice {
+ puts { }
+}
+
+puts "
"
+
# De-duplicate
puts {
-
-}
-
-# Join
-if {[file exists /mod/bin/nicesplice]} {
- puts { }
+
}
# Streamer file
if {[file exists /mnt/hd3/Streamer_down_file]} {
- puts {
-
-}
+ puts {
+
+ }
}
+puts "
"
+
footer
diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js
index 16294a3..33b10d7 100755
--- a/var/mongoose/cgi-bin/browse/browse.js
+++ b/var/mongoose/cgi-bin/browse/browse.js
@@ -1,3 +1,23 @@
+(function($)
+{
+ $.fn.enable = function()
+ {
+ return this.each(function() {
+ $(this)
+ .removeClass('ui-state-disabled')
+ .removeProp('disabled');
+ });
+ };
+
+ $.fn.disable = function()
+ {
+ return this.each(function() {
+ $(this)
+ .addClass('ui-state-disabled')
+ .prop('disabled', true);
+ });
+ };
+})(jQuery);
function epginfo_callback(data, status, xhr)
{
@@ -343,9 +363,16 @@ var menuclick = function(action, el, pos)
encodeURIComponent($('#save_stream').attr('file')));
});
- $('#join').button()
- .prop('disabled', true)
- .addClass('ui-state-disabled')
+ $('#selectall').click(function(e) {
+ e.preventDefault();
+ $('input.fs').attr('checked', true).trigger('change');
+ });
+ $('#deselectall').click(function(e) {
+ e.preventDefault();
+ $('input.fs:checked').attr('checked', false).trigger('change');
+ });
+
+ $('#join').button().disable()
.click(function() {
var files = new Array();
var els = $('input.fsts:checked + a').each(function() {
@@ -356,17 +383,25 @@ var menuclick = function(action, el, pos)
files.join();
});
+ $('#delete').button().disable()
+ .click(function() {
+ console.log("delete");
+ });
+
$('input.fs').change(function() {
+ var num = $('input.fs:checked').size();
+ if (num > 0)
+ $('#delete').enable();
+ else
+ $('#delete').disable();
+
var num = $('input.fsts:checked').size();
if (num > 1)
- $('#join')
- .removeProp('disabled')
- .removeClass('ui-state-disabled');
+ $('#join').enable();
else
- $('#join')
- .prop('disabled', true)
- .addClass('ui-state-disabled');
+ $('#join').disable();
});
+
});
diff --git a/var/mongoose/cgi-bin/browse/join.jim b/var/mongoose/cgi-bin/browse/join.jim
index 61dfd12..152292b 100755
--- a/var/mongoose/cgi-bin/browse/join.jim
+++ b/var/mongoose/cgi-bin/browse/join.jim
@@ -7,7 +7,7 @@ require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
header
-cgi_input
+cgi_input 1
#cgi_dump
puts {
@@ -19,43 +19,110 @@ puts {
span.pl { padding-left: 2em; }
+
+
+
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 {
+puts "
+
+
Name for joined file:
-
+
-
+
+Joining:
+
+
+
+"
+puts {
}
diff --git a/var/mongoose/cgi-bin/browse/join_backend.jim b/var/mongoose/cgi-bin/browse/join_backend.jim
index f026cd0..a873222 100755
--- a/var/mongoose/cgi-bin/browse/join_backend.jim
+++ b/var/mongoose/cgi-bin/browse/join_backend.jim
@@ -6,22 +6,27 @@ require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
-cgi_input
+cgi_input 1
#cgi_dump
set joinstart [clock milliseconds]
set cmd {/mod/bin/nicesplice}
+set dst [file rootname [cgi_get dest "joined"]]
foreach file [split [cgi_get files] ","] {
+ set file [cgi_unquote_input $file]
lappend cmd "-in" [file rootname $file]
set dir [file dirname $file]
}
-lappend cmd "-out" "$dir/[cgi_get dest]"
+lappend cmd "-out" "$dir/$dst"
puts "($cmd)"
puts [exec {*}$cmd]
+set ts [ts fetch "$dir/$dst.ts"]
+$ts settitle $dst
+
set jointime [expr [expr [clock milliseconds] - $joinstart] / 1000.0]
puts "Time taken: $jointime"
diff --git a/var/mongoose/cgi-bin/browse/join_progress.jim b/var/mongoose/cgi-bin/browse/join_progress.jim
new file mode 100755
index 0000000..53d2284
--- /dev/null
+++ b/var/mongoose/cgi-bin/browse/join_progress.jim
@@ -0,0 +1,23 @@
+#!/mod/bin/jimsh
+
+package require cgi
+#source /mod/var/mongoose/lib/setup
+
+puts "Content-Type: text/html\r\n\r\n"
+
+cgi_input
+#cgi_dump
+
+set expected [cgi_get esize 1]
+set file [file normalize [cgi_get file]]
+
+if {![file exists $file]} {
+ puts "0"
+} else {
+ set sz [file size $file]
+
+ set perc [expr $sz * 100 / $expected]
+ if {$perc > 100} { set perc 100 }
+ puts $perc
+}
+
diff --git a/var/mongoose/lib/system.class b/var/mongoose/lib/system.class
index 1449260..d4f3988 100644
--- a/var/mongoose/lib/system.class
+++ b/var/mongoose/lib/system.class
@@ -37,6 +37,11 @@ proc {system pkgver} {{pkg webif}} {
return [lrange [split [exec opkg list-installed $pkg] " "] 2 end]
}
+proc {system pkginst} {pkg} {
+ if {[exec opkg list-installed $pkg] ne ""} {
+ return 1 } else { return 0 }
+}
+
proc {system mediaroot} {} {
switch [system model] {
HDR { return "/media/My Video" }