diff --git a/CONTROL/control b/CONTROL/control index 29e3f53..9a4444e 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 0.8.4-1 +Version: 0.8.5 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4-1),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.1),ssmtp,anacron diff --git a/var/mongoose/cgi-bin/browse.jim b/var/mongoose/cgi-bin/browse.jim index 354f4ba..5785612 100755 --- a/var/mongoose/cgi-bin/browse.jim +++ b/var/mongoose/cgi-bin/browse.jim @@ -184,6 +184,9 @@ puts { if {[system model] eq "HDR"} { puts {
  • Decrypt
  • } } +if {[system pkginst ffmpeg]} { + puts {
  • Extract Audio
  • } +} if $nicesplice { puts {
  • Crop
  • } } diff --git a/var/mongoose/cgi-bin/browse/audio.jim b/var/mongoose/cgi-bin/browse/audio.jim new file mode 100755 index 0000000..199a699 --- /dev/null +++ b/var/mongoose/cgi-bin/browse/audio.jim @@ -0,0 +1,100 @@ +#!/mod/bin/jimsh + +package require sqlite3 +package require cgi +source /mod/var/mongoose/lib/setup +require ts.class + +puts "Content-Type: text/html\r\n\r\n" + +cgi_input +#cgi_dump + +set rfile [cgi_get file] +set ts [ts fetch $rfile] +set dir [file dirname $rfile] +set len [$ts duration 1] + +if {[cgi_get do] eq "it"} { + set xstart [clock milliseconds] + + set base [file rootname $rfile] + set shname [file tail $base] + puts "Processing $shname" + + puts [exec /mod/bin/ffmpeg -y -benchmark -v 0 \ + -i $rfile -f mp2 \ + -vn -acodec copy "${base}.mp3"] + + set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0] + puts "Time taken: $xtime" + + exit +} + +header + +puts " + + + + + + +
    File:$rfile
    Length:[clock format $len -format "%T"]
    +" + +puts { + +
    +
    + + + + + +} + diff --git a/var/mongoose/cgi-bin/browse/audio_progress.jim b/var/mongoose/cgi-bin/browse/audio_progress.jim new file mode 100755 index 0000000..e8f761a --- /dev/null +++ b/var/mongoose/cgi-bin/browse/audio_progress.jim @@ -0,0 +1,26 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/var/mongoose/lib/setup +require ts.class + +puts "Content-Type: text/html\r\n\r\n" + +cgi_input +#cgi_dump + +set tsfile [cgi_get file] +set rfile [file normalize $tsfile] +set bfile [file rootname $rfile] + +if {![file exists "${bfile}.mp3"]} { + puts "0" +} else { + set sz [file size $rfile] + set nsz [expr [file size "${bfile}.mp3"] / 0.3] + + set perc [expr $nsz * 100 / $sz] + if {$perc > 100} { set perc 100 } + puts $perc +} + diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js index 04c64ca..d937bcc 100755 --- a/var/mongoose/cgi-bin/browse/browse.js +++ b/var/mongoose/cgi-bin/browse/browse.js @@ -193,9 +193,15 @@ function preparemenu(el, menu) } if (el.attr('odencd') == 1) + { $('#optmenu').enableContextMenuItems('#decrypt'); + $('#optmenu').disableContextMenuItems('#audio'); + } else + { $('#optmenu').disableContextMenuItems('#decrypt'); + $('#optmenu').enableContextMenuItems('#audio'); + } } else @@ -205,6 +211,7 @@ function preparemenu(el, menu) $('#optmenu').disableContextMenuItems('#enc'); $('#optmenu').disableContextMenuItems('#new'); $('#optmenu').disableContextMenuItems('#decrypt'); + $('#optmenu').disableContextMenuItems('#audio'); $('#optmenu').disableContextMenuItems('#crop'); } @@ -275,6 +282,11 @@ var menuclick = function(action, el, pos) encodeURIComponent(file); break; + case 'audio': + window.location.href = '/cgi-bin/browse/audio.jim?file=' + + encodeURIComponent(file); + break; + default: alert('Unhandled action: ' + action); break; diff --git a/var/mongoose/cgi-bin/browse/crop.jim b/var/mongoose/cgi-bin/browse/crop.jim index a68246c..7b357e8 100755 --- a/var/mongoose/cgi-bin/browse/crop.jim +++ b/var/mongoose/cgi-bin/browse/crop.jim @@ -9,8 +9,7 @@ puts "Content-Type: text/html\r\n\r\n" cgi_input #cgi_dump -set tsfile [cgi_get file] -set rfile [file normalize $tsfile] +set rfile [cgi_get file] set ts [ts fetch $rfile] set dir [file dirname $rfile] diff --git a/var/mongoose/cgi-bin/browse/decrypt.jim b/var/mongoose/cgi-bin/browse/decrypt.jim index 4c1429e..b36a6e8 100755 --- a/var/mongoose/cgi-bin/browse/decrypt.jim +++ b/var/mongoose/cgi-bin/browse/decrypt.jim @@ -10,14 +10,14 @@ puts "Content-Type: text/html\r\n\r\n" cgi_input #cgi_dump -set tsfile [cgi_get file] -set rfile [file normalize $tsfile] +set rfile [cgi_get file] set ts [ts fetch $rfile] set dir [file dirname $rfile] set len [$ts duration 1] lassign [$ts dlnaloc] url if {[cgi_get do] eq "it"} { + set xstart [clock milliseconds] set base [file rootname $rfile] set origdir "$dir/_original" @@ -51,6 +51,9 @@ if {[cgi_get do] eq "it"} { exec /mod/bin/hmt -encrypted "$dir/$shname.hmt" } + set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0] + puts "Time taken: $xtime" + exit } diff --git a/var/mongoose/cgi-bin/browse/download.jim b/var/mongoose/cgi-bin/browse/download.jim index 7107939..91a56a5 100755 --- a/var/mongoose/cgi-bin/browse/download.jim +++ b/var/mongoose/cgi-bin/browse/download.jim @@ -11,20 +11,23 @@ cgi_input #cgi_dump set file [cgi_get file] -set rfile [file normalize $file] -set ts [ts fetch $file] # Default to just downloading the raw file. set url $file set mime "video/ts" -# If it's encrypted on disk and the DLNA option is available, then use -# the server to perform decryption on the fly. -if {[$ts flag "ODEncrypted"] > 0} { - set dlna [$ts dlnaloc] - if {[llength $dlna]} { lassign $dlna url mime } +if {[string match {*.ts} $file]} { + if {![catch {set ts [ts fetch $file]}]} { - #puts "DLNA: $dlna" + # If it's encrypted on disk and the DLNA option is available, + # then use the server to perform decryption on the fly. + if {[$ts flag "ODEncrypted"] > 0} { + set dlna [$ts dlnaloc] + if {[llength $dlna]} { lassign $dlna url mime } + + #puts "DLNA: $dlna" + } + } } puts "Content-Type: text/plain"