diff --git a/CONTROL/control b/CONTROL/control index 6ae38f7..5d566d4 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,10 +1,10 @@ Package: webif Priority: optional Section: web -Version: 1.0.9-6 +Version: 1.0.10 Architecture: mipsel Maintainer: af123@hummypkg.org.uk -Depends: webif-channelicons(>=1.1.9),mongoose(>=3.0.11),jim(>=0.75),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.13),hmt(>=1.1.14),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.05),ffmpeg,id3v2,multienv(>=1.6) +Depends: webif-channelicons(>=1.1.9),mongoose(>=3.0.11),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,epg(>=1.0.13),hmt(>=1.1.14),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.05),ffmpeg,id3v2,multienv(>=1.6) Suggests: Description: An evolving web interface for the Humax. Tags: http://hummy.tv/forum/threads/4659/ diff --git a/var/mongoose/cgi-bin/settings.jim b/var/mongoose/cgi-bin/settings.jim index abf1d39..0ac6ae1 100755 --- a/var/mongoose/cgi-bin/settings.jim +++ b/var/mongoose/cgi-bin/settings.jim @@ -48,6 +48,7 @@ set xepghours [$settings xepghours] if {$xepghours == 0} { set xepghours 4 } set genrededup [$settings genrededup] set autolog [$settings autolog] +set audiomp3 [$settings audiomp3] # Handle updates @@ -95,6 +96,7 @@ handle_int_update chanchangenc $chanchangenc \ handle_int_update nounwatchedcount $nounwatchedcount "Disable unwatched count" handle_int_update genrededup $genrededup "Genre search dedup" handle_int_update autolog $autolog "Auto-processing log level" +handle_int_update audiomp3 $audiomp3 "MP3 type" set acluser [cgi_get acluser "-"] set aclpass [cgi_get aclpass "-"] @@ -199,7 +201,7 @@ puts "Actions, errors and scan information\n" puts "Debugging information\n" puts " @@ -212,6 +214,30 @@ puts " " +puts -nonewline " + + + Audio extraction type + +" +puts "[$settings audiomp3descr 0] - very fast but less compatible.\n" +puts "[$settings audiomp3descr 1] - around 60 times slower.\n" +puts " + + + + + + + + +" + puts " diff --git a/var/mongoose/html/browse/audio/audio.jim b/var/mongoose/html/browse/audio/audio.jim index 7ee93e5..69a4b53 100755 --- a/var/mongoose/html/browse/audio/audio.jim +++ b/var/mongoose/html/browse/audio/audio.jim @@ -3,18 +3,20 @@ package require sqlite3 package require cgi source /mod/webif/lib/setup -require ts.class system.class +require ts.class system.class settings.class jqplugin progressbar jscss audio.js header +set s [settings] +set type [$s audiomp3descr [$s audiomp3]] + set rfile [cgi_get file] set ts [ts fetch $rfile] set dir [file dirname $rfile] set len [$ts duration 1] - puts " @@ -31,7 +33,7 @@ puts " > -Perform audio extraction +Perform audio extraction - $type diff --git a/var/mongoose/html/browse/audio/execute.jim b/var/mongoose/html/browse/audio/execute.jim index fc30adf..f3b2110 100755 --- a/var/mongoose/html/browse/audio/execute.jim +++ b/var/mongoose/html/browse/audio/execute.jim @@ -3,7 +3,7 @@ package require sqlite3 package require cgi source /mod/webif/lib/setup -require ts.class system.class +require ts.class system.class settings.class httpheader @@ -18,9 +18,15 @@ 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 mp3 \ - -vn -acodec copy "${base}.mp3"] +set cmd [list ffmpeg -y -benchmark -v 0 -i "$rfile" -f mp3 -vn] + +if {![[settings] audiomp3]} { + lappend cmd -acodec copy +} +lappend cmd "${base}.mp3" + +#puts "$cmd" +puts [exec {*}$cmd] if {[system pkginst id3v2]} { puts [exec /mod/bin/id3v2 \ diff --git a/var/mongoose/html/browse/file.jim b/var/mongoose/html/browse/file.jim index c4990b9..762b0b1 100755 --- a/var/mongoose/html/browse/file.jim +++ b/var/mongoose/html/browse/file.jim @@ -11,8 +11,7 @@ set type [cgi_get type] if {$file == 0} exit -file stat $file st -set sz [pretty_size $st(size)] +set sz [pretty_size [file size $file]] if {$type eq "ts"} { require epg.class ts.class diff --git a/var/mongoose/html/browse/index.jim b/var/mongoose/html/browse/index.jim index 7a01444..9ac298f 100755 --- a/var/mongoose/html/browse/index.jim +++ b/var/mongoose/html/browse/index.jim @@ -103,8 +103,7 @@ proc entry {file} {{i 0}} { set ext [string tolower [file extension $file]] if {$ext in $::ignore || $ext ni $::include} { return } - file stat $file st - set rsz $st(size) + set rsz [file size $file] set sz [pretty_size $rsz] set base [file rootname $file] diff --git a/var/mongoose/html/m/browse.jim b/var/mongoose/html/m/browse.jim index 400994e..a416d2e 100755 --- a/var/mongoose/html/m/browse.jim +++ b/var/mongoose/html/m/browse.jim @@ -54,8 +54,7 @@ proc entry {file {i 0}} { set ext [file extension $file] if {$ext in $::ignore || $ext ni $::include} { return } - file stat $file st - set rsz $st(size) + set rsz [file size $file] set sz [pretty_size $rsz] set base [file rootname $file] @@ -192,9 +191,9 @@ proc s_time {a b} { } if {[catch {file stat $a l}]} { return 0} - set at $l(ctime) + set at $l(mtime) if {[catch {file stat $b l}]} { return 0} - set bt $l(ctime) + set bt $l(mtime) if {$at < $bt} { return -1 } if {$at > $bt} { return 1 } diff --git a/var/mongoose/lib/bin/auto b/var/mongoose/lib/bin/auto index ed068d0..f9b18e2 100755 --- a/var/mongoose/lib/bin/auto +++ b/var/mongoose/lib/bin/auto @@ -4,7 +4,9 @@ source /mod/webif/lib/setup require lock system.class ts.class tdelete pretty_size browse.class \ safe_delete settings.class plugin -set loglevel [[settings] autolog] +set settings [settings] +set loglevel [$settings autolog] +set audiomp3 [$settings audiomp3] if {![acquire_lock webif_auto]} { puts "Cannot acquire exclusive lock, terminating." @@ -443,12 +445,14 @@ proc do_mp3 {ts} { dsc [$ts size] log " MP3: $file" 0 - log " Converting..." 0 + log " Converting... [$::settings audiomp3descr $::audiomp3]" 0 if {[catch { - foreach line [split \ - [exec nice -n 19 /mod/bin/ffmpeg -y -benchmark -v 0 \ - -i $file.ts \ - -f mp3 -vn -acodec copy $tmp/mp3.mp3] "\n"] { + set cmd [list nice -n 19 \ + /mod/bin/ffmpeg -y -benchmark -v 0 -i "$file.ts" \ + -f mp3 -vn] + if {!$::audiomp3} { lappend cmd -acodec copy } + lappend cmd "$tmp/mp3.mp3" + foreach line [split [exec {*}$cmd] "\n"] { log $line 0 } } msg]} { diff --git a/var/mongoose/lib/pretty_size b/var/mongoose/lib/pretty_size index 15e7c5c..84f10c7 100644 --- a/var/mongoose/lib/pretty_size +++ b/var/mongoose/lib/pretty_size @@ -7,7 +7,7 @@ if {![exists -proc pretty_size]} { set size $($size / 1024.0) } - set size [format "%.2f" $size] + set size [string trimright [format "%.2f" $size] "0."] return "$size [lindex $units $i]" } diff --git a/var/mongoose/lib/settings.class b/var/mongoose/lib/settings.class index 0667c3f..56a4414 100644 --- a/var/mongoose/lib/settings.class +++ b/var/mongoose/lib/settings.class @@ -32,6 +32,7 @@ class settings { genrededup 0 autolog 0 changechangenc 0 + audiomp3 0 } settings method hostname {{name ""}} { @@ -197,6 +198,17 @@ settings method autolog {{level -1}} { return [$self _nval_setting autolog $level] } +settings method audiomp3 {{val -1}} { + return [$self _nval_setting audiomp3 $val] +} + +settings method audiomp3descr {val} { + switch $val { + 1 { return "MPEG-1 Audio Layer III (MP3)" } + default { return "MPEG-1 Audio Layer II (MP2)" } + } +} + settings method channel_groups {} { set ret "" set db [sqlite3.open /var/lib/humaxtv/setup.db] diff --git a/var/mongoose/lib/ts.class b/var/mongoose/lib/ts.class index 00d0906..69714b1 100644 --- a/var/mongoose/lib/ts.class +++ b/var/mongoose/lib/ts.class @@ -34,8 +34,7 @@ ts method duration {{raw 0}} { } ts method size {} { - file stat $file st - return $st(size) + return [file size $file] } ts method _parse {line} {