-- 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')
for i,v in ipairs(et) do
sub=v.eventGroupInfo and #v.eventGroupInfo.eventDataList==1 and (
v.eventGroupInfo.eventDataList[1].onid~=v.onid or
v.eventGroupInfo.eventDataList[1].tsid~=v.tsid or
v.eventGroupInfo.eventDataList[1].sid~=v.sid or
v.eventGroupInfo.eventDataList[1].eid~=v.eid)
if not sub then
if v.startTime and os.time(v.startTime)+timezone <= now+9*3600 and
#et>i and et[i+1].startTime and os.time(et[i+1].startTime)+timezone > now+9*3600 then
v.now=true
end
cont=v.contentInfoList and #v.contentInfoList>0 and math.floor(v.contentInfoList[1].content_nibble/256)%16 or 16
ct:Append('
'
..(v.startTime and ('%02d/%02d%s %02d:%02d'):format(v.startTime.month, v.startTime.day, ({'日','月','火','水','木','金','土'})[v.startTime.wday], v.startTime.hour, v.startTime.min) or '不明')
..(not v.past and rt[('%04X%04X%04X%04X'):format(v.onid, v.tsid, v.sid, v.eid)] and '
予' or '')
..'
'
..(v.shortInfo and v.shortInfo.event_name or ' ')..''
..'
\n')
end
end
ct:Append('
\n')
if date<0 then
ct:Append('
]=])
if sid==0 then
ct:Append([=[
]=])
else
xq=GetTranscodeQueries(mg.request_info.query_string)
ct:Append('視聴 →
'..(vtag==0 and 'Video' or 'DL')..'\n'
..'
')
if vtag==1 then
src='view.lua?n=0&id='..onid..'-'..tsid..'-'..sid..ConstructTranscodeQueries(xq)..'&ctok='..CsrfToken('view.lua')
ct:Append('\n
')
if ALLOW_HLS then
ct:Append('\n
'..src..'
\n'..HlsScriptTemplete(xq.caption))
end
end
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'))