-- vim:set ft=lua: hour=true dofile(mg.script_name:gsub('[^\\/]*$','')..'epg.lua') onid,tsid,sid=GetVarServiceID(mg.request_info.query_string,'id') hrefGene=(hour~=4 and '&hour='..hour or '')..(interval~=DEF_INTERVAL and '&interval='..interval or '')..(date~=0 and '&date='..date or '') edcb.htmlEscape=15 ServiceList=CustomServiceList() st=ServiceList[1] for j,v in ipairs(ServiceList) do if onid==v.onid and tsid==v.tsid and sid==v.sid then st=v break end end ct={ title='週間番組表'..(st and ' -'..st.service_name..'' or ''), css=EpgCssTemplate(), menu=EpgMenuTemplate(), searchlinks=not SIDE_PANEL } ct.subheader='
\n' ..'\n
\n' ct.side='\n' ..'\n' ..'\n
\n' ctt={} op={service_name=st.service_name} for i=0,6 do table.insert(ctt, '
\n') lastPx=0 total=0 b=edcb.EnumEventInfo({{onid=st.onid, tsid=st.tsid, sid=st.sid}}, {startTime=os.date('!*t',pageTime+(i*24-6)*3600), durationSecond=(interval+6)*3600}) or {} for j,w in ipairs(edcb.EnumEventInfoArchive and edcb.EnumEventInfoArchive({{onid=st.onid, tsid=st.tsid, sid=st.sid}}, {startTime=os.date('!*t',pageTime+(i*24-6)*3600), durationSecond=(interval+6)*3600}) or {}) do w.past=true table.insert(b, w) end table.sort(b, function(a,b) return os.time(a.startTime)0 then table.insert(ctt, '
\n') total=total+startPx-lastPx lastPx=startPx end if endPx-lastPx>0 then op.url='epginfo.html?id='..w.onid..'-'..w.tsid..'-'..w.sid..'-'..(w.past and startTime or w.eid)..'&week='..hrefGene table.insert(ctt, CellTemplate(w, op)) total=total+endPx-lastPx lastPx=endPx end end if total
\n') end table.insert(ctt, '
\n') end table.insert(main, '
\n' .. SidePanelTemplate() ..'
' ..'
\n
\n') for i=0,6 do d=os.date('!*t', ((i+pageDate)*24)*3600) d=d.month..'/'..d.day..'('..({'日','月','火','水','木','金','土'})[d.wday]..')' table.insert(main, ''..d..'\n') end table.insert(main, '
\n' ..'
\n' ..'
\n') for i=baseHour,baseHour+interval-1 do j=i%24 table.insert(main, '
'..(j<4 and j+24 or j)..'時
') end ct.main=table.concat(main)..(NOW and '
' or '') ..'
\n' ..table.concat(ctt) ..'
\n
\n' ..'
\n' ..'\n' ..'\n' ..'\n' ..'
\n' ..EpgJsTemplate() ct=Template(ct) mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len,ct.gzip)..'\r\n'))