#!/mod/bin/jimsh package require cgi puts "Content-Type: text/html" puts "" cgi_input #cgi_dump #set _cgi(tsfile) "/media/My Video/Have I Got News for You_20110606_2247.ts" if {[dict exists $_cgi tsfile]} { source /mod/var/mongoose/lib/epg.class set file [dict get $_cgi tsfile] set a [split [exec /mod/bin/hmt -p $file] "\t"] # Need to fix 64-bit.. set size "??" catch { file stat $file st set size [expr $st(size) / 1048576] } puts "
Title [lindex $a 0]
Synopsis [lindex $a 1]
Definition [lindex $a 2]
Channel [epg channelicon [lindex $a 4] 50 "vertical-align: middle"] [lindex $a 3] - [lindex $a 4]
Start Time " puts [clock format [lindex $a 5] -format "%c %Z"] puts "
End Time " puts [clock format [lindex $a 6] -format "%c %Z"] puts "
Duration [expr [expr [lindex $a 6] - [lindex $a 5]] / 60] minute(s).
Size $size MiB
Flags [lindex $a 7]
" exit } if {[dict exists $_cgi dir]} { set dir [dict get $_cgi dir] } else { set dir "/media/My Video" } source /mod/var/mongoose/html/lib/header.jim puts {
} proc tsfile {file bfile} { puts "
$bfile
" } proc genfile {file bfile} { puts "
$bfile
" } puts {
} puts "

" set stub "" foreach part [split $dir /] { if {$stub eq "/"} { set name $part } else { set name "/$part" } append stub $name puts "$name } puts "

" set parent [join [lrange [split $dir /] 0 end-1] /] if {$parent ne ""} { puts "
\[parent directory\]
" } regsub -all -- {\/+} "$dir/*" "/" dir foreach file [lsort [glob -nocomplain "$dir"]] { set bfile [lindex [split $file /] end] if {[string index $bfile 0] == "\025"} { set bfile [string range $bfile 1 end] } if [file isdirectory "$file"] { puts "
" puts "" puts "" puts "$bfile
" continue } regexp -- {\.([^.]+)$} "$file" allmatch ext switch $ext { nts { continue } thm { continue } hmt { continue } hmi { continue } ts { tsfile $file $bfile } avi { genfile $file $bfile } mpg { genfile $file $bfile } wmv { genfile $file $bfile } mkv { genfile $file $bfile } } } puts "
" source /mod/var/mongoose/html/lib/footer.jim