"
}
proc entry {file} {{i 0}} {
set bfile [file tail $file]
regsub -all " +" $bfile "" tbfile
if {[string index $bfile 0] == "\025"} {
set bfile [string range $bfile 1 end]
}
if [file isdirectory "$file"] {
directory $file $bfile $tbfile
return
}
set ext [string tolower [file extension $file]]
if {$ext in $::ignore || $ext ni $::include} { return }
file stat $file st
set rsz $st(size)
set sz [pretty_size $rsz]
set base [file rootname $file]
if {$ext eq ".ts" && [file exists "${base}.nts"]} {
set type ts
set ts [ts fetch $file 1]
set img Video_TS
set omenu opt
} elseif {$ext eq ".hmt"} {
if {[file exists "${base}.ts"]} { continue }
# Sole hmt file indicates failure to track.
set type bad
set ts 0
set img Video_Failed
set omenu oopt
} else {
set type gen
set ts 0
set img Video_Other
set omenu oopt
}
set new 0
if {$type eq "ts"} {
if {[$ts flag "New"] > 0} { set new 1 }
} elseif {$type eq "gen"} {
if {![file exists "${base}.hmi"]} { set new 1 }
}
if {$new} { append img _New }
set fscl "fs"
set synopsis ""
if {$type eq "ts"} {
set fscl "fs fsts"
set synopsis [cgi_quote_html [$ts get synopsis]]
}
puts "
$bfile
"
# Size
puts " ($sz) "
# Icons
set locked 0
set encd 0
set odencd 1
set def unknown
set bx 0
set dlna 0
if {$type eq "ts"} {
set genre [$ts get genre]
set glist [ts genrelist]
if {[dict exists $glist $genre]} {
set ret $glist($genre)
} else {
set ret $glist(0)
}
lassign $ret txt img
if {$img eq "Unclassified"} {
icon "/images/173_3_26_G3_$img.png" $txt
} else {
icon "/images/173_3_00_G3_$img.png" $txt
}
# HD / SD
if {[$ts get definition] eq "HD"} {
set def HD
set img "172_1_00_HD"
} else {
set def SD
set img "172_1_26_SD"
}
icon "/images/$img.png"
# Locked
if {[$ts flag "Locked"] > 0} {
set locked 1
icon "/images/178_1_00_Icon_Lock.png" "Locked"
}
# Encrypted
if {[$ts flag "Encrypted"] > 0} {
set encd 1
icon "/images/749_1_26_Video_Encryption.png" ""
}
if {![$ts flag "ODEncrypted"]} {
set odencd 0
icon "/img/Decrypted.png" "Decrypted"
}
# Guidance
if {[$ts flag "Guidance"] > 0} {
icon "/images/174_1_26_GuidancePolicy.png"
}
# Indexed
if {$::model eq "HDR" && [llength [$ts dlnaloc]]} {
icon "/img/dlna.png" "Indexed by DLNA Server"
set dlna 1
}
# Shrunk (shown when necessary via Ajax)
icon "/img/compress.png" "Shrunk" \
"id=\"sp_$tbfile\"" "va hidden"
# Timeshifted (shown when necessary via Ajax)
# icon "/img/clock.png" "Time-shifted Recording" \
# "id=\"tsr_$tbfile\"" "va hidden"
set bx [$ts get bookmarks]
}
# Opt+ button
puts "
"
puts "
"
}
set dir [cgi_get dir [system mediaroot]]
######################################################################
# Render web page
puts {
}
source assets.jim
puts "
$dir
"
puts {
}
puts "