forked from hummypkg/webif
Fix info display for lone .hmt files, and make Play/Download work correctly in all cases
This commit is contained in:
parent
043865aa00
commit
88ab54ad96
@ -6,6 +6,4 @@ source /mod/webif/lib/setup
|
||||
httpheader
|
||||
|
||||
set file [cgi_get file]
|
||||
if {[string compare -nocase [file extension $file] ".hmt"]} {
|
||||
puts [exec /mod/bin/ffprobe -hide_banner $file]
|
||||
}
|
||||
puts [exec /mod/bin/ffprobe -hide_banner $file]
|
||||
|
@ -15,13 +15,20 @@ set sz [pretty_size [file size $file]]
|
||||
|
||||
set flags {}
|
||||
set url ""
|
||||
set ts 0
|
||||
|
||||
# assumption: the type is only ts if fetch has already been checked
|
||||
if {$type eq "ts"} {
|
||||
require epg.class ts.class
|
||||
|
||||
set ts [ts fetch $file 1]
|
||||
} elseif {$type eq "bad"} {
|
||||
require epg.class ts.class
|
||||
|
||||
set ts [ts fetchhmt $file]
|
||||
}
|
||||
|
||||
if {$ts != 0} {
|
||||
# Causes other series information to be automatically populated
|
||||
set epname [$ts episode_name]
|
||||
set series [$ts series_name]
|
||||
@ -208,19 +215,19 @@ eval_plugins browsetsfile
|
||||
puts "<tr>
|
||||
<th>Flags</th>
|
||||
<td>[set flags [$ts get flags]]</td>
|
||||
</tr>
|
||||
</tr>
|
||||
"
|
||||
|
||||
if {[$ts get bookmarks]} {
|
||||
puts "
|
||||
<tr>
|
||||
puts "
|
||||
<tr>
|
||||
<th>Bookmarks</th>
|
||||
<td>[$ts get bookmarks] @ [join [lmap i [$ts bookmarks 1] {
|
||||
clock format $i -format "%T"
|
||||
}] ", "]
|
||||
</td>
|
||||
</tr>
|
||||
"
|
||||
</tr>
|
||||
"
|
||||
}
|
||||
|
||||
puts "<div class=hidden id=file>$file</div>"
|
||||
@ -261,11 +268,10 @@ $('img.rollimg').hover(
|
||||
|
||||
</script>
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
# Otherwise, for a general file.
|
||||
|
||||
if {$type ne "ts"} {
|
||||
puts "
|
||||
<table class=keyval>
|
||||
<tr>
|
||||
@ -277,24 +283,37 @@ if {$type ne "ts"} {
|
||||
</tr>"
|
||||
}
|
||||
|
||||
set hasffmpeg 0
|
||||
if {$type ne "ts" || ("ODEncrypted" ni $flags && $url eq "") } {
|
||||
proc ffinfo {} {
|
||||
puts "<tr>
|
||||
<th>Info</th>
|
||||
<td class=pre id=ffmpeg>
|
||||
<img src=/img/spin.gif><i>Loading...</i>
|
||||
</td>
|
||||
</tr>"
|
||||
set hasffmpeg 1
|
||||
} elseif {$type eq "ts" && $url ne ""} {
|
||||
puts [format {
|
||||
<script type="text/javascript">
|
||||
$('#playDL').attr('href','%s').enable();
|
||||
</script> } $url]
|
||||
}
|
||||
|
||||
|
||||
set hasffmpeg 0
|
||||
if {$type eq "ts"} {
|
||||
if {"ODEncrypted" ni $flags && $url eq ""} {
|
||||
ffinfo
|
||||
set hasffmpeg 1
|
||||
}
|
||||
|
||||
if {$url ne ""} {
|
||||
puts [format {
|
||||
<script type="text/javascript">
|
||||
$('#playDL').attr('href','%s').enable();
|
||||
</script> } $url]
|
||||
}
|
||||
} elseif {$type ne "bad"} {
|
||||
ffinfo
|
||||
set hasffmpeg 1
|
||||
}
|
||||
|
||||
puts "
|
||||
</table>
|
||||
"
|
||||
</table>
|
||||
"
|
||||
|
||||
if {$hasffmpeg} {
|
||||
set url "/browse/ffmpeg.jim?file=[cgi_quote_url $file]"
|
||||
|
@ -809,13 +809,13 @@ var $dialog = $('#dialogue').dialog({
|
||||
});
|
||||
|
||||
/* insert button-like Download link before Play */
|
||||
$('#play').before(function(i){
|
||||
var dl = document.createElement('a');
|
||||
dl.setAttribute('class', this.className);
|
||||
dl.id = this.id + 'DL';
|
||||
dl.innerHTML = 'Download';
|
||||
return dl;
|
||||
});
|
||||
$('#play').before(function(i){
|
||||
var dl = document.createElement('a');
|
||||
dl.setAttribute('class', this.className);
|
||||
dl.id = this.id + 'DL';
|
||||
dl.innerHTML = 'Download';
|
||||
return dl;
|
||||
});
|
||||
|
||||
function doplay(it)
|
||||
{
|
||||
@ -827,11 +827,6 @@ function doplay(it)
|
||||
var vc = ""
|
||||
var ff = $('#ffmpeg')[0];
|
||||
|
||||
if (file.match(/\.hmt$/i) != null) {
|
||||
$(it).dialog('close');
|
||||
return;
|
||||
}
|
||||
|
||||
if (ff) {
|
||||
/* extract duration, container and video codec from ffmpeg output */
|
||||
ff = ff.innerHTML;
|
||||
@ -882,6 +877,7 @@ $('a.bf').click(function(e) {
|
||||
$dialog.attr('type', type);
|
||||
|
||||
$('#playDL').attr('download', file.replace(/.*\//, ''));
|
||||
$('#play, #playDL').enable();
|
||||
|
||||
if (type == 'ts') {
|
||||
if (opt.attr('odencd') != 0) {
|
||||
@ -893,11 +889,13 @@ $('a.bf').click(function(e) {
|
||||
/* link unencrypted file directly */
|
||||
$('#playDL').attr('href', file);
|
||||
}
|
||||
} else if (type == 'bad') {
|
||||
$('#play, #playDL').disable();
|
||||
} else {
|
||||
/* generic: enable Play once media file is parsed */
|
||||
$('#play').disable();
|
||||
$('#play, #playDL').disable();
|
||||
$('#playDL').attr('href', file);
|
||||
}
|
||||
}
|
||||
|
||||
$dialog.dialog('open');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user