diff --git a/CONTROL/control b/CONTROL/control
index 0cc75ab..7beff8c 100644
--- a/CONTROL/control
+++ b/CONTROL/control
@@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
-Version: 0.13.2
+Version: 0.13.3
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.4-1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.10),hmt(>=1.1.13),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05)
diff --git a/var/mongoose/html/browse/assets.jim b/var/mongoose/html/browse/assets.jim
index 0d77176..1112095 100755
--- a/var/mongoose/html/browse/assets.jim
+++ b/var/mongoose/html/browse/assets.jim
@@ -21,8 +21,8 @@ if {$model eq "HDR"} {
}
if {[system pkginst ffmpeg]} {
puts {
-
Extract Audio
- Extract to MPG
+ Extract Audio
+ Extract to MPG
}
}
if $nicesplice {
@@ -77,7 +77,16 @@ if $flatten {
puts {
Auto-Expire
- Auto-MPG Extract
+}
+
+if {[system pkginst ffmpeg]} {
+ puts {
+ Auto-Audio Extract
+ Auto-MPG Extract
+ }
+}
+
+puts {
diff --git a/var/mongoose/html/browse/script.js b/var/mongoose/html/browse/script.js
index 78b51e6..4a4bb9a 100755
--- a/var/mongoose/html/browse/script.js
+++ b/var/mongoose/html/browse/script.js
@@ -358,6 +358,7 @@ function preparedmenu(el, menu)
fixdmenu(el, menu, 'autodedup', '#dedup', 'Auto-dedup', 0);
fixdmenu(el, menu, 'autodecrypt', '#decrypt', 'Auto-decrypt', 1);
fixdmenu(el, menu, 'autompg', '#mpg', 'Auto-mpg', 0);
+ fixdmenu(el, menu, 'automp3', '#mp3', 'Auto-audio', 0);
fixdmenu(el, menu, 'autoexpire', '#expire', 'Auto-expire', 0);
}
@@ -569,6 +570,10 @@ var dmenuclick = function(action, el, pos)
flagdir(file, 'autompg', iconset, results, el);
break;
+ case 'mp3':
+ flagdir(file, 'automp3', iconset, results, el);
+ break;
+
case 'shrink':
flagdir(file, 'autoshrink', iconset, results, el);
break;
diff --git a/var/mongoose/html/css/jquery.contextMenu.css b/var/mongoose/html/css/jquery.contextMenu.css
index 35fe861..f0a49a2 100644
--- a/var/mongoose/html/css/jquery.contextMenu.css
+++ b/var/mongoose/html/css/jquery.contextMenu.css
@@ -70,6 +70,7 @@
.contextMenu LI.decrypt A { background-image: url(/img/context/decrypt.png); }
.contextMenu LI.decryptr A { background-image: url(/img/context/decryptr.png); }
.contextMenu LI.mpg A { background-image: url(/img/context/mpg.png); }
+.contextMenu LI.mp3 A { background-image: url(/img/context/mp3.png); }
.contextMenu LI.clock A { background-image: url(/img/context/clock.png); }
diff --git a/var/mongoose/html/img/context/mp3.png b/var/mongoose/html/img/context/mp3.png
new file mode 100644
index 0000000..690548c
Binary files /dev/null and b/var/mongoose/html/img/context/mp3.png differ
diff --git a/var/mongoose/html/img/mp3.png b/var/mongoose/html/img/mp3.png
new file mode 120000
index 0000000..5e007ee
--- /dev/null
+++ b/var/mongoose/html/img/mp3.png
@@ -0,0 +1 @@
+context/mp3.png
\ No newline at end of file
diff --git a/var/mongoose/lib/bin/auto b/var/mongoose/lib/bin/auto
index cec8e73..82f9718 100755
--- a/var/mongoose/lib/bin/auto
+++ b/var/mongoose/lib/bin/auto
@@ -288,7 +288,7 @@ proc do_mpg {ts} {
}
if {[$ts get definition] eq "HD"} {
- # Cannot extract a useful MP3 from a HD recording.
+ # Cannot extract a useful MPG from a HD recording.
return
}
@@ -317,6 +317,59 @@ proc do_mpg {ts} {
file rename $tmp/mpg.mpg $file.mpg
}
+proc do_mp3 {ts} {
+ global tmp tsgroup
+
+ set file [file rootname [$ts get file]]
+
+ if {[file exists $file.mp3]} {
+ # Already done.
+ return
+ }
+
+ if {[$ts flag "ODEncrypted"]} {
+ log " Not decrypted."
+ return
+ }
+
+ if {[$ts get definition] eq "HD"} {
+ # Cannot extract a useful MP3 from a HD recording.
+ return
+ }
+
+ if {[$ts inuse]} {
+ log " In use." 1
+ return
+ }
+ dsc [$ts size]
+
+ log " MP3: $file" 1
+ log " Converting..." 1
+ 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"] {
+ log $line 1
+ }
+ } msg]} {
+ log "Error during mp3 extract: $msg" 1
+ return
+ }
+
+ if {[system pkginst id3v2]} {
+ log [exec /mod/bin/id3v2 \
+ --song "[$ts get title]" \
+ --comment "[$ts get synopsis]" \
+ --album "[$ts get channel_name]" \
+ --year "[clock format [$ts get start] -format {%Y}]" \
+ "$tmp/mp3.mp3"]
+ }
+
+ # Move the MP3 into the local directory
+ file rename $tmp/mp3.mp3 $file.mp3
+}
+
proc entries {dir callback} {
foreach entry [readdir -nocomplain $dir] {
if {![string match {*.ts} $entry} continue
@@ -341,6 +394,11 @@ proc mpg {dir} {
entries $dir do_mpg
}
+proc mp3 {dir} {
+ log "MP3: \[$dir]"
+ entries $dir do_mp3
+}
+
proc expire {dir} {
global ax_days
log "EXPIRE: \[$dir]"
@@ -402,7 +460,7 @@ if {[llength $argv] > 0} {
set debug 1
foreach arg $argv { scan $root $arg }
} else {
- foreach arg {dedup decrypt shrink mpg expire} {
+ foreach arg {dedup decrypt shrink mpg mp3 expire} {
set st [clock milliseconds]
scan $root $arg
log "$arg scan completed in [elapsed $st] seconds." 1
diff --git a/var/mongoose/lib/browse.class b/var/mongoose/lib/browse.class
index f03525e..f16a133 100644
--- a/var/mongoose/lib/browse.class
+++ b/var/mongoose/lib/browse.class
@@ -83,6 +83,13 @@ proc {dir iconset} {dir} {
lappend attrs "autompg=1"
}
+ set automp3 0
+ if {[file exists "$dir/.automp3"]} {
+ set automp3 1
+ lappend icons [_addicon "/img/mp3.png" "Auto-Audio Extract"]
+ lappend attrs "automp3=1"
+ }
+
set autoexpire 0
if {[file exists "$dir/.autoexpire"]} {
set days [{dir expiry} $dir]