move modules to subdirectories and split JS/CSS out
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@725 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
d307699ab1
commit
a014fec23d
@ -1,109 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require sqlite3
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class system.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 mp3 \
|
||||
-vn -acodec copy "${base}.mp3"]
|
||||
|
||||
if {[system pkginst id3v2]} {
|
||||
puts [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}]" \
|
||||
"${base}.mp3"]
|
||||
}
|
||||
|
||||
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||
puts "Time taken: $xtime"
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
header
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type=\"text/javascript\" src=\"/js/jquery.progressbar.js\"></script>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
<tr><th>File:</th><td>$rfile</td></tr>
|
||||
<tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr>
|
||||
</table>
|
||||
"
|
||||
|
||||
puts {
|
||||
|
||||
<div style="margin-top: 10px"></div>
|
||||
<div id=audiodiv><button id=audioit>Perform audio extraction</button></div>
|
||||
<div id=progressdiv style="display: none">
|
||||
Extracting audio: <div id=progressbar></div>
|
||||
}
|
||||
puts "<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
rfile=\"[cgi_quote_url $rfile]\"
|
||||
style=\"display: none\">Back to media list</button>"
|
||||
puts {
|
||||
<div id=output class=pre style="margin-top: 10px"></div>
|
||||
</div>
|
||||
|
||||
<script type=text/javascript>
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('/cgi-bin/browse/audio_progress.jim?file='
|
||||
+ $('#back').attr('rfile'), function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
|
||||
});
|
||||
|
||||
$('#audioit').button().click(function() {
|
||||
$('#audiodiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').load(document.URL + '&do=it', function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
52
var/mongoose/cgi-bin/browse/audio/audio.jim
Executable file
52
var/mongoose/cgi-bin/browse/audio/audio.jim
Executable file
@ -0,0 +1,52 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require sqlite3
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class system.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]
|
||||
|
||||
header
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type=text/javascript src=/js/jquery.progressbar.js></script>
|
||||
<script type=text/javascript src=audio.js></script>
|
||||
|
||||
<fieldset class=cleft>
|
||||
<legend>Audio Extraction</legend>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
<tr><th>File:</th><td>$rfile</td></tr>
|
||||
<tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr>
|
||||
</table>
|
||||
|
||||
<span class=hidden id=params
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
rfile=\"[cgi_quote_url $rfile]\"
|
||||
></span>
|
||||
|
||||
<div id=audiodiv style=\"padding: 1em\">
|
||||
<button id=audioit>Perform audio extraction</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv class=hidden>
|
||||
Extracting audio: <div id=progressbar></div>
|
||||
</div>
|
||||
|
||||
<button id=back class=hidden>Back to media list</button>
|
||||
|
||||
<div id=output class=pre style=\"margin-top: 10px\"></div>
|
||||
</fieldset>
|
||||
|
||||
"
|
||||
|
35
var/mongoose/cgi-bin/browse/audio/audio.js
Executable file
35
var/mongoose/cgi-bin/browse/audio/audio.js
Executable file
@ -0,0 +1,35 @@
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('progress.jim?file=' + $('#params').attr('rfile'),
|
||||
function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
|
||||
});
|
||||
|
||||
$('#audioit').button().click(function() {
|
||||
$('#audiodiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').load('execute.jim?file=' + $('#params').attr('rfile'),
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
39
var/mongoose/cgi-bin/browse/audio/execute.jim
Executable file
39
var/mongoose/cgi-bin/browse/audio/execute.jim
Executable file
@ -0,0 +1,39 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require sqlite3
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class system.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]
|
||||
|
||||
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 mp3 \
|
||||
-vn -acodec copy "${base}.mp3"]
|
||||
|
||||
if {[system pkginst id3v2]} {
|
||||
puts [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}]" \
|
||||
"${base}.mp3"]
|
||||
}
|
||||
|
||||
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||
puts "Time taken: $xtime"
|
||||
|
@ -366,7 +366,7 @@ var menuclick = function(action, el, pos)
|
||||
break;
|
||||
|
||||
case 'crop':
|
||||
window.location.href = '/cgi-bin/browse/crop.jim?file=' +
|
||||
window.location.href = '/cgi-bin/browse/crop/crop.jim?file=' +
|
||||
file;
|
||||
break;
|
||||
|
||||
@ -376,12 +376,12 @@ var menuclick = function(action, el, pos)
|
||||
break;
|
||||
|
||||
case 'decrypt':
|
||||
window.location.href = '/cgi-bin/browse/decrypt.jim?file=' +
|
||||
file;
|
||||
window.location.href =
|
||||
'/cgi-bin/browse/decrypt/decrypt.jim?file=' + file;
|
||||
break;
|
||||
|
||||
case 'audio':
|
||||
window.location.href = '/cgi-bin/browse/audio.jim?file=' +
|
||||
window.location.href = '/cgi-bin/browse/audio/audio.jim?file=' +
|
||||
file;
|
||||
break;
|
||||
|
||||
@ -618,7 +618,7 @@ var dmenuclick = function(action, el, pos)
|
||||
files.push($(this).attr('file'));
|
||||
});
|
||||
//console.log("%o", files);
|
||||
window.location.href = '/cgi-bin/browse/join.jim?files=' +
|
||||
window.location.href = '/cgi-bin/browse/join/join.jim?files=' +
|
||||
files.join();
|
||||
});
|
||||
|
||||
|
@ -1,191 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class pretty_size
|
||||
|
||||
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 cropstart [clock milliseconds]
|
||||
|
||||
set base [file rootname $rfile]
|
||||
set origdir "$dir/_original"
|
||||
if {![file exists $origdir]} { file mkdir $origdir }
|
||||
|
||||
set shname [file tail $base]
|
||||
puts "Processing $shname"
|
||||
|
||||
if {[file exists "$origdir/$shname.ts"]} {
|
||||
puts "This recording already exists within _original"
|
||||
puts "Cannot continue."
|
||||
exit
|
||||
}
|
||||
|
||||
puts "Moving recording to $origdir"
|
||||
foreach f [glob -nocomplain "${base}.*"] {
|
||||
set tail [file tail $f]
|
||||
puts " $tail"
|
||||
file rename $f "$origdir/$tail"
|
||||
}
|
||||
|
||||
puts [exec /mod/bin/nicesplice \
|
||||
-in "$origdir/$shname" \
|
||||
-out "$dir/$shname" \
|
||||
-cutBookMarks]
|
||||
|
||||
set newname "$shname-[clock seconds]"
|
||||
puts "Renaming file group to $newname"
|
||||
ts renamegroup "$dir/$shname.ts" $newname
|
||||
exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
|
||||
|
||||
set croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0]
|
||||
puts "Time taken: $croptime"
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
header
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type=\"text/javascript\" src=\"/js/jquery.progressbar.js\"></script>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
<tr><th>File:</th><td>$rfile</td></tr>
|
||||
<tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr>
|
||||
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
|
||||
<tr><th>Bookmarks:</th><td>[$ts get bookmarks] @ "
|
||||
|
||||
set flag 0
|
||||
foreach b [$ts bookmarks] {
|
||||
if $flag { puts -nonewline ", " }
|
||||
incr flag
|
||||
puts -nonewline [clock format $b -format "%T"]
|
||||
}
|
||||
|
||||
puts "</td></tr><tr><th>File</th><td>"
|
||||
|
||||
puts "<div style=\"position: relative; top: -10px\">"
|
||||
|
||||
proc div {type left right} {
|
||||
set width $($right - $left)
|
||||
puts "<div class=$type style=\"left: ${left}px; width: ${width}px\">
|
||||
$type</div>"
|
||||
}
|
||||
|
||||
set keeping 0
|
||||
set last 0
|
||||
set start -1
|
||||
foreach b [$ts bookmarks] {
|
||||
if {$start < 0} {
|
||||
set start $b
|
||||
continue
|
||||
}
|
||||
set end $b
|
||||
|
||||
incr keeping $($end - $start)
|
||||
|
||||
set left $($start * 500 / $len)
|
||||
set right $($end * 500 / $len)
|
||||
|
||||
div cut $last $($left - 1)
|
||||
div keep $left $($right - 1)
|
||||
|
||||
set last $right
|
||||
|
||||
set start -1
|
||||
}
|
||||
|
||||
if {$start > 0} {
|
||||
incr keeping $($len - $start)
|
||||
set left $($start * 500 / $len)
|
||||
div cut $last $($left - 1)
|
||||
div keep $left 500
|
||||
} else {
|
||||
div cut $last 500
|
||||
}
|
||||
|
||||
set keepperc $($keeping * 100.0 / $len)
|
||||
set esttime $(int($keeping * 0.025))
|
||||
if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) }
|
||||
|
||||
puts "
|
||||
</div>
|
||||
</td></tr>
|
||||
<tr><th>Keeping:</th><td>
|
||||
[clock format $keeping -format "%T"] ([format "%.2f" $keepperc]%)
|
||||
</td></tr>
|
||||
<tr><th>Time:</th>
|
||||
<td>Cropping will take around [clock format $esttime -format "%T"]</td></tr>
|
||||
</table>
|
||||
"
|
||||
|
||||
puts "
|
||||
<div id=cropdiv>
|
||||
<button id=cropit>Perform crop operation</button>
|
||||
</div>
|
||||
<div id=progressdiv style=\"display: none\">
|
||||
Cropping: <div id=progressbar></div>
|
||||
<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
rfile=\"[cgi_quote_url $rfile]\"
|
||||
perc=\"$keepperc\"
|
||||
style=\"display: none\">Back to media list</button>"
|
||||
puts {
|
||||
<div id=output class=pre style="margin-top: 10px"></div>
|
||||
</div>
|
||||
|
||||
<script type=text/javascript>
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('/cgi-bin/browse/crop_progress.jim'
|
||||
+ '?perc=' + $('#back').attr('perc')
|
||||
+ '&file=' + $('#back').attr('rfile'),
|
||||
function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
|
||||
});
|
||||
|
||||
$('#cropit').button().click(function() {
|
||||
$('#cropdiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').text('Please do not interrupt...')
|
||||
.load(document.URL + '&do=it',
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
117
var/mongoose/cgi-bin/browse/crop/crop.jim
Executable file
117
var/mongoose/cgi-bin/browse/crop/crop.jim
Executable file
@ -0,0 +1,117 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class pretty_size
|
||||
|
||||
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]
|
||||
|
||||
header
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type=text/javascript src=/js/jquery.progressbar.js></script>
|
||||
<script type=text/javascript src=crop.js></script>
|
||||
|
||||
<fieldset class=cleft>
|
||||
<legend>Crop recording</legend>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
<tr><th>File:</th><td>$rfile</td></tr>
|
||||
<tr><th>Length:</th><td>[clock format $len -format \"%T\"]</td></tr>
|
||||
<tr><th>Size:</th><td>[pretty_size [$ts size]] ([$ts get definition])</td></tr>
|
||||
<tr><th>Bookmarks:</th><td>[$ts get bookmarks] @ "
|
||||
|
||||
set flag 0
|
||||
foreach b [$ts bookmarks] {
|
||||
if $flag { puts -nonewline ", " }
|
||||
incr flag
|
||||
puts -nonewline [clock format $b -format "%T"]
|
||||
}
|
||||
|
||||
puts "</td></tr><tr><th>File</th><td>"
|
||||
|
||||
puts "<div style=\"position: relative; top: -10px\">"
|
||||
|
||||
proc div {type left right} {
|
||||
set width $($right - $left)
|
||||
puts "<div class=$type style=\"left: ${left}px; width: ${width}px\">
|
||||
$type</div>"
|
||||
}
|
||||
|
||||
set keeping 0
|
||||
set last 0
|
||||
set start -1
|
||||
foreach b [$ts bookmarks] {
|
||||
if {$start < 0} {
|
||||
set start $b
|
||||
continue
|
||||
}
|
||||
set end $b
|
||||
|
||||
incr keeping $($end - $start)
|
||||
|
||||
set left $($start * 500 / $len)
|
||||
set right $($end * 500 / $len)
|
||||
|
||||
div cut $last $($left - 1)
|
||||
div keep $left $($right - 1)
|
||||
|
||||
set last $right
|
||||
|
||||
set start -1
|
||||
}
|
||||
|
||||
if {$start > 0} {
|
||||
incr keeping $($len - $start)
|
||||
set left $($start * 500 / $len)
|
||||
div cut $last $($left - 1)
|
||||
div keep $left 500
|
||||
} else {
|
||||
div cut $last 500
|
||||
}
|
||||
|
||||
set keepperc $($keeping * 100.0 / $len)
|
||||
set esttime $(int($keeping * 0.025))
|
||||
if {[$ts get definition] eq "HD"} { set esttime $($esttime * 4) }
|
||||
|
||||
puts "
|
||||
</div>
|
||||
</td></tr>
|
||||
<tr><th>Keeping:</th><td>
|
||||
[clock format $keeping -format "%T"] ([format "%.2f" $keepperc]%)
|
||||
</td></tr>
|
||||
<tr><th>Time:</th>
|
||||
<td>Cropping will take around [clock format $esttime -format "%T"]</td></tr>
|
||||
</table>
|
||||
|
||||
<span class=hidden id=params
|
||||
file=\"[cgi_quote_url $rfile]\"
|
||||
perc=\"$keepperc\"
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
></span>
|
||||
|
||||
<div id=cropdiv style=\"padding: 1em\">
|
||||
<button id=cropit>Perform crop operation</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv class=hidden>
|
||||
Cropping: <div id=progressbar></div>
|
||||
</div>
|
||||
|
||||
<button id=back class=hidden>Back to media list</button>
|
||||
|
||||
<div id=output class=pre style=\"margin-top: 10px\"></div>
|
||||
</fieldset>
|
||||
|
||||
"
|
||||
|
38
var/mongoose/cgi-bin/browse/crop/crop.js
Executable file
38
var/mongoose/cgi-bin/browse/crop/crop.js
Executable file
@ -0,0 +1,38 @@
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
var perc = $('#params').attr('perc');
|
||||
var file = $('#params').attr('file');
|
||||
|
||||
$.get('progress.jim' + '?perc=' + perc + '&file=' + file,
|
||||
function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
|
||||
});
|
||||
|
||||
$('#cropit').button().click(function() {
|
||||
$('#cropdiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').text('Please do not interrupt...')
|
||||
.load('execute.jim?file=' + $('#params').attr('file'),
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
52
var/mongoose/cgi-bin/browse/crop/execute.jim
Executable file
52
var/mongoose/cgi-bin/browse/crop/execute.jim
Executable file
@ -0,0 +1,52 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class pretty_size
|
||||
|
||||
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]
|
||||
|
||||
set cropstart [clock milliseconds]
|
||||
|
||||
set base [file rootname $rfile]
|
||||
set origdir "$dir/_original"
|
||||
if {![file exists $origdir]} { file mkdir $origdir }
|
||||
|
||||
set shname [file tail $base]
|
||||
puts "Processing $shname"
|
||||
|
||||
if {[file exists "$origdir/$shname.ts"]} {
|
||||
puts "This recording already exists within _original"
|
||||
puts "Cannot continue."
|
||||
exit
|
||||
}
|
||||
|
||||
puts "Moving recording to $origdir"
|
||||
foreach f [glob -nocomplain "${base}.*"] {
|
||||
set tail [file tail $f]
|
||||
puts " $tail"
|
||||
file rename $f "$origdir/$tail"
|
||||
}
|
||||
|
||||
puts [exec /mod/bin/nicesplice \
|
||||
-in "$origdir/$shname" \
|
||||
-out "$dir/$shname" \
|
||||
-cutBookMarks]
|
||||
|
||||
set newname "$shname-[clock seconds]"
|
||||
puts "Renaming file group to $newname"
|
||||
ts renamegroup "$dir/$shname.ts" $newname
|
||||
exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
|
||||
|
||||
set croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0]
|
||||
puts "Time taken: $croptime"
|
||||
|
@ -1,133 +0,0 @@
|
||||
#!/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]
|
||||
lassign [$ts dlnaloc] url
|
||||
|
||||
if {[cgi_get do] eq "it"} {
|
||||
set xstart [clock milliseconds]
|
||||
|
||||
set base [file rootname $rfile]
|
||||
set origdir "$dir/_original"
|
||||
if {![file exists $origdir]} { file mkdir $origdir }
|
||||
|
||||
set shname [file tail $base]
|
||||
puts "Processing $shname"
|
||||
|
||||
exec wget -O "$rfile.decrypting" $url
|
||||
|
||||
puts "Moving recording to $origdir"
|
||||
|
||||
foreach f [glob -nocomplain "${base}.*"] {
|
||||
if {[file extension $f] eq ".decrypting"} { continue }
|
||||
set tail [file tail $f]
|
||||
puts " $tail"
|
||||
file rename $f "${origdir}/$tail"
|
||||
}
|
||||
|
||||
file rename "$rfile.decrypting" $rfile
|
||||
|
||||
foreach ext {nts hmt thm} {
|
||||
set sidecar "$shname.$ext"
|
||||
if {[file exists "$origdir/$sidecar"]} {
|
||||
puts "Copying back sidecar $ext"
|
||||
file copy "$origdir/$sidecar" "$dir/$sidecar"
|
||||
}
|
||||
}
|
||||
|
||||
if {[file exists "$dir/$shname.hmt"]} {
|
||||
exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
|
||||
}
|
||||
|
||||
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||
puts "Time taken: $xtime"
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
header
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type=\"text/javascript\" src=\"/js/jquery.progressbar.js\"></script>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
<tr><th>File:</th><td>$rfile</td></tr>
|
||||
<tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr>
|
||||
<tr><th>DLNA URL</th><td>$url</td></tr>
|
||||
</table>
|
||||
"
|
||||
|
||||
if {$url eq ""} {
|
||||
puts "This file has not been indexed by the media server.
|
||||
Cannot decrypt."
|
||||
puts "Have you enabled <i>Content Sharing</i> in the Humax menus?"
|
||||
exit
|
||||
}
|
||||
|
||||
puts {
|
||||
|
||||
<div style="margin-top: 10px"></div>
|
||||
<div id=decryptdiv><button id=decryptit>Perform decryption</button></div>
|
||||
<div id=progressdiv style="display: none">
|
||||
Decrypting: <div id=progressbar></div>
|
||||
}
|
||||
puts "<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
rfile=\"[cgi_quote_url $rfile]\"
|
||||
style=\"display: none\">Back to media list</button>"
|
||||
puts {
|
||||
<div id=output class=pre style="margin-top: 10px"></div>
|
||||
</div>
|
||||
|
||||
<script type=text/javascript>
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('/cgi-bin/browse/decrypt_progress.jim?file='
|
||||
+ $('#back').attr('rfile'), function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
|
||||
});
|
||||
|
||||
$('#decryptit').button().click(function() {
|
||||
$('#decryptdiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').load(document.URL + '&do=it', function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
64
var/mongoose/cgi-bin/browse/decrypt/decrypt.jim
Executable file
64
var/mongoose/cgi-bin/browse/decrypt/decrypt.jim
Executable file
@ -0,0 +1,64 @@
|
||||
#!/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]
|
||||
lassign [$ts dlnaloc] url
|
||||
|
||||
header
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type=text/javascript src=/js/jquery.progressbar.js></script>
|
||||
<script type=text/javascript src=decrypt.js></script>
|
||||
|
||||
<fieldset class=cleft>
|
||||
<legend>Decrypt in-place</legend>
|
||||
|
||||
<table class=keyval cellpadding=5>
|
||||
<tr><th>File:</th><td>$rfile</td></tr>
|
||||
<tr><th>Length:</th><td>[clock format $len -format "%T"]</td></tr>
|
||||
<tr><th>DLNA URL</th><td>$url</td></tr>
|
||||
</table>
|
||||
"
|
||||
|
||||
if {$url eq ""} {
|
||||
puts "This file has not been indexed by the media server.
|
||||
Cannot decrypt."
|
||||
puts "Have you enabled <i>Content Sharing</i> in the Humax menus?"
|
||||
exit
|
||||
}
|
||||
|
||||
puts "
|
||||
|
||||
<span class=hidden id=params
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
file=\"[cgi_quote_url $rfile]\"
|
||||
></span>
|
||||
|
||||
<div id=decryptdiv style=\"padding: 1em\">
|
||||
<button id=decryptit>Perform decryption</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv class=hidden>
|
||||
Decrypting: <div id=progressbar></div>
|
||||
</div>
|
||||
|
||||
<button id=back class=hidden>Back to media list</button>
|
||||
|
||||
<div id=output class=pre style=\"margin-top: 10px\"></div>
|
||||
</fieldset>
|
||||
|
||||
"
|
||||
|
35
var/mongoose/cgi-bin/browse/decrypt/decrypt.js
Executable file
35
var/mongoose/cgi-bin/browse/decrypt/decrypt.js
Executable file
@ -0,0 +1,35 @@
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('progress.jim?file=' + $('#params').attr('file'),
|
||||
function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
|
||||
});
|
||||
|
||||
$('#decryptit').button().click(function() {
|
||||
$('#decryptdiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').load('execute.jim?file=' + $('#params').attr('file'),
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
55
var/mongoose/cgi-bin/browse/decrypt/execute.jim
Executable file
55
var/mongoose/cgi-bin/browse/decrypt/execute.jim
Executable file
@ -0,0 +1,55 @@
|
||||
#!/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]
|
||||
lassign [$ts dlnaloc] url
|
||||
|
||||
set xstart [clock milliseconds]
|
||||
|
||||
set base [file rootname $rfile]
|
||||
set origdir "$dir/_original"
|
||||
if {![file exists $origdir]} { file mkdir $origdir }
|
||||
|
||||
set shname [file tail $base]
|
||||
puts "Processing $shname"
|
||||
|
||||
exec wget -O "$rfile.decrypting" $url
|
||||
|
||||
puts "Moving recording to $origdir"
|
||||
|
||||
foreach f [glob -nocomplain "${base}.*"] {
|
||||
if {[file extension $f] eq ".decrypting"} { continue }
|
||||
set tail [file tail $f]
|
||||
puts " $tail"
|
||||
file rename $f "${origdir}/$tail"
|
||||
}
|
||||
|
||||
file rename "$rfile.decrypting" $rfile
|
||||
|
||||
foreach ext {nts hmt thm} {
|
||||
set sidecar "$shname.$ext"
|
||||
if {[file exists "$origdir/$sidecar"]} {
|
||||
puts "Copying back sidecar $ext"
|
||||
file copy "$origdir/$sidecar" "$dir/$sidecar"
|
||||
}
|
||||
}
|
||||
|
||||
if {[file exists "$dir/$shname.hmt"]} {
|
||||
exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
|
||||
}
|
||||
|
||||
set xtime [expr [expr [clock milliseconds] - $xstart] / 1000.0]
|
||||
puts "Time taken: $xtime"
|
||||
|
@ -1,137 +0,0 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class pretty_size
|
||||
|
||||
puts "Content-Type: text/html\r\n\r\n"
|
||||
header
|
||||
|
||||
cgi_input 1
|
||||
#cgi_dump
|
||||
|
||||
puts {
|
||||
<style>
|
||||
#filelist { list-style-type: none; margin: 0; padding: 0; }
|
||||
#filelist li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em;
|
||||
height: 35px; }
|
||||
#filelist li span { position: absolute; margin-left: -1.3em; }
|
||||
span.pl { padding-left: 2em; }
|
||||
</style>
|
||||
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<script type="text/javascript" src="/js/jquery.progressbar.js"></script>
|
||||
<script type="text/javascript" src="/js/touchbridge.js"></script>
|
||||
|
||||
<p><b>
|
||||
Drag the files below into order, enter a name for the resulting file and then
|
||||
click the <i>Join</i> button.</b>
|
||||
}
|
||||
|
||||
puts "<ul id=filelist>"
|
||||
set esize 0
|
||||
foreach file [split [cgi_get files] ","] {
|
||||
set file [cgi_unquote_input $file]
|
||||
set dir [file dirname $file]
|
||||
set ts [ts fetch $file]
|
||||
puts "<li class=\"va ui-state-default\" id=\"$file\"><span
|
||||
class=\"va ui-icon ui-icon-arrowthick-2-n-s\"></span>
|
||||
<img class=va src=/img/Video_TS.png>
|
||||
<span class=pl>
|
||||
$file ([clock format [$ts duration 1] -format "%T"])
|
||||
\[[pretty_size [$ts size]]\]
|
||||
<br><i style=\"font-size: 0.8em\">[$ts get title]</i>
|
||||
</span>
|
||||
</li>"
|
||||
incr esize [$ts size]
|
||||
}
|
||||
puts "</ul>"
|
||||
|
||||
puts "
|
||||
<br><br>
|
||||
|
||||
<div id=joindiv>
|
||||
Name for joined file:
|
||||
<input id=dest name=dfile class=\"text ui-widget-content ui-corner-all\"
|
||||
length=20 maxlength=50>
|
||||
<button id=dojoin>Join</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv style=\"display: none\">
|
||||
Joining: <div id=progressbar></div>
|
||||
<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
esize=\"$esize\"
|
||||
style=\"display: none\">Back to media list</button>
|
||||
<div id=output class=pre style=\"margin-top: 10px\"></div>
|
||||
</div>
|
||||
"
|
||||
|
||||
puts {
|
||||
<script type=text/javascript>
|
||||
|
||||
$('#filelist li').hover(
|
||||
function() { $(this).css('cursor', 'pointer'); },
|
||||
function() { $(this).css('cursor', 'auto'); }
|
||||
);
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('/cgi-bin/browse/join_progress.jim'
|
||||
+ '?esize=' + $('#back').attr('esize')
|
||||
+ '&file=' + $('#back').attr('dir') + '/' + $('#dest').val(),
|
||||
function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
|
||||
});
|
||||
|
||||
$('#filelist').sortable().disableSelection();
|
||||
|
||||
$('#dojoin').button().attr('disabled', true).addClass('ui-state-disabled')
|
||||
.click(function() {
|
||||
var files = $('#filelist').sortable('toArray');
|
||||
var sfiles = new Array();
|
||||
for (x in files)
|
||||
sfiles.push(encodeURIComponent(files[x]));
|
||||
|
||||
$('#joindiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
|
||||
$('#output').text('Please do not interrupt...')
|
||||
.load('/cgi-bin/browse/join_backend.jim?files=' +
|
||||
sfiles.join() + '&dest=' + $('#dest').val(),
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
$('#dest').val('').keyup(function() {
|
||||
if ($(this).val().length > 0)
|
||||
$('#dojoin')
|
||||
.removeProp('disabled').removeClass('ui-state-disabled');
|
||||
else
|
||||
$('#dojoin')
|
||||
.prop('disabled', true).addClass('ui-state-disabled');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
footer
|
||||
|
6
var/mongoose/cgi-bin/browse/join/join.css
Normal file
6
var/mongoose/cgi-bin/browse/join/join.css
Normal file
@ -0,0 +1,6 @@
|
||||
#filelist { list-style-type: none; margin: 0; padding: 0; }
|
||||
#filelist li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em;
|
||||
height: 35px; }
|
||||
#filelist li span { position: absolute; margin-left: -1.3em; }
|
||||
span.pl { padding-left: 2em; }
|
||||
|
65
var/mongoose/cgi-bin/browse/join/join.jim
Executable file
65
var/mongoose/cgi-bin/browse/join/join.jim
Executable file
@ -0,0 +1,65 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/setup
|
||||
require ts.class pretty_size
|
||||
|
||||
puts "Content-Type: text/html\r\n\r\n"
|
||||
header
|
||||
|
||||
cgi_input 1
|
||||
#cgi_dump
|
||||
|
||||
puts "
|
||||
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
|
||||
<link href=join.css rel=stylesheet type=text/css />
|
||||
<script type=text/javascript src=/js/jquery.progressbar.js></script>
|
||||
<script type=text/javascript src=/js/touchbridge.js></script>
|
||||
<script type/text/javascript src=join.js></script>
|
||||
|
||||
<p><b>
|
||||
Drag the files below into order, enter a name for the resulting file and then
|
||||
click the <i>Join</i> button.</b>
|
||||
"
|
||||
|
||||
puts "<ul id=filelist>"
|
||||
set esize 0
|
||||
foreach file [split [cgi_get files] ","] {
|
||||
set file [cgi_unquote_input $file]
|
||||
set dir [file dirname $file]
|
||||
set ts [ts fetch $file]
|
||||
puts "<li class=\"va ui-state-default\" id=\"$file\"><span
|
||||
class=\"va ui-icon ui-icon-arrowthick-2-n-s\"></span>
|
||||
<img class=va src=/img/Video_TS.png>
|
||||
<span class=pl>
|
||||
$file ([clock format [$ts duration 1] -format "%T"])
|
||||
\[[pretty_size [$ts size]]\]
|
||||
<br><i style=\"font-size: 0.8em\">[$ts get title]</i>
|
||||
</span>
|
||||
</li>"
|
||||
incr esize [$ts size]
|
||||
}
|
||||
puts "</ul>"
|
||||
|
||||
puts "
|
||||
<br><br>
|
||||
|
||||
<div id=joindiv>
|
||||
Name for joined file:
|
||||
<input id=dest name=dfile class=\"text ui-widget-content ui-corner-all\"
|
||||
length=20 maxlength=50>
|
||||
<button id=dojoin>Join</button>
|
||||
</div>
|
||||
|
||||
<div id=progressdiv style=\"display: none\">
|
||||
Joining: <div id=progressbar></div>
|
||||
<button id=back
|
||||
dir=\"[cgi_quote_url $dir]\"
|
||||
esize=\"$esize\"
|
||||
style=\"display: none\">Back to media list</button>
|
||||
<div id=output class=pre style=\"margin-top: 10px\"></div>
|
||||
</div>
|
||||
"
|
||||
|
||||
footer
|
||||
|
62
var/mongoose/cgi-bin/browse/join/join.js
Executable file
62
var/mongoose/cgi-bin/browse/join/join.js
Executable file
@ -0,0 +1,62 @@
|
||||
|
||||
$('#filelist li').hover(
|
||||
function() { $(this).css('cursor', 'pointer'); },
|
||||
function() { $(this).css('cursor', 'auto'); }
|
||||
);
|
||||
|
||||
var handle = 0;
|
||||
|
||||
function update()
|
||||
{
|
||||
$.get('progress.jim'
|
||||
+ '?esize=' + $('#back').attr('esize')
|
||||
+ '&file=' + $('#back').attr('dir') + '/' + $('#dest').val(),
|
||||
function(data) {
|
||||
if (handle)
|
||||
$('#progressbar').reportprogress(data);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
|
||||
});
|
||||
|
||||
$('#filelist').sortable().disableSelection();
|
||||
|
||||
$('#dojoin').button().attr('disabled', true).addClass('ui-state-disabled')
|
||||
.click(function() {
|
||||
var files = $('#filelist').sortable('toArray');
|
||||
var sfiles = new Array();
|
||||
for (x in files)
|
||||
sfiles.push(encodeURIComponent(files[x]));
|
||||
|
||||
$('#joindiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
handle = setInterval("update()", 1000);
|
||||
|
||||
$('#output').text('Please do not interrupt...')
|
||||
.load('execute.jim?files=' +
|
||||
sfiles.join() + '&dest=' + $('#dest').val(),
|
||||
function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back').show();
|
||||
$('#progressbar').reportprogress(100);
|
||||
});
|
||||
});
|
||||
|
||||
$('#dest').val('').keyup(function() {
|
||||
if ($(this).val().length > 0)
|
||||
$('#dojoin')
|
||||
.removeProp('disabled').removeClass('ui-state-disabled');
|
||||
else
|
||||
$('#dojoin')
|
||||
.prop('disabled', true).addClass('ui-state-disabled');
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user