From dfde94c384a7d9a4aceb4e39bff19e36c59c19be Mon Sep 17 00:00:00 2001 From: Matthew Date: Thu, 31 Oct 2019 00:52:11 +0000 Subject: [PATCH] Automatic edit point bookmarks following crop --- webif/html/browse/crop/crop.jim | 54 ++++++++++++++++++++++----- webif/html/browse/crop/crop.js | 60 ++++++++++++++++++++++++------ webif/html/browse/crop/execute.jim | 1 + webif/html/browse/crop/style.css | 13 +++++++ 4 files changed, 108 insertions(+), 20 deletions(-) create mode 100644 webif/html/browse/crop/style.css diff --git a/webif/html/browse/crop/crop.jim b/webif/html/browse/crop/crop.jim index 9ab6cc0..232b8cb 100755 --- a/webif/html/browse/crop/crop.jim +++ b/webif/html/browse/crop/crop.jim @@ -4,8 +4,8 @@ package require cgi source /mod/webif/lib/setup require ts.class pretty_size -jqplugin progressbar -jscss crop.js +jqplugin progressbar iphone-style-checkboxes +jscss crop.js style.css header set rfile [cgi_get file] @@ -23,13 +23,13 @@ puts " File:$rfile Length:[clock format $len -format \"%T\"] Size:[pretty_size [$ts size]] ([$ts get definition]) -Bookmarks:[$ts get bookmarks] @ " +Bookmarks:[$ts get bookmarks] @ " puts [join [lmap i [$ts bookmarks 1] { clock format $i -format "%T" }] ", "] -puts "File" +puts " " puts "
" @@ -48,14 +48,21 @@ append bookmarks [$ts bookmarks] set keeping 0 set last 0 set start -1 +set newbookmarks "0 " +set cur 0 foreach b $bookmarks { if {$start < 0} { + # Start of a section to keep set start $b continue } + # End of a section to keep set end $b - incr keeping $($end - $start) + set l $($end - $start) + incr keeping $l + incr cur $l + append newbookmarks "[expr $cur + 3] " set left $($start * 500 / $len) set right $($end * 500 / $len) @@ -69,6 +76,7 @@ foreach b $bookmarks { } if {$start > 0} { + # Still in a keep section... incr keeping $($len - $start) set left $($start * 500 / $len) div cut $last $($left - 1) @@ -77,6 +85,10 @@ if {$start > 0} { div cut $last 500 } +if {$cur > $keeping - 8 && $keeping - 8 > 0} { + set newbookmarks [lreplace $newbookmarks end end $($keeping - 8)] +} + set keepperc $($keeping * 100.0 / $len) set esttime $(int($keeping * 0.025)) if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) } @@ -86,7 +98,23 @@ puts " Keeping: [clock format $keeping -format "%T"] ([format "%.2f" $keepperc]%) - +" + +puts " + + +New Bookmarks: + + +$newbookmarks    ( +" +puts [join [lmap i $newbookmarks { + clock format $i -format "%T" +}] ", "] + +puts " )" + +puts " Time: Cropping will take around [clock format $esttime -format "%T"] @@ -98,10 +126,19 @@ puts " >
- - + + + + +
+Save new bookmarks? + + +
+ +