forked from hummypkg/webif
bookmark management
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1974 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
492b37be41
commit
02d7bc3f33
@ -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/
|
||||
|
@ -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
|
||||
|
@ -29,6 +29,8 @@ if {[system pkginst ffmpeg]} {
|
||||
|
||||
puts { <li><a href=#vthm>View Thumbnail</a></li> }
|
||||
|
||||
puts { <li class=bookmark><a href=#bmarks>Manage Bookmarks</a></li> }
|
||||
|
||||
if $nicesplice {
|
||||
puts {
|
||||
<li class="cut"><a href=#crop>Crop</a></li>
|
||||
|
47
webif/html/browse/bookmarks/index.jim
Executable file
47
webif/html/browse/bookmarks/index.jim
Executable file
@ -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 "
|
||||
<script type=text/javascript>
|
||||
var initbookmarks = '[$ts bookmarks]';
|
||||
var len = [$ts duration 1];
|
||||
var file = '$rfile';
|
||||
var dir = '$dir';
|
||||
</script>
|
||||
<fieldset class=cleft>
|
||||
<legend>Manage Bookmarks</legend>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
<tr><th>File:</th><td>$rfile</td></tr>
|
||||
<tr><th>Length:</th><td>[clock format $len -format %T]</td></tr>
|
||||
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
|
||||
<tr><th>Bookmarks<br><span class=footnote>(enter in seconds)</span></th><td>
|
||||
<input id=bookmarks size=80 maxlength=255 init=\"[$ts bookmarks]\"
|
||||
value=\"\" />
|
||||
<button id=update>Update</button>
|
||||
<br>
|
||||
<span id=bookmarkstime></span>
|
||||
</td></tr><tr><td align=right>
|
||||
<button class=left id=addbmark>Add Bookmark</button>
|
||||
<button class=left id=delbmark>Remove Bookmark</button>
|
||||
</td><td><div id=slider></div></td></tr>
|
||||
</table>
|
||||
<div id=buttons>
|
||||
<button id=save>Save Bookmarks</button>
|
||||
<button id=back>Back to Media Browser</button>
|
||||
</div>
|
||||
<div id=results class=\"hidden blood\"></div>
|
||||
"
|
||||
|
20
webif/html/browse/bookmarks/save.jim
Executable file
20
webif/html/browse/bookmarks/save.jim
Executable file
@ -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."
|
||||
|
132
webif/html/browse/bookmarks/script.js
Normal file
132
webif/html/browse/bookmarks/script.js
Normal file
@ -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();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
16
webif/html/browse/bookmarks/style.css
Normal file
16
webif/html/browse/bookmarks/style.css
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
#slider
|
||||
{
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#buttons
|
||||
{
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#buttons2
|
||||
{
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
@ -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 "
|
||||
<fieldset class=cleft>
|
||||
<fieldset>
|
||||
<legend>Crop recording</legend>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
@ -24,12 +25,9 @@ puts "
|
||||
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
|
||||
<tr><th>Bookmarks:</th><td>[$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 "</td></tr><tr><th>File</th><td>"
|
||||
|
||||
@ -41,10 +39,16 @@ proc div {type left right} {
|
||||
$type</div>"
|
||||
}
|
||||
|
||||
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 "
|
||||
></span>
|
||||
|
||||
<div id=cropdiv style=\"padding: 1em\">
|
||||
<button id=invert invert=$invert>Invert selection</button>
|
||||
<button id=cropit>Perform crop operation</button>
|
||||
</div>
|
||||
|
||||
@ -101,9 +106,9 @@ puts "
|
||||
Cropping: <div id=progressbar></div>
|
||||
</div>
|
||||
|
||||
<button id=back class=hidden>Back to media list</button>
|
||||
<button id=back>Back to media list</button>
|
||||
|
||||
<div id=output class=pre style=\"margin-top: 10px\"></div>
|
||||
<div id=output class=\"hidden pre\" style=\"margin-top: 10px\"></div>
|
||||
</fieldset>
|
||||
|
||||
"
|
||||
|
@ -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');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
@ -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"
|
||||
|
@ -116,7 +116,10 @@ puts "</td>
|
||||
<td>[$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 "</tr>"
|
||||
|
@ -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=' +
|
||||
|
BIN
webif/html/img/context/bookmark.png
Normal file
BIN
webif/html/img/context/bookmark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 642 B |
@ -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); }
|
||||
|
||||
|
@ -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); }
|
||||
|
||||
|
||||
|
@ -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} {
|
||||
|
Loading…
Reference in New Issue
Block a user