-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'epg.lua') tab=GetVarInt(mg.request_info.query_string,'tab',0,#NetworkType()) or 0 CH_COUNT=GetVarInt(mg.request_info.query_string,'chcount') or DEF_CH_COUNT pageIndex=GetVarInt(mg.request_info.query_string,'page',0,100000) or 0 Date=os.date('!*t', pageDate*24*3600) function hrefGene(href) href=href or {} if type(href)=='number' then href={ date=math.floor((href-4*3600)/24/3600)-baseDate, hour=math.floor(href%(24*3600)/3600) } end return '?tab='..(href.tab or tab) ..'&date='..(href.date or date) ..((hour>=0 or href.hour and href.hour>=0) and '&hour='..(href.hour or hour) or '') ..((href.chpage~=0 and (pageIndex~=0 or href.chpage)) and '&page='..(href.chpage or pageIndex) or '') ..(CH_COUNT~=DEF_CH_COUNT and '&chcount='..CH_COUNT or '') ..(interval~=DEF_INTERVAL and '&interval='..interval or '') end edcb.htmlEscape=15 minTime=nil maxTime=nil st,NetworkList={},{} for i,v in ipairs(NetworkType()) do NetworkList[i]=false end for i,v in ipairs(CustomServiceList()) do NetworkList[NetworkIndex(v.onid, ONESEG and v.partialReceptionFlag)]=true if tab==NetworkIndex(v.onid, v.partialReceptionFlag)-1 then table.insert(st, v) mmt=edcb.GetEventMinMaxTime(v.onid, v.tsid, v.sid) if mmt then maxTime=math.max(maxTime or 0,TimeWithZone(mmt.maxTime)) minTime=math.min(minTime or maxTime,TimeWithZone(mmt.minTime)) minTime_=math.min(minTime_ or maxTime,TimeWithZone(mmt.minTime)) end mmt=edcb.GetEventMinMaxTimeArchive and edcb.GetEventMinMaxTimeArchive(v.onid, v.tsid, v.sid) if mmt then maxTime=math.max(maxTime or 0,TimeWithZone(mmt.maxTime)) minTime=math.min(minTime or maxTime,TimeWithZone(mmt.minTime)) end --表示範囲の番組だけ取得する st[#st].et=edcb.EnumEventInfo({{onid=v.onid, tsid=v.tsid, sid=v.sid}}, {startTime=os.date('!*t',pageTime-24*3600), durationSecond=(interval+24)*3600}) or {} for j,w in ipairs(edcb.EnumEventInfoArchive and edcb.EnumEventInfoArchive({{onid=v.onid, tsid=v.tsid, sid=v.sid}}, {startTime=os.date('!*t',pageTime-24*3600), durationSecond=(interval+24)*3600}) or {}) do w.past=true table.insert(st[#st].et, w) end table.sort(st[#st].et, function(a,b) return os.time(a.startTime)\n' ..'
\n' ..'\n' ..'\n' main={'\n' table.insert(main, '\n') end end if minTime then if minTime>=pageTime then prev='disabled' else prev='href="epg.html'..hrefGene(pageTime-(interval==25 and 24-(hour<0 and MARGIN_HOUR or 0) or interval)*3600)..'"' end if maxTimechevron_left\n' ..'\n' ..'\n' table.insert(main, '\n\n') end ct.subheader=ct.subheader ..'\n' ..'\n\n' ct.side='\n' ..'\n' ..'\n' ..'\n' ..'\n' ..'\n
\n' table.insert(main, '
\n' .. SidePanelTemplate() ..'
' ..'
\n
\n'..table.concat(Head)..'
\n' ..'
\n' ..'
\n') for i=baseHour,baseHour+interval-1 do j=i%24 d=os.date('!*t', ((pageDate*24)+i)*3600) table.insert(main, '
'..(j==4 and Date.day~=d.day and d.day..'日' or '')..(j<4 and j+24 or j)..'時
\n') end ct.main=table.concat(main)..(NOW and '
' or '') ..'
\n' ..table.concat(ctt) ..'
\n
\n' ..'
\n' ..'\n' ..'\n' ..'\n' ..'
\n' ..EpgJsTemplate(NOW) ct=Template(ct) mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len,ct.gzip)..'\r\n'))