add thumbnail generation/display

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1442 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg
2013-03-07 23:37:56 +00:00
parent 9d3e52edd3
commit ccf3cc1888
11 changed files with 93 additions and 3 deletions

View File

@@ -23,8 +23,12 @@ if {[system pkginst ffmpeg]} {
puts {
<li class=mp3><a href=#audio>Extract Audio</a></li>
<li class=mpg><a href=#mpg>Extract to MPG</a></li>
<li class=thm><a href=#thm>Set Thumbnail</a></li>
}
}
puts { <li><a href=#vthm>View Thumbnail</a></li> }
if $nicesplice {
puts {
<li class="cut"><a href=#crop>Crop</a></li>

View File

@@ -0,0 +1,19 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require cat
set file [cgi_get file]
set file "[file rootname $file].thm"
if {![file exists $file]} {
httpheader "text/plain"
puts "No such file, $file"
exit
}
httpheader "image/bmp"
cat "/mod/webif/lib/bmpheader"
cat $file

View File

@@ -96,11 +96,13 @@ proc entry {file} {{i 0}} {
set base [file rootname $file]
set thmok 0
if {$ext eq ".ts" && [file exists "${base}.nts"]} {
set type ts
set ts [ts fetch $file 1]
set img Video_TS
set omenu opt
if {[file exists "${base}.thm"]} { set thmok 1 }
} elseif {$ext eq ".hmt"} {
if {[file exists "${base}.ts"]} { continue }
# Sole hmt file indicates failure to track.
@@ -221,7 +223,7 @@ proc entry {file} {{i 0}} {
<img class=\"$omenu va\" border=0 width=45 type=$type did=$i
locked=$locked encd=$encd def=$def new=$new bx=$bx
shrunk=$shrunk rsize=$rsz
odencd=$odencd dlna=$dlna
odencd=$odencd dlna=$dlna thmok=$thmok
src=/images/181_1_00_Help5_OPT_Plus.png>
</a>
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>

View File

@@ -178,6 +178,20 @@ function new_callback(file, type, id)
$.get(url, function() { window.location.reload(true); });
}
function thumbnail_callback(file, type, id)
{
var el = 'div.bf#' + id;
var results = el + ' .results';
$(results)
.html('<img src=/img/loading.gif>Generating thumbnail, ' +
'please wait...')
.slideDown('slow')
.load('/browse/thumbnail.jim?file=' + file)
.delay(3000)
.slideUp('slow');
$('div.bf#' + id + ' img.opt').attr('thmok', 1);
}
function rename_submit()
{
var s = $('#renameform_form').serialize();
@@ -257,6 +271,16 @@ function preparemenu(el, menu)
else
$(menu).disableContextMenuItems('#crop');
if (el.attr('bx') > 0 && el.attr('odencd') == 0)
$(menu).enableContextMenuItems('#thm');
else
$(menu).disableContextMenuItems('#thm');
if (el.attr('thmok') == 1)
$(menu).enableContextMenuItems('#vthm');
else
$(menu).disableContextMenuItems('#vthm');
$(menu).enableContextMenuItems('#strip');
if (el.attr('rsize') > 4294967296)
@@ -424,6 +448,17 @@ var menuclick = function(action, el, pos)
$('#renameform').dialog('open');
break;
case 'thm':
confirm_action('re-generate the thumbnail for',
thumbnail_callback, file, dir, id);
break;
case 'vthm':
window.open('/browse/bmp.jim?file=' + file, 'hxwebifbmp',
'height=78,width=140,toolbar=no,' +
'scrollbars=no,menubar=no,location=no,titlebar=no');
break;
case 'download':
window.location.href = '/browse/download.jim?file=' +
file + '&base=' +

View File

@@ -0,0 +1,13 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require ts.class
httpheader
set file [cgi_get file]
if {![catch {set ts [ts fetch $file]}]} {
$ts mkthm
}

View File

@@ -72,5 +72,6 @@
.contextMenu LI.mpg A { background-image: url(/img/context/mpg.png); }
.contextMenu LI.mp3 A { background-image: url(/img/context/mp3.png); }
.contextMenu LI.clock A { background-image: url(/img/context/clock.png); }
.contextMenu LI.thm A { background-image: url(/img/context/thumb.png); }

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B