diff --git a/CONTROL/control b/CONTROL/control index 193bc9cd..b1398b12 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,9 +1,9 @@ Package: webif Priority: optional Section: web -Version: 0.13.3-2 +Version: 0.13.3-3 Architecture: mipsel Maintainer: af123@hummypkg.org.uk -Depends: webif-channelicons(>=1.0.4-1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.10),hmt(>=1.1.13),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05) -Suggests: ffmpeg +Depends: webif-channelicons(>=1.0.4-1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.10),hmt(>=1.1.13),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05),ffmpeg,id3v2 +Suggests: Description: An evolving web interface for the Humax. diff --git a/var/mongoose/html/browse/assets.jim b/var/mongoose/html/browse/assets.jim index f1ad784c..9831c901 100755 --- a/var/mongoose/html/browse/assets.jim +++ b/var/mongoose/html/browse/assets.jim @@ -291,5 +291,9 @@ Please wait... + + } diff --git a/var/mongoose/html/browse/file.jim b/var/mongoose/html/browse/file.jim index 0c952b80..c4990b98 100755 --- a/var/mongoose/html/browse/file.jim +++ b/var/mongoose/html/browse/file.jim @@ -23,7 +23,12 @@ if {$type eq "ts"} { - + diff --git a/var/mongoose/html/browse/script.js b/var/mongoose/html/browse/script.js index f2e33350..c05fd24d 100755 --- a/var/mongoose/html/browse/script.js +++ b/var/mongoose/html/browse/script.js @@ -271,7 +271,7 @@ function preparemenu(el, menu) else $(menu).disableContextMenuItems('#crop'); - if (el.attr('bx') > 0 && el.attr('odencd') == 0) + if (el.attr('odencd') == 0) $(menu).enableContextMenuItems('#thm'); else $(menu).disableContextMenuItems('#thm'); @@ -449,14 +449,16 @@ var menuclick = function(action, el, pos) break; case 'thm': - confirm_action('re-generate the thumbnail for', - thumbnail_callback, file, dir, id); + window.location.href = '/browse/thumbnail/index.jim?file=' + + file; 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'); +// window.open('/browse/bmpw.jim?file=' + file, 'hxwebifbmp', +// 'height=156,width=280,toolbar=no,' + +// 'scrollbars=no,menubar=no,location=no,titlebar=no'); + $('#thmbmp').attr('src', 'bmp.jim?file=' + file); + $('#bmpdialogue').dialog('open'); break; case 'download': @@ -783,6 +785,18 @@ var dmenuclick = function(action, el, pos) close: function() { $('#savestream_name').val(''); } }); + $('#bmpdialogue').dialog({ + autoOpen: false, + height: 'auto', width: 'auto', + modal: true, + buttons: { + "Close": function() { + $(this).dialog('close'); + } + }, + close: function() { $('#thmbmp').attr('src', 'about:blank'); } + }); + // Create re-usable confirmation dialogue. $confirm = $('#confirm').dialog({ modal: true, autoOpen: false, diff --git a/var/mongoose/html/browse/thumbnail/_mk.jim b/var/mongoose/html/browse/thumbnail/_mk.jim new file mode 100755 index 00000000..da888c4e --- /dev/null +++ b/var/mongoose/html/browse/thumbnail/_mk.jim @@ -0,0 +1,19 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/webif/lib/setup +require ts.class cat + +httpheader "image/bmp" + +set rfile [cgi_get file] +set pos [cgi_get pos 0] + +if {![catch {set ts [ts fetch $rfile]}]} { + $ts mkbmp $pos ".pos$pos" + + set f "[file rootname $rfile].pos$pos.bmp" + cat $f + file delete $f +} + diff --git a/var/mongoose/html/browse/thumbnail/fetch.jim b/var/mongoose/html/browse/thumbnail/fetch.jim new file mode 100755 index 00000000..37be02bc --- /dev/null +++ b/var/mongoose/html/browse/thumbnail/fetch.jim @@ -0,0 +1,17 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/webif/lib/setup +require cat + +httpheader "image/bmp" + +set rfile [cgi_get file] +set pos [cgi_get pos 0] + +set f "[file rootname $rfile].pos$pos.bmp" +if {[file exists $f]} { + cat $f + file delete $f +} + diff --git a/var/mongoose/html/browse/thumbnail/index.jim b/var/mongoose/html/browse/thumbnail/index.jim new file mode 100755 index 00000000..720eb6c8 --- /dev/null +++ b/var/mongoose/html/browse/thumbnail/index.jim @@ -0,0 +1,98 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/webif/lib/setup +require ts.class pretty_size + +header + +set rfile [cgi_get file] +set ts [ts fetch $rfile] +set dir [file dirname $rfile] + +set len [$ts duration 1] + +lassign [$ts bookmarks] book +if {$book eq ""} { set book 0 } + +set pos [cgi_get pos $book] +set pos $($pos + 0) +if {$pos < 0} { set pos 0 } + +puts " + + + +
+Replace Thumbnail + +
Title[$ts get title] + " + if {[file exists "[file rootname $file].thm"]} { + puts "" + } + puts "[$ts get title]
Synopsis [$ts get synopsis]
+ + + + + +
File: + + $rfile +
Length:[clock format $len -format %T]
Size:[pretty_size [$ts size]] ([$ts get definition])
Bookmarks:[$ts get bookmarks] ($book second(s))
Thumbnail: + +
+" + +if {[$ts get definition] eq "HD"} { + set start $($pos - 0.5) + set incr 1.0 +} else { + set start $($pos - 1) + set incr 2.0 +} +if {$start < 0} { set start 0 } +set limit $($start + $incr) + +puts "
+ +

+
+ + Thumbnails from around + + second(s) into recording. +
+ + + + + +
+ + + + +" + +for {set i [expr $start + 0.0]} {$i <= $limit} {set i [expr $i + 0.5]} { + lappend times $i + puts "" +} +puts "" + +foreach i $times { + puts "" +} + +puts "" + +foreach i $times { + puts "" +} + +puts "" + +puts "
+ @ $is
+ +
+ +
" + diff --git a/var/mongoose/html/browse/thumbnail/mkrange.jim b/var/mongoose/html/browse/thumbnail/mkrange.jim new file mode 100755 index 00000000..dc4acb3b --- /dev/null +++ b/var/mongoose/html/browse/thumbnail/mkrange.jim @@ -0,0 +1,21 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/webif/lib/setup +require ts.class + +httpheader + +set rfile [cgi_get file] +set s [cgi_get s 0] +set e [cgi_get e $($s + 2)] +set i [expr [cgi_get i 0.5] + 0.0] + +if {![catch {set ts [ts fetch $rfile]}]} { + $ts cleanbmp + for {set n [expr $s + 0.0]} {$n <= $e} {set n [expr $n + $i]} { + puts "Generating thumbnail for pos $n" + $ts mkbmp $n ".pos$n" + } +} + diff --git a/var/mongoose/html/browse/thumbnail/script.js b/var/mongoose/html/browse/thumbnail/script.js new file mode 100755 index 00000000..e15117fb --- /dev/null +++ b/var/mongoose/html/browse/thumbnail/script.js @@ -0,0 +1,58 @@ + +$(document).ready(function() { + +var dir = $('#dir').text(); +var file = $('#file').text(); + +$('button').button(); + +function go(pos) +{ + window.location.href = 'index.jim?file=' + + encodeURIComponent(file) + '&pos=' + pos; +} + +$('button.mvpos').disable().on('click', function(e) { + e.preventDefault(); + var pos = $(this).attr('pos'); + go(pos); +}); + +$('#repos').disable().on('click', function(e) { + e.preventDefault(); + var pos = $('#pos').val(); + go(pos); +}); + +$('#back').on('click', function(e) { + e.preventDefault(); + window.location.href = '/browse/index.jim?dir=' + + encodeURIComponent(dir); +}); + +$('button.usethm').disable().on('click', function(e) { + e.preventDefault(); + var pos = $(this).attr('pos'); + $('button,input').disable(); + $.get('set.jim?file=' + encodeURIComponent(file) + '&pos=' + pos, + function() { + window.location.href = '/browse/index.jim?dir=' + + encodeURIComponent(dir); + });; +}); + +var start = $('#start').text(); +var end = $('#end').text(); +$.get('mkrange.jim?file=' + encodeURIComponent(file) + + '&s=' + start + '&e=' + end, function() { + $('img.bmp').each(function(i) { + var pos = $(this).attr('pos'); + $(this).attr('src', + 'fetch.jim?file=' + encodeURIComponent(file) + + '&pos=' + pos); + }); + $('button').enable(); +}); + +}); + diff --git a/var/mongoose/html/browse/thumbnail.jim b/var/mongoose/html/browse/thumbnail/set.jim similarity index 80% rename from var/mongoose/html/browse/thumbnail.jim rename to var/mongoose/html/browse/thumbnail/set.jim index a5f16455..eeb7814b 100755 --- a/var/mongoose/html/browse/thumbnail.jim +++ b/var/mongoose/html/browse/thumbnail/set.jim @@ -7,7 +7,9 @@ require ts.class httpheader set file [cgi_get file] +set pos [cgi_get pos 0] + if {![catch {set ts [ts fetch $file]}]} { - $ts mkthm + $ts mkthm $pos } diff --git a/var/mongoose/html/css/style.css b/var/mongoose/html/css/style.css index 6349f6e9..3f8d42fc 100644 --- a/var/mongoose/html/css/style.css +++ b/var/mongoose/html/css/style.css @@ -410,3 +410,18 @@ div#restart_block z-index: 31; } +img.bmp, img.doublebmp +{ + transform: scaleY(-1); + -webkit-transform: scaleY(-1); + -o-transform: scaleY(-1); + height: 78px; + width: 140px; +} + +img.doublebmp +{ + height: 156px; + width: 280px; +} + diff --git a/var/mongoose/html/img/generating.png b/var/mongoose/html/img/generating.png new file mode 100644 index 00000000..b4832cfb Binary files /dev/null and b/var/mongoose/html/img/generating.png differ diff --git a/var/mongoose/lib/ts.class b/var/mongoose/lib/ts.class index b0d6b22d..376dee22 100644 --- a/var/mongoose/lib/ts.class +++ b/var/mongoose/lib/ts.class @@ -235,20 +235,51 @@ ts method dlnaloc {{urlbase 0}} { if {$url ne "" } { return [list $url $mime] } else { return {} } } -ts method mkthm {} { - if {!$bookmarks} { - puts "No bookmarks found." - return - } - lassign [$self bookmarks] s - puts "Grabbing thumbnail from $s second(s) in." +ts method cleanbmp {} { set bfile [file rootname $file] - puts [exec /mod/bin/ffmpeg -loglevel fatal -ss $s -i $file \ - -frames 1 -pix_fmt argb -vf vflip -s 140x78 \ - $bfile.bmp] - puts [exec /bin/dd if=$bfile.bmp of=$bfile.thm bs=54 skip=1] + foreach f [glob -nocomplain "${bfile}*.bmp"] { + file delete $f + } +} + +ts method mkbmps {{offset 0}} { + set bfile [file rootname $file] + if {[catch { + exec /mod/bin/ffmpeg -loglevel fatal -ss $offset -i $file \ + -vf fps=fps=2 -frames 5 \ + -pix_fmt argb -vf vflip -s 140x78 "${bfile}%d.bmp" + } msg]} { + puts "ERROR: $msg" + return 0 + } + return 1 +} + +ts method mkbmp {{offset 0} {ext ""}} { + set bfile [file rootname $file] + if {[catch { + exec /mod/bin/ffmpeg -loglevel fatal -ss $offset -i $file \ + -frames 1 -pix_fmt argb -vf vflip -s 140x78 "$bfile$ext.bmp" + } msg]} { + puts "ERROR: $msg" + return 0 + } + return 1 +} + +ts method mkthm {{offset 0}} { + if {![$self mkbmp $offset]} { return 0 } + set bfile [file rootname $file] + if {[catch { + exec /bin/dd if=$bfile.bmp of=$bfile.thm~ bs=54 skip=1 + } msg]} { + puts "ERROR: $msg" + return 0 + } + exec /bin/echo -n " " >> $bfile.thm~ + file rename -force $bfile.thm~ $bfile.thm tdelete $bfile.bmp - puts "Done." + return 1 } proc {ts renamegroup} {from to} {