-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'epg.lua') show=mg.get_var(mg.request_info.query_string,'show') hour=GetVarInt(mg.request_info.query_string,'hour',-1,27) or 4 --hour=-1で現在時刻-MARGIN_HOUR時間を基準 interval=GetVarInt(mg.request_info.query_string,'interval',0,25) or DEF_interval onid=GetVarInt(mg.request_info.query_string,'onid') or 0 tsid=GetVarInt(mg.request_info.query_string,'tsid') or 0 sid=GetVarInt(mg.request_info.query_string,'sid') or 0 baseDate=math.floor((now+timezone-4*3600)/24/3600) Hour=hour<0 and math.floor((((now+timezone)%(24*3600))/3600)-MARGIN_HOUR)%24 or hour if Hour<4-(hour==0 and MARGIN_HOUR or 0) then Hour=Hour+24 end Hour=Hour+interval>29 and 29-interval or Hour baseTime=(baseDate*24+Hour)*3600 NOW=baseTime', css=epgcss(), js=epgjs(Hour,'$(function(){end($($(".now")));setInterval("line()", 1000);});'), progres=true, macro=sidePanel, dialog={{ id='suspend', button='' }} } ct.subheader='
\n' ..'\n
\n' ct.menu=ct.menu ..'\n' ct.side='\n' ..'\n' ..'\n
\n' ctt={} op={service_name=st.service_name} for i=0,7 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',baseTime+(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',baseTime+(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>2 then op.url='epginfo.html?onid='..w.onid..'&tsid='..w.tsid..'&sid='..w.sid..(w.past and '&startTime='..startTime+timezone or '&eid='..w.eid)..'&week='..hrefGene table.insert(ctt, epgcell(w, op)) total=total+endPx-lastPx lastPx=endPx end end if total
\n') end table.insert(ctt, '
\n') end ct.main='
\n' ..(sidePanel and sidePanelTemplate() or '') ..'
' ..'
\n
\n' for i=0,7 do d=os.date('!*t', ((i+baseDate)*24)*3600) d=d.month..'/'..d.day..'('..({'日','月','火','水','木','金','土'})[d.wday]..')' ct.main=ct.main..''..d..'\n' end ct.main=ct.main..'
\n' ..'
\n' ..'
\n' for i=Hour,Hour+interval-1 do j=i%24 ct.main=ct.main..'
'..(j<4 and j+24 or j)..'時
' end ct.main=ct.main..(NOW and '
' or '')..'
\n' ..table.concat(ctt) ..'
\n
\n' ..'
\n' ..'\n' ..'\n' ..'\n' ..'
\n' ct=template(ct) mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len)..(ct.gzip and 'Content-Encoding: gzip\r\n' or '')..'\r\n'))