Play file in browser or with external helper application

This commit is contained in:
df 2021-02-16 00:49:28 +00:00
parent 772d91a9f8
commit bd2e60fa88
1 changed files with 26 additions and 17 deletions

View File

@ -13,10 +13,14 @@ if {$file == 0} exit
set sz [pretty_size [file size $file]]
set flags {}
set url ""
# 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]
set ts [ts fetch $file 1]
# Causes other series information to be automatically populated
set epname [$ts episode_name]
@ -199,7 +203,7 @@ eval_plugins browsetsfile
puts "<tr>
<th>Flags</th>
<td>[$ts get flags]</td>
<td>[set flags [$ts get flags]]</td>
</tr>
"
@ -215,9 +219,6 @@ if {[$ts get bookmarks]} {
"
}
puts "
</table>
"
puts "<div class=hidden id=file>$file</div>"
puts {
<script type=text/javascript>
@ -256,12 +257,12 @@ $('img.rollimg').hover(
</script>
}
exit
}
# Otherwise, for a general file.
puts "
if {$type ne "ts"} {
puts "
<table class=keyval>
<tr>
<th>File</th>
@ -269,20 +270,28 @@ puts "
</tr><tr>
<th>Size</th>
<td>$sz</td>
</tr><tr>
</tr>"
set hasffmpeg 0
if {$type ne "ts" || ("ODEncrypted" ni $flags && $url eq "") } {
puts "<tr>
<th>Info</th>
<td class=pre id=ffmpeg>
<img src=/img/spin.gif><i>Loading...</i>
</td>
</tr>
</table>
"
</tr>"
set hasffmpeg 1
}
puts "
</table>
"
set url "/browse/ffmpeg.jim?file=[cgi_quote_url $file]"
puts { <script type="text/javascript"> }
puts "var url = \"$url\";"
puts {
$('#ffmpeg').load(url);
if {hasffmpeg} {
set url "/browse/ffmpeg.jim?file=[cgi_quote_url $file]"
puts { <script type="text/javascript"> }
puts "var url = \"$url\";"
puts {
$('#ffmpeg').load(url, function() { $('#play').button('enable'); });
</script>
}
}