#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require pretty_size
httpheader
set file [cgi_get file]
set type [cgi_get type]
if {$file == 0} exit
file stat $file st
set sz [pretty_size $st(size)]
if {$type eq "ts"} {
require epg.class ts.class
set ts [ts fetch $file]
puts "
Title |
[$ts get title] |
Synopsis |
[$ts get synopsis] |
"
if {[$ts flag "Guidance"] > 0} {
puts "
Guidance |
[$ts get guidance]
|
"
}
puts "
Definition |
"
if {[$ts get definition] eq "HD"} {
puts ""
} else {
puts ""
}
puts " |
Channel |
[epg channelicon [$ts get channel_name] 50 "vertical-align: middle"]
[$ts get channel_num] - [$ts get channel_name] |
Start Time |
"
puts [clock format [$ts get start] -format "%c %Z"]
puts "(Scheduled: [
clock format [$ts get schedstart] -format "%c %Z"])"
puts " |
End Time |
"
puts [clock format [$ts get end] -format "%c %Z"]
puts "(Scheduled: [clock format \
[expr [$ts get schedstart] + [$ts get scheddur]] \
-format "%c %Z"])"
puts " |
Duration |
[$ts duration] minute(s).
(Scheduled: [expr [$ts get scheddur] / 60])
|
Size |
$sz |
"
lassign [$ts dlnaloc] url
if {$url ne ""} {
puts "
DLNA URL |
$url | "
}
puts "
---|
Files |
"
set fileset [$ts fileset]
puts -nonewline ""
puts -nonewline "[llength $fileset] file"
if {[llength $fileset] != 1} { puts -nonewline "s" }
puts -nonewline " in set."
puts ""
foreach f $fileset {
puts "- [file tail $f] ([pretty_size [file size $f]])
"
}
puts " "
puts " |
Flags |
[$ts get flags]
"
if {[$ts get bookmarks]} {
puts " \[Bookmarks: [$ts get bookmarks]\]"
}
puts " |
"
puts "
"
puts {
}
exit
}
# Otherwise, for a general file.
puts "