join is working, more webif functions
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@538 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
99dde5a4a5
commit
8146627f18
@ -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
|
||||
|
@ -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 { <li class="separator"><a href=#decrypt>Decrypt</a></li> }
|
||||
}
|
||||
if {[file exists /mod/bin/nicesplice]} {
|
||||
if $nicesplice {
|
||||
puts { <li class="cut separator"><a href=#crop>Crop</a></li> }
|
||||
}
|
||||
puts {
|
||||
@ -271,28 +273,40 @@ foreach file [lsort [glob -nocomplain "$dir"]] {
|
||||
entry $file
|
||||
}
|
||||
|
||||
puts "Select <a href=# id=selectall>all</a> | <a href=# id=deselectall>none</a>"
|
||||
|
||||
puts "</fieldset>"
|
||||
|
||||
puts "<div class=brow>"
|
||||
|
||||
puts {
|
||||
<button id=delete>Delete</button>
|
||||
}
|
||||
|
||||
# Join
|
||||
if $nicesplice {
|
||||
puts { <button id=join>Join</button> }
|
||||
}
|
||||
|
||||
puts "</div><div class=brow style=\"margin-top: 3px\">"
|
||||
|
||||
# De-duplicate
|
||||
|
||||
puts {
|
||||
<small><button id=dedup>De-duplicate/tidy this folder</button></small>
|
||||
}
|
||||
|
||||
# Join
|
||||
if {[file exists /mod/bin/nicesplice]} {
|
||||
puts { <button id=join>Join</button> }
|
||||
<button id=dedup>De-duplicate/tidy this folder</button>
|
||||
}
|
||||
|
||||
# Streamer file
|
||||
|
||||
if {[file exists /mnt/hd3/Streamer_down_file]} {
|
||||
puts {
|
||||
<small><button id=save_stream file=/mnt/hd3/Streamer_down_file>
|
||||
Save last streamed content (e.g. iPlayer/YouTube)
|
||||
</button></small>
|
||||
}
|
||||
puts {
|
||||
<button id=save_stream file=/mnt/hd3/Streamer_down_file>
|
||||
Save last streamed content (e.g. iPlayer/YouTube)
|
||||
</button>
|
||||
}
|
||||
}
|
||||
|
||||
puts "</div>"
|
||||
|
||||
footer
|
||||
|
||||
|
@ -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();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
@ -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; }
|
||||
</style>
|
||||
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type="text/javascript" src="/js/jquery.progressbar.js"></script>
|
||||
|
||||
<p><b>
|
||||
Drag the files below into order, enter a name for the resulting file and then
|
||||
click the <i>Join</i> button.</b>
|
||||
}
|
||||
|
||||
puts "<ul id=filelist>"
|
||||
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 "<li class=\"va ui-state-default\" id=\"$file\"><span
|
||||
class=\"va ui-icon ui-icon-arrowthick-2-n-s\"></span>
|
||||
<img class=va src=/img/Video_TS.png>
|
||||
<span class=pl>
|
||||
$file ([clock format [$ts duration 1] -format "%T"])
|
||||
\[[pretty_size [$ts size]]\]
|
||||
<br><i style=\"font-size: 0.8em\">[$ts get title]</i>
|
||||
</span>
|
||||
</li>"
|
||||
incr esize [$ts size]
|
||||
}
|
||||
puts "</ul>"
|
||||
|
||||
puts {
|
||||
puts "
|
||||
<br><br>
|
||||
|
||||
<div id=joindiv>
|
||||
Name for joined file:
|
||||
<input id=dest name=dfile class="text ui-widget-content ui-corner-all"
|
||||
<input id=dest name=dfile class=\"text ui-widget-content ui-corner-all\"
|
||||
length=20 maxlength=50>
|
||||
<button id=dojoin>Join</button>
|
||||
</div>
|
||||
|
||||
<div id=results class=pre></div>
|
||||
<div id=progressdiv style=\"display: none\">
|
||||
Joining: <div id=progressbar></div>
|
||||
<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
esize=\"$esize\"
|
||||
style=\"display: none\">Back to media list</button>
|
||||
<div id=output class=pre style=\"margin-top: 10px\"></div>
|
||||
</div>
|
||||
"
|
||||
|
||||
puts {
|
||||
<script type=text/javascript>
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('/cgi-bin/browse/join_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().click(function() {
|
||||
|
||||
$('#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]));
|
||||
$('#results').load('/cgi-bin/browse/join_backend.jim?files=' +
|
||||
sfiles.join() + '&dest=' + $('#dest').val());
|
||||
|
||||
$('#joindiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
|
||||
$('#output').text('Please do not interrupt...')
|
||||
.load('/cgi-bin/browse/join_backend.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');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
@ -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"
|
||||
|
||||
|
23
var/mongoose/cgi-bin/browse/join_progress.jim
Executable file
23
var/mongoose/cgi-bin/browse/join_progress.jim
Executable file
@ -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
|
||||
}
|
||||
|
@ -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" }
|
||||
|
Loading…
Reference in New Issue
Block a user