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
|
httpheader
|
||||||
|
|
||||||
set file [cgi_get file]
|
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 flags {}
|
||||||
set url ""
|
set url ""
|
||||||
|
set ts 0
|
||||||
|
|
||||||
# assumption: the type is only ts if fetch has already been checked
|
# assumption: the type is only ts if fetch has already been checked
|
||||||
if {$type eq "ts"} {
|
if {$type eq "ts"} {
|
||||||
require epg.class ts.class
|
require epg.class ts.class
|
||||||
|
|
||||||
set ts [ts fetch $file 1]
|
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
|
# Causes other series information to be automatically populated
|
||||||
set epname [$ts episode_name]
|
set epname [$ts episode_name]
|
||||||
set series [$ts series_name]
|
set series [$ts series_name]
|
||||||
@ -208,19 +215,19 @@ eval_plugins browsetsfile
|
|||||||
puts "<tr>
|
puts "<tr>
|
||||||
<th>Flags</th>
|
<th>Flags</th>
|
||||||
<td>[set flags [$ts get flags]]</td>
|
<td>[set flags [$ts get flags]]</td>
|
||||||
</tr>
|
</tr>
|
||||||
"
|
"
|
||||||
|
|
||||||
if {[$ts get bookmarks]} {
|
if {[$ts get bookmarks]} {
|
||||||
puts "
|
puts "
|
||||||
<tr>
|
<tr>
|
||||||
<th>Bookmarks</th>
|
<th>Bookmarks</th>
|
||||||
<td>[$ts get bookmarks] @ [join [lmap i [$ts bookmarks 1] {
|
<td>[$ts get bookmarks] @ [join [lmap i [$ts bookmarks 1] {
|
||||||
clock format $i -format "%T"
|
clock format $i -format "%T"
|
||||||
}] ", "]
|
}] ", "]
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
puts "<div class=hidden id=file>$file</div>"
|
puts "<div class=hidden id=file>$file</div>"
|
||||||
@ -261,11 +268,10 @@ $('img.rollimg').hover(
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
} else {
|
||||||
# Otherwise, for a general file.
|
# Otherwise, for a general file.
|
||||||
|
|
||||||
if {$type ne "ts"} {
|
|
||||||
puts "
|
puts "
|
||||||
<table class=keyval>
|
<table class=keyval>
|
||||||
<tr>
|
<tr>
|
||||||
@ -277,24 +283,37 @@ if {$type ne "ts"} {
|
|||||||
</tr>"
|
</tr>"
|
||||||
}
|
}
|
||||||
|
|
||||||
set hasffmpeg 0
|
proc ffinfo {} {
|
||||||
if {$type ne "ts" || ("ODEncrypted" ni $flags && $url eq "") } {
|
|
||||||
puts "<tr>
|
puts "<tr>
|
||||||
<th>Info</th>
|
<th>Info</th>
|
||||||
<td class=pre id=ffmpeg>
|
<td class=pre id=ffmpeg>
|
||||||
<img src=/img/spin.gif><i>Loading...</i>
|
<img src=/img/spin.gif><i>Loading...</i>
|
||||||
</td>
|
</td>
|
||||||
</tr>"
|
</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 "
|
puts "
|
||||||
</table>
|
</table>
|
||||||
"
|
"
|
||||||
|
|
||||||
if {$hasffmpeg} {
|
if {$hasffmpeg} {
|
||||||
set url "/browse/ffmpeg.jim?file=[cgi_quote_url $file]"
|
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 */
|
/* insert button-like Download link before Play */
|
||||||
$('#play').before(function(i){
|
$('#play').before(function(i){
|
||||||
var dl = document.createElement('a');
|
var dl = document.createElement('a');
|
||||||
dl.setAttribute('class', this.className);
|
dl.setAttribute('class', this.className);
|
||||||
dl.id = this.id + 'DL';
|
dl.id = this.id + 'DL';
|
||||||
dl.innerHTML = 'Download';
|
dl.innerHTML = 'Download';
|
||||||
return dl;
|
return dl;
|
||||||
});
|
});
|
||||||
|
|
||||||
function doplay(it)
|
function doplay(it)
|
||||||
{
|
{
|
||||||
@ -827,11 +827,6 @@ function doplay(it)
|
|||||||
var vc = ""
|
var vc = ""
|
||||||
var ff = $('#ffmpeg')[0];
|
var ff = $('#ffmpeg')[0];
|
||||||
|
|
||||||
if (file.match(/\.hmt$/i) != null) {
|
|
||||||
$(it).dialog('close');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ff) {
|
if (ff) {
|
||||||
/* extract duration, container and video codec from ffmpeg output */
|
/* extract duration, container and video codec from ffmpeg output */
|
||||||
ff = ff.innerHTML;
|
ff = ff.innerHTML;
|
||||||
@ -882,6 +877,7 @@ $('a.bf').click(function(e) {
|
|||||||
$dialog.attr('type', type);
|
$dialog.attr('type', type);
|
||||||
|
|
||||||
$('#playDL').attr('download', file.replace(/.*\//, ''));
|
$('#playDL').attr('download', file.replace(/.*\//, ''));
|
||||||
|
$('#play, #playDL').enable();
|
||||||
|
|
||||||
if (type == 'ts') {
|
if (type == 'ts') {
|
||||||
if (opt.attr('odencd') != 0) {
|
if (opt.attr('odencd') != 0) {
|
||||||
@ -893,11 +889,13 @@ $('a.bf').click(function(e) {
|
|||||||
/* link unencrypted file directly */
|
/* link unencrypted file directly */
|
||||||
$('#playDL').attr('href', file);
|
$('#playDL').attr('href', file);
|
||||||
}
|
}
|
||||||
|
} else if (type == 'bad') {
|
||||||
|
$('#play, #playDL').disable();
|
||||||
} else {
|
} else {
|
||||||
/* generic: enable Play once media file is parsed */
|
/* generic: enable Play once media file is parsed */
|
||||||
$('#play').disable();
|
$('#play, #playDL').disable();
|
||||||
$('#playDL').attr('href', file);
|
$('#playDL').attr('href', file);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dialog.dialog('open');
|
$dialog.dialog('open');
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user