-- vim:set ft=lua:
dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua')
vtag=GetVarInt(mg.request_info.query_string,'vtag') or -1
ct=CreateContentBuilder(GZIP_THRESHOLD_BYTE)
ct:Append([=[
\n')
dir=DocumentToNativePath(LIBRARY_LIST[index])
if dir then
tsx=edcb.GetPrivateProfile('SET','TSExt','.ts','EpgTimerSrv.ini')
info=nil
for i,v in ipairs({table.unpack(MEDIA_EXTENSION_LIST),tsx}) do
for j,w in ipairs(edcb.FindFile(dir..'\\*'..v,0) or {}) do
if not w.isdir and mg.md5(w.name)==hash then
info=w
info.ists=v==tsx
break
end
end
if info then
break
end
end
edcb.htmlEscape=15
if info then
ref=LIBRARY_LIST[index]..'/'..info.name
ct:Append('→
Video' or '0">DL')..'\n')
ct:Append((vtag==1 and '
' or ''))
if info.ists then
fsec,fsize=0,0
f=edcb.io.open(dir..'\\'..info.name,'rb')
if f then
fsec,fsize=GetDurationSec(f)
f:close()
end
ct:Append(' ('..('%dm%02ds|'):format(math.floor(fsec/60),fsec%60)..math.floor(fsize/1048576)..'M)
\n'
..'
')
if vtag==10 then
src='xcode.lua?fname='..mg.url_encode(ref)..ConstructTranscodeQueries(xq)
ct:Append('\n
')
if ALLOW_HLS then
ct:Append('\n
'..src..'
\n'..HlsScriptTemplete(xq.caption))
end
end
else
ct:Append(' ('..math.floor(info.size/1048576)..'M)
\n')
end
end
end
ct:Append('
\n')
end
ct:Append([=[
]=])
ct:Finish()
mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len)..(ct.gzip and 'Content-Encoding: gzip\r\n' or '')..'\r\n'))