add automp3, fix ffmpeg

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1440 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2013-03-06 22:49:28 +00:00
parent d4a4af756d
commit 612f9f8866
8 changed files with 87 additions and 6 deletions

View File

@ -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)

View File

@ -21,8 +21,8 @@ if {$model eq "HDR"} {
}
if {[system pkginst ffmpeg]} {
puts {
<li><a href=#audio>Extract Audio</a></li>
<li><a href=#mpg>Extract to MPG</a></li>
<li class=mp3><a href=#audio>Extract Audio</a></li>
<li class=mpg><a href=#mpg>Extract to MPG</a></li>
}
}
if $nicesplice {
@ -77,7 +77,16 @@ if $flatten {
puts {
<li class=clock><a href=#expire>Auto-Expire</a></li>
<li class=mpg><a href=#mpg>Auto-MPG Extract</a></li>
}
if {[system pkginst ffmpeg]} {
puts {
<li class=mp3><a href=#mp3>Auto-Audio Extract</a></li>
<li class=mpg><a href=#mpg>Auto-MPG Extract</a></li>
}
}
puts {
</ul>
<div id=renameform title="Rename media file" style="display: none">

View File

@ -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;

View File

@ -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); }

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

View File

@ -0,0 +1 @@
context/mp3.png

View File

@ -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

View File

@ -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]