-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'epg.lua') tab=GetVarInt(mg.request_info.query_string,'tab',0,#NetworkType()) or 0 date=GetVarInt(mg.request_info.query_string,'date',-10000,1000) or GetVarDate(mg.request_info.query_string,'date') or 0 hour=GetVarInt(mg.request_info.query_string,'hour',-1,27) or -1 --hour=-1で現在時刻-MARGIN_HOUR時間を基準 interval=GetVarInt(mg.request_info.query_string,'interval',0,100) or DEF_INTERVAL 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 --UTC+9の今日の始まりの日付。現在時刻が深夜4時までは前日になることに注意 baseDate=math.floor((utc9Now-4*3600)/24/3600) if date>1000 then date=math.floor(date/24/3600)-baseDate end Hour=hour<0 and math.floor(((utc9Now%(24*3600))/3600)-MARGIN_HOUR)%24 or hour if Hour<4-(hour<0 and MARGIN_HOUR or 0) then Hour=Hour+24 end pageDate=baseDate+date pageTime=(pageDate*24+Hour)*3600 Date=os.date('!*t', pageDate*24*3600) NOW=pageTime\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' WIDE={ --少し拡幅する ['32391-32391-23608']=true, --MX } ctt,Head={},{} n=0 pagemin=pageIndex*CH_COUNT+1 pagemax=(pageIndex+1)*CH_COUNT SubChConcat=tonumber(edcb.GetPrivateProfile('GUIDE','subChConcat',true,INI))~=0 for i,v in ipairs(st) do if not v.subCh then n=n+1 end if CH_COUNT==0 or pagemin<=n and n<=pagemax then op={service_name=v.service_name} if not v.subCh then left=0 for j=i,#st+1 do if j>#st or j>i and not st[j].subCh then column=j-i id=v.onid..'-'..v.tsid..'-'..v.sid ct.side=ct.side..'
- '..v.service_name..'
\n' table.insert(Head, ''..v.service_name..'\n') table.insert(ctt, '
\n') break end end else left=left+1 end lastPx=0 total=0 table.insert(ctt, '
') for j,w in ipairs(v.et) do startTime=TimeWithZone(w.startTime) startPx=math.min(math.floor((startTime-pageTime)/60), 60*interval) endTime=w.durationSecond and startTime+w.durationSecond or (j<#v.et and TimeWithZone(v.et[j+1].startTime) or startTime) --終了時間未定 endPx=math.min(math.floor((endTime-pageTime)/60), 60*interval) if startPx-lastPx>0 then if not v.subCh then table.insert(ctt, '
\n') end total=total+startPx-lastPx lastPx=startPx end if endPx-lastPx>0 then --イベントグループのサブでないか if not w.eventGroupInfo or #w.eventGroupInfo.eventDataList~=1 or w.eventGroupInfo.eventDataList[1].onid==w.onid and w.eventGroupInfo.eventDataList[1].tsid==w.tsid and w.eventGroupInfo.eventDataList[1].sid==w.sid and w.eventGroupInfo.eventDataList[1].eid==w.eid then --サブチャンネル何個分か width=1 for k=i+1,#st do span=false if st[k].subCh and w.eventGroupInfo then for l,x in ipairs(w.eventGroupInfo.eventDataList) do if v.onid==x.onid and v.tsid==x.tsid and st[k].sid==x.sid then width=width+1 span=true break end end end if not span then break end end op.url='epginfo.html'..hrefGene()..'&id='..w.onid..'-'..w.tsid..'-'..w.sid..'-'..(w.past and startTime or w.eid) table.insert(ctt, CellTemplate(w, op)) total=total+endPx-lastPx lastPx=endPx end end end if not v.subCh and total
\n') end table.insert(ctt, '
') if i==#st or not st[i+1].subCh then table.insert(ctt, '\n') end elseif n>pagemax then break end end ct.side=ct.side..'

\n' ..'\n' ..'ジャンル\n' ..'

\n
- すべて
\n' for i=0,15 do nibble1=edcb.GetGenreName(i*256+255) if nibble1~='' then ct.side=ct.side..'
- '..nibble1..'
\n' end end ct.side=ct.side..'

\n
\n' table.insert(main, '
\n' .. SidePanelTemplate() ..'
' ..'
\n
\n'..table.concat(Head)..'
\n' ..'
\n' ..'
\n') for i=Hour,Hour+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(pageTime-9*3600,NOW,date==0,(NOW and pageTime+(interval-9)*3600 or false)) ct=Template(ct) mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len,ct.gzip)..'\r\n'))