diff --git a/CONTROL/control b/CONTROL/control index c58a130..36afbf2 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,10 +1,10 @@ Package: webif Priority: optional Section: web -Version: 1.0.15 +Version: 1.0.15-1 Architecture: mipsel Maintainer: af123@hummypkg.org.uk -Depends: webif-channelicons(>=1.1.11),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.19),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),mongoose +Depends: webif-channelicons(>=1.1.11),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.13),hmt(>=1.1.21),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),mongoose Suggests: Description: An evolving web interface for the Humax. Tags: http://hummy.tv/forum/threads/5031/ diff --git a/webif/cgi-bin/status.jim b/webif/cgi-bin/status.jim index 4898302..d59c126 100755 --- a/webif/cgi-bin/status.jim +++ b/webif/cgi-bin/status.jim @@ -60,9 +60,6 @@ proc get_data {} { [string first /media/ $line] == -1} { continue } - if {[string first "/.tsr/" $line] != -1} { - continue - } regsub -- { \([^\)]+\)$} $line "" line set ext [file extension $line] if {$ext ni $exts} continue diff --git a/webif/html/browse/assets.jim b/webif/html/browse/assets.jim index 139fdd3..9b6fa39 100755 --- a/webif/html/browse/assets.jim +++ b/webif/html/browse/assets.jim @@ -29,6 +29,8 @@ if {[system pkginst ffmpeg]} { puts {
  • View Thumbnail
  • } +puts {
  • Manage Bookmarks
  • } + if $nicesplice { puts {
  • Crop
  • diff --git a/webif/html/browse/bookmarks/index.jim b/webif/html/browse/bookmarks/index.jim new file mode 100755 index 0000000..9a40368 --- /dev/null +++ b/webif/html/browse/bookmarks/index.jim @@ -0,0 +1,47 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/webif/lib/setup +require ts.class pretty_size + +jscss script.js style.css +header + +set rfile [cgi_get file] +set ts [ts fetch $rfile] +set dir [file dirname $rfile] + +set len [$ts duration 1] + +puts " + +
    +Manage Bookmarks + + + + + + +
    File:$rfile
    Length:[clock format $len -format %T]
    Size:[pretty_size [$ts size]] ([$ts get definition])
    Bookmarks
    (enter in seconds)
    + + +
    + +
    + + +
    +
    + + +
    +
    +" + diff --git a/webif/html/browse/bookmarks/save.jim b/webif/html/browse/bookmarks/save.jim new file mode 100755 index 0000000..66647b0 --- /dev/null +++ b/webif/html/browse/bookmarks/save.jim @@ -0,0 +1,20 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/webif/lib/setup +require ts.class + +httpheader + +set file [cgi_get file] +set bookmarks [cgi_get bookmarks ""] + +if {[system inuse $file]} { + puts "This file is in use. Cannot process at the moment." + exit +} + +set ts [ts fetch $file] +$ts setbookmarks [split [string trim $bookmarks]] +puts "Bookmarks saved successfully." + diff --git a/webif/html/browse/bookmarks/script.js b/webif/html/browse/bookmarks/script.js new file mode 100644 index 0000000..b49e99e --- /dev/null +++ b/webif/html/browse/bookmarks/script.js @@ -0,0 +1,132 @@ +var curval = 0; +var $slider; + +function +setvals() +{ + values = $.trim($('#bookmarks').val()).split(/ +/); + if (!values.length || values[0] == '') + { + refreshtimes(); + return; + } + nvalues = []; + $.each(values, function(k, v) { + if (v > len) + v = len; + if (v < 0) + v = 0; + nvalues.push(v); + }); + values = nvalues; + $('#bookmarks').val(values.join(' ')); + sortmarks(); + refreshtimes(); +} + +function +draw_slider() +{ + if ($slider) + $slider.slider('destroy'); + else + $slider = $('#slider'); + setvals(); + values = $.trim($('#bookmarks').val()).split(/ +/); + if (!values.length || values[0] == '') + { + $slider = null; + return; + } + $slider.slider({ + min: 0, + max: len, + step: 1, + values: values, + start: function(event, ui) { + curval = ui.value; + }, + stop: function(event, ui) { + curval = ui.value; + sortmarks(); + refreshtimes(); + }, + slide: function(event, ui) { + var marks = ''; + for (var i = 0; i < ui.values.length; ++i) + marks += ui.values[i] + ' '; + $('#bookmarks').val($.trim(marks)); + setvals(); + } + }); +}; + +function +refreshtimes() +{ + var t = ''; + values = $.trim($('#bookmarks').val()).split(/ +/); + if (!values.length || values[0] == '') + { + $('#bookmarkstime').text(t); + return; + } + $.each(values, function(k, v) { + t += new Date(null, null, null, null, null, v) + .toTimeString().match(/\d{2}:\d{2}:\d{2}/)[0] + ' '; + }); + $('#bookmarkstime').text(t); +} + +function +sortmarks() +{ + var a = $.trim($('#bookmarks').val()).split(/ +/); + a.sort(function(a, b){return a-b}); + $('#bookmarks').val(a.join(" ")); +} + +$(function() { + +$('#bookmarks').val($('#bookmarks').attr('init')); +draw_slider(); + +$('#addbmark').button({icons: {primary: "ui-icon-plus"}, text: false}) + .on('click', function() { + $('#bookmarks').val('0 ' + $('#bookmarks').val()); + draw_slider(); +}); + +$('#delbmark').button({icons: {primary: "ui-icon-minus"}, text: false}) + .on('click', function() { + var cur = $('#bookmarks').val(); + cur = $.trim(cur.replace( + new RegExp('(^| )' + curval + '( |$)', ''), ' ')); + $('#bookmarks').val(cur); + draw_slider(); +}); + +$('#save').button({icons: {primary: "ui-icon-disk"}}) + .on('click', function() { + $.post('save.jim', { + file: file, + bookmarks: $('#bookmarks').val() + }, function(data) { + $('#results').html(data) + .slideDown('slow').delay(5000).slideUp('slow'); + }); +}); + +$('#back').button({icons: {primary: "ui-icon-arrowreturnthick-1-w"}}) + .on('click', function() { + window.location = '../index.jim?dir=' + dir; +}); + +$('#update').button() + .on('click', function() { + draw_slider(); +}); + + +}); + diff --git a/webif/html/browse/bookmarks/style.css b/webif/html/browse/bookmarks/style.css new file mode 100644 index 0000000..493c75e --- /dev/null +++ b/webif/html/browse/bookmarks/style.css @@ -0,0 +1,16 @@ + +#slider +{ + margin-top: 5px; +} + +#buttons +{ + margin-top: 5px; +} + +#buttons2 +{ + margin-top: 5px; +} + diff --git a/webif/html/browse/crop/crop.jim b/webif/html/browse/crop/crop.jim index 0859dd1..233c8fb 100755 --- a/webif/html/browse/crop/crop.jim +++ b/webif/html/browse/crop/crop.jim @@ -9,13 +9,14 @@ jscss crop.js header set rfile [cgi_get file] +set invert [cgi_get invert 0] set ts [ts fetch $rfile] set dir [file dirname $rfile] set len [$ts duration 1] puts " -
    +
    Crop recording @@ -24,12 +25,9 @@ puts " " diff --git a/webif/html/browse/script.js b/webif/html/browse/script.js index 31ca266..b8af830 100755 --- a/webif/html/browse/script.js +++ b/webif/html/browse/script.js @@ -479,6 +479,11 @@ var menuclick = function(action, el, pos) $('#bmpdialogue').dialog('open'); break; + case 'bmarks': + window.location.href = '/browse/bookmarks/?file=' + + file; + break; + case 'download': window.location.href = '/browse/download.jim?file=' + file + '&base=' + diff --git a/webif/html/img/context/bookmark.png b/webif/html/img/context/bookmark.png new file mode 100644 index 0000000..98936a8 Binary files /dev/null and b/webif/html/img/context/bookmark.png differ diff --git a/webif/html/lib/jquery.plugin/contextMenu/extra.css b/webif/html/lib/jquery.plugin/contextMenu/extra.css index da54aa3..8191f87 100644 --- a/webif/html/lib/jquery.plugin/contextMenu/extra.css +++ b/webif/html/lib/jquery.plugin/contextMenu/extra.css @@ -18,4 +18,5 @@ .context-menu-item.icon-mp3 { background-image: url(/img/context/mp3.png); } .context-menu-item.icon-clock { background-image: url(/img/context/clock.png); } .context-menu-item.icon-thm { background-image: url(/img/context/thumb.png); } +.context-menu-item.icon-bookmark { background-image: url(/img/context/bookmark.png); } diff --git a/webif/html/lib/jquery.plugin/contextMenu/jquery.contextMenu.css b/webif/html/lib/jquery.plugin/contextMenu/jquery.contextMenu.css index e5e03f0..3fe9496 100644 --- a/webif/html/lib/jquery.plugin/contextMenu/jquery.contextMenu.css +++ b/webif/html/lib/jquery.plugin/contextMenu/jquery.contextMenu.css @@ -73,5 +73,6 @@ .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); } +.contextMenu LI.bookmark A { background-image: url(/img/context/bookmark.png); } diff --git a/webif/lib/ts.class b/webif/lib/ts.class index 7905727..7950b0e 100644 --- a/webif/lib/ts.class +++ b/webif/lib/ts.class @@ -61,8 +61,14 @@ ts method inuse {} { return [system inuse $file] } -ts method bookmarks {} { - return [exec /mod/bin/hmt -bookmarks $file] +ts method bookmarks {{aslist 0}} { + set marks [split [string trim [exec /mod/bin/hmt -bookmarks $file]]] + if {$aslist} { return $marks } + return [join $marks " "] +} + +ts method setbookmarks {marks} { + exec /mod/bin/hmt +setbookmarks=[join $marks :] $file } ts method flag {f} {
    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 [join [lmap i [$ts bookmarks 1] { + clock format $i -format "%T" +}] ", "] puts "
    File" @@ -41,10 +39,16 @@ proc div {type left right} { $type" } +set bookmarks {} +if {$invert} { + append bookmarks "0 " +} +append bookmarks [$ts bookmarks] + set keeping 0 set last 0 set start -1 -foreach b [$ts bookmarks] { +foreach b $bookmarks { if {$start < 0} { set start $b continue @@ -94,6 +98,7 @@ puts " >
    +
    @@ -101,9 +106,9 @@ puts " Cropping:
    - + -
    +
    " diff --git a/webif/html/browse/crop/crop.js b/webif/html/browse/crop/crop.js index 382d8d2..d7d7894 100755 --- a/webif/html/browse/crop/crop.js +++ b/webif/html/browse/crop/crop.js @@ -24,8 +24,9 @@ $('#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'), + $('#output').show().text('Please do not interrupt...') + .load('execute.jim?file=' + $('#params').attr('file') + + '&invert=' + $('#invert').attr('invert'), function() { clearInterval(handle); handle = 0; @@ -34,5 +35,10 @@ $('#cropit').button().click(function() { }); }); +$('#invert').button().on('click', function() { + window.location = 'crop.jim?file=' + $('#params').attr('file') + + '&invert=' + ($(this).attr('invert') == '1' ? '0' : '1'); +}); + }); diff --git a/webif/html/browse/crop/execute.jim b/webif/html/browse/crop/execute.jim index 2d8fa0f..01bd50f 100755 --- a/webif/html/browse/crop/execute.jim +++ b/webif/html/browse/crop/execute.jim @@ -7,6 +7,7 @@ require ts.class pretty_size system.class httpheader set rfile [cgi_get file] +set invert [cgi_get invert] if {[system inuse $rfile]} { puts "This file is in use. Cannot process at the moment." @@ -25,7 +26,7 @@ set origdir "$dir/_original" if {![file exists $origdir]} { file mkdir $origdir } set shname [file tail $base] -puts "Processing $shname" +puts "Processing $shname (inverted: $invert)" if {[file exists "$origdir/$shname.ts"]} { puts "This recording already exists within _original" @@ -33,6 +34,8 @@ if {[file exists "$origdir/$shname.ts"]} { exit } +set bookmarks [$ts bookmarks] + puts "Moving recording to $origdir" set tail [file tail $base] @@ -42,17 +45,36 @@ foreach ext $tsgroup { file rename "$base.$ext" "${origdir}/$tail.$ext" } -puts [exec /mod/bin/nicesplice \ - -in "$origdir/$shname" \ - -out "$dir/$shname" \ - -cutBookMarks] +set cmd [list /mod/bin/nicesplice \ + -in "$origdir/$shname" \ + -out "$dir/$shname"] + +if {$invert} { + if {[expr [llength $bookmarks] % 2] != 0} { + lappend bookmarks [$ts duration 1] + } + foreach k [array names bookmarks] { + lappend cmd -cut $($k * 10) $($bookmarks($k) * 10) + } +} else { + lappend cmd "-cutBookMarks" +} + +puts "CMD: $cmd" + +puts [exec {*}$cmd] +#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" # New nicesplice shrinks whilst cropping. -exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt" +# No longer required - nicesplice now sets this flag. +#exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt" set croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0] puts "Time taken: $croptime" diff --git a/webif/html/browse/file.jim b/webif/html/browse/file.jim index 028f47a..d23d99f 100755 --- a/webif/html/browse/file.jim +++ b/webif/html/browse/file.jim @@ -116,7 +116,10 @@ puts "
    [$ts get flags] " if {[$ts get bookmarks]} { - puts " \[Bookmarks: [$ts get bookmarks]\]" + puts " \[Bookmarks: [$ts get bookmarks] @ [join \ + [lmap i [$ts bookmarks 1] { + clock format $i -format "%T" + }] ", "]" } puts "