From 0c0ea08f09aff74c46f09bd9990da3413d828b00 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Sun, 20 Nov 2016 12:25:56 +0000 Subject: [PATCH] allow multiple ops for ad-hoc jobs. Some escaping cleanups. Add op for join git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3351 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- webif/cgi-bin/status.jim | 3 +++ webif/html/browse/audio/execute.jim | 4 ++-- webif/html/browse/bookmarks/script.js | 2 +- webif/html/browse/crop/execute.jim | 4 ++-- webif/html/browse/decrypt/execute.jim | 4 ++-- webif/html/browse/join/execute.jim | 2 ++ webif/html/browse/mpg/execute.jim | 4 ++-- webif/html/browse/strip/execute.jim | 4 ++-- webif/html/browse/thumbnail/script.js | 18 +++++++++++------- webif/lib/ts.class | 7 +++---- 11 files changed, 31 insertions(+), 23 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 7e51325..d3b426e 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.3.2-16 +Version: 1.3.2-17 Architecture: mipsel Maintainer: af123@hpkg.tv Depends: tcpfix,webif-channelicons(>=1.1.24),lighttpd(>=1.4.39-1),jim(>=0.76-2),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.3),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.9),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.95) diff --git a/webif/cgi-bin/status.jim b/webif/cgi-bin/status.jim index 6d941a2..600b5ca 100755 --- a/webif/cgi-bin/status.jim +++ b/webif/cgi-bin/status.jim @@ -48,6 +48,9 @@ set statusops { crop { "Cropping" "/img/cut.png style=\"padding: 0 0.2em 0 0.5em\"" } + join { "Joining" + "/img/cut.png style=\"padding: 0 0.2em 0 0.5em\"" + } } proc register_statusop {op name icon} { diff --git a/webif/html/browse/audio/execute.jim b/webif/html/browse/audio/execute.jim index aff1647..77cbbdd 100755 --- a/webif/html/browse/audio/execute.jim +++ b/webif/html/browse/audio/execute.jim @@ -26,9 +26,9 @@ if {![[settings] audiomp3]} { lappend cmd "${base}.mp3" #puts "$cmd" -system startop mp3 $rfile +set token [system startop -multiple mp3 $rfile] puts [exec {*}$cmd] -system endop mp3 +system endop $token if {[system pkginst id3v2]} { puts [exec /mod/bin/id3v2 \ diff --git a/webif/html/browse/bookmarks/script.js b/webif/html/browse/bookmarks/script.js index 1ff44a7..02174c7 100644 --- a/webif/html/browse/bookmarks/script.js +++ b/webif/html/browse/bookmarks/script.js @@ -119,7 +119,7 @@ $('#save').button({icons: {primary: "ui-icon-disk"}}) $('#back').button({icons: {primary: "ui-icon-arrowreturnthick-1-w"}}) .on('click', function() { - window.location = '/go/browse?dir=' + dir; + window.location = '/go/browse?dir=' + encodeURIComponent(dir); }); $('#update').button() diff --git a/webif/html/browse/crop/execute.jim b/webif/html/browse/crop/execute.jim index 37d719c..a0382b6 100755 --- a/webif/html/browse/crop/execute.jim +++ b/webif/html/browse/crop/execute.jim @@ -62,9 +62,9 @@ if {$invert} { #puts "CMD: $cmd" -system startop crop $rfile +set token [system startop -multiple crop $rfile] puts [exec {*}$cmd] -system endop crop +system endop $token set newname "$shname-[clock seconds]" puts "Renaming file group to $newname" diff --git a/webif/html/browse/decrypt/execute.jim b/webif/html/browse/decrypt/execute.jim index c31ebb2..e706d17 100755 --- a/webif/html/browse/decrypt/execute.jim +++ b/webif/html/browse/decrypt/execute.jim @@ -38,9 +38,9 @@ if {[file exists "$origdir/$shname.ts"]} { exit } -system startop decrypt $rfile +set token [system startop -multiple decrypt $rfile] exec wget -O "$rfile.decrypting" $url -system endop decrypt +system endop $token puts "Moving recording to $origdir" diff --git a/webif/html/browse/join/execute.jim b/webif/html/browse/join/execute.jim index 2f1dbed..b27c203 100755 --- a/webif/html/browse/join/execute.jim +++ b/webif/html/browse/join/execute.jim @@ -21,7 +21,9 @@ foreach file [split [cgi_get files] ","] { lappend cmd "-out" "$dir/$dst" puts "($cmd)" +set token [system startop -multiple join "$dir/$dst"] puts [exec {*}$cmd] +system endop $token set ts [ts fetch "$dir/$dst.ts"] $ts settitle $dst diff --git a/webif/html/browse/mpg/execute.jim b/webif/html/browse/mpg/execute.jim index 51bfcb2..3eef8df 100755 --- a/webif/html/browse/mpg/execute.jim +++ b/webif/html/browse/mpg/execute.jim @@ -18,12 +18,12 @@ set base [file rootname $rfile] set shname [file tail $base] puts "Processing $shname" -system startop mpg $rfile +set token [system startop -multiple mpg $rfile] puts [exec /mod/bin/ffmpeg -y -benchmark -v 0 \ -i $rfile \ -map 0:0 -map 0:1 \ -vcodec copy -acodec copy "${base}.mpg"] -endop mpg +system endop $token set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0] puts "Time taken: $xtime" diff --git a/webif/html/browse/strip/execute.jim b/webif/html/browse/strip/execute.jim index 049482f..6f8cc4f 100755 --- a/webif/html/browse/strip/execute.jim +++ b/webif/html/browse/strip/execute.jim @@ -35,12 +35,12 @@ foreach ext $tsgroup { file rename "$base.$ext" "${origdir}/$tail.$ext" } -system startop shrink $rfile +set token [system startop -multiple shrink $rfile] puts [exec /mod/bin/stripts \ "$origdir/$shname" \ "$dir/$shname" \ ] -system endop shrink +system endop $token # Set the file time to match the old file ts touchgroup "$dir/$shname.ts" "$origdir/$shname.ts" diff --git a/webif/html/browse/thumbnail/script.js b/webif/html/browse/thumbnail/script.js index e033a51..709a084 100755 --- a/webif/html/browse/thumbnail/script.js +++ b/webif/html/browse/thumbnail/script.js @@ -34,18 +34,22 @@ $('button.usethm').disable().on('click', function(e) { e.preventDefault(); var pos = $(this).attr('pos'); $('button,input').disable(); - $.get('/browse/thumbnail/set.jim?file=' + - encodeURIComponent(file) + '&pos=' + pos, - function() { + $.get('/browse/thumbnail/set.jim', + { + 'file': file, + 'pos': pos + }, function() { window.location.href = '/go/browse?dir=' + encodeURIComponent(dir); });; }); -var start = $('#start').text(); -var end = $('#end').text(); -$.get('/browse/thumbnail/mkrange.jim?file=' + encodeURIComponent(file) + - '&s=' + start + '&e=' + end, function() { +$.get('/browse/thumbnail/mkrange.jim', + { + 'file': file, + 's': $('#start').text(), + 'e': $('#end').text() + }, function() { $('img.bmp').each(function(i) { var pos = $(this).attr('pos'); $(this).attr('src', diff --git a/webif/lib/ts.class b/webif/lib/ts.class index 6e54173..5e8a0ab 100644 --- a/webif/lib/ts.class +++ b/webif/lib/ts.class @@ -340,10 +340,9 @@ ts method mkbmps {{offset 0}} { 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]} { + set cmd [list /mod/bin/ffmpeg -loglevel fatal -ss $offset -i $file \ + -frames 1 -pix_fmt argb -vf vflip -s 140x78 "$bfile$ext.bmp"] + if {[catch { exec {*}$cmd } msg]} { puts "ERROR: $msg" return 0 }