forked from hummypkg/webif
auto mpg extract, fix rename
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1325 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
f7933beaf8
commit
7172c7c107
@ -63,6 +63,7 @@ if $flatten {
|
||||
}
|
||||
|
||||
puts {
|
||||
<li class=mpg><a href=#mpg>Auto-MPG Extract</a></li>
|
||||
</ul>
|
||||
|
||||
<div id=renameform title="Rename media file" style="display: none">
|
||||
|
@ -294,7 +294,10 @@ function preparemenu(el, menu)
|
||||
else
|
||||
{
|
||||
$(menu).enableContextMenuItems('#audio');
|
||||
$(menu).enableContextMenuItems('#mpg');
|
||||
if (el.attr('def') == 'HD')
|
||||
$(menu).disableContextMenuItems('#mpg');
|
||||
else
|
||||
$(menu).enableContextMenuItems('#mpg');
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -344,6 +347,15 @@ function preparedmenu(el, menu)
|
||||
$(menu).changeContextMenuItem('#decrypt',
|
||||
'Enable Auto-decrypt');
|
||||
}
|
||||
if (el.attr('autompg') != undefined)
|
||||
{
|
||||
if (el.attr('autompg') > 0)
|
||||
$(menu).changeContextMenuItem('#mpg',
|
||||
'Disable Auto-mpg');
|
||||
else
|
||||
$(menu).changeContextMenuItem('#mpg',
|
||||
'Enable Auto-mpg');
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
@ -520,6 +532,12 @@ var dmenuclick = function(action, el, pos)
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
break;
|
||||
|
||||
case 'mpg':
|
||||
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
|
||||
'&flag=autompg';
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
break;
|
||||
|
||||
case 'shrink':
|
||||
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
|
||||
'&flag=autoshrink';
|
||||
|
@ -40,6 +40,10 @@ if {[file isdirectory $file]} {
|
||||
if {"$dir/$newfile.ts" ne "$file"} { ts renamegroup $file $newfile }
|
||||
} else {
|
||||
#puts "Normal file."
|
||||
if {$newfile ne ""} { ts renamegroup $file $newfile }
|
||||
if {$newfile ne ""} {
|
||||
set newfile "$dir/$newfile[file extension $file]"
|
||||
puts "Rename ($file) -> ($newfile)"
|
||||
file rename $file $newfile
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,5 +67,6 @@
|
||||
.contextMenu LI.compress A { background-image: url(/img/context/compress.png); }
|
||||
.contextMenu LI.dedup A { background-image: url(/img/context/dedup.png); }
|
||||
.contextMenu LI.decrypt A { background-image: url(/img/context/decrypt.png); }
|
||||
.contextMenu LI.mpg A { background-image: url(/img/context/mpg.png); }
|
||||
|
||||
|
||||
|
BIN
var/mongoose/html/img/context/mpg.png
Normal file
BIN
var/mongoose/html/img/context/mpg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 877 B |
1
var/mongoose/html/img/mpg.png
Symbolic link
1
var/mongoose/html/img/mpg.png
Symbolic link
@ -0,0 +1 @@
|
||||
context/mpg.png
|
@ -76,7 +76,7 @@ proc do_shrink {ts} {
|
||||
puts " Estimate $perc% saving."
|
||||
puts " Shrinking..."
|
||||
if {[catch {
|
||||
puts [exec /mod/bin/stripts -q $file $tmp/shrunk]
|
||||
puts [exec nice -n 19 /mod/bin/stripts -q $file $tmp/shrunk]
|
||||
} msg]} {
|
||||
puts "Error during shrink: $msg"
|
||||
return
|
||||
@ -171,6 +171,42 @@ proc do_decrypt {ts} {
|
||||
puts " Done."
|
||||
}
|
||||
|
||||
proc do_mpg {ts} {
|
||||
global tmp tsgroup
|
||||
|
||||
set file [file rootname [$ts get file]]
|
||||
|
||||
if {[file exists $file.mpg]} {
|
||||
# Already done.
|
||||
return
|
||||
}
|
||||
|
||||
if {[$ts flag "ODEncrypted"]} {
|
||||
#puts " Not decrypted."
|
||||
return
|
||||
}
|
||||
|
||||
if {[$ts get definition] eq "HD"} {
|
||||
# Cannot extract a useful MP3 from a HD recording.
|
||||
return
|
||||
}
|
||||
|
||||
puts " MPG: $file"
|
||||
puts " Converting..."
|
||||
if {[catch {
|
||||
puts [exec nice -n 19 /mod/bin/ffmpeg -y -benchmark -v 0 \
|
||||
-i $file.ts \
|
||||
-map 0:0 -map 0:1 \
|
||||
-vcodec copy -acodec copy $tmp/mpg.mpg]
|
||||
} msg]} {
|
||||
puts "Error during mpg extract: $msg"
|
||||
return
|
||||
}
|
||||
|
||||
# Move the MPG into the local directory
|
||||
file rename $tmp/mpg.mpg $file.mpg
|
||||
}
|
||||
|
||||
proc entries {dir callback} {
|
||||
foreach entry [readdir -nocomplain $dir] {
|
||||
dsc
|
||||
@ -195,6 +231,11 @@ proc decrypt {dir} {
|
||||
entries $dir do_decrypt
|
||||
}
|
||||
|
||||
proc mpg {dir} {
|
||||
puts "MPG: \[$dir]"
|
||||
entries $dir do_mpg
|
||||
}
|
||||
|
||||
proc scan {dir attr} {{indent 0}} {
|
||||
incr indent 2
|
||||
|
||||
@ -219,7 +260,7 @@ set root [system mediaroot]
|
||||
if {[llength $argv] > 0} {
|
||||
foreach arg $argv { scan $root $arg }
|
||||
} else {
|
||||
foreach arg {dedup decrypt shrink} {
|
||||
foreach arg {dedup decrypt shrink mpg} {
|
||||
scan $root $arg
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,13 @@ proc {dir iconset} {dir} {
|
||||
lappend attrs "autodecrypt=$autodecrypt"
|
||||
}
|
||||
|
||||
set autompg 0
|
||||
if {[file exists "$dir/.autompg"]} {
|
||||
set autompg 1
|
||||
lappend icons [_addicon "/img/mpg.png" "Auto-MPG Extract"]
|
||||
lappend attrs "autompg=$autompg"
|
||||
}
|
||||
|
||||
return [list $icons $attrs]
|
||||
}
|
||||
|
||||
|
@ -254,6 +254,7 @@ proc {ts genrelist} {} {
|
||||
0 { Unclassified Unclassified }
|
||||
16 { Film Movie }
|
||||
32 { "News & Factual" News }
|
||||
48 { Entertainment Special }
|
||||
64 { Sport Sports }
|
||||
80 { Children Children }
|
||||
96 { Entertainment Special }
|
||||
|
Loading…
Reference in New Issue
Block a user