-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'epg.lua') show=mg.get_var(mg.request_info.query_string,'show') tab=GetVarInt(mg.request_info.query_string,'tab',0,#NetworkIndex()) or 0 date=GetVarInt(mg.request_info.query_string,'date',-10000,1000) 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 baseDate=math.floor((now+timezone-4*3600)/24/3600) if date==0 then m={(mg.get_var(mg.request_info.query_string,'date') or ''):match('^(%d%d%d%d)%-(%d?%d)%-(%d?%d)$')} if #m==3 then date=math.floor(os.time({year=m[1],month=m[2],day=m[3]})/24/3600)-baseDate end end 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 pageDate=baseDate+date pageTime=(pageDate*24+Hour)*3600 Date=os.date('!*t', pageDate*24*3600) NOW=pageTimeminTime and minTime or os.time(mmt.minTime) minTime_=minTime_ and os.time(mmt.minTime)>minTime_ and minTime_ or os.time(mmt.minTime) maxTime=maxTime and os.time(mmt.maxTime)minTime and minTime or os.time(mmt.minTime) maxTime=maxTime and os.time(mmt.maxTime)div>div:first-child").each(function(){'..(date==0 and 'end($(this), true);});jump();' or 'end($(this));});')..'setInterval("line()", 1000);});' or ''),(NOW and pageTime+(interval*3600)-timezone or false)), progres=true, macro=sidePanel, dialog={{ id='suspend', button='' }} } ct.subheader='
\n' ..'
\n' ct.menu=ct.menu..'
    \n' for i=0, math.ceil(n/CH_COUNT-1) do ct.menu=ct.menu..'
  • ページ '..(i+1)..'
  • \n' end ct.menu=ct.menu..'
\n' end end if minTime then if minTime+timezone>=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 maxTime+timezonechevron_left\n' ..'\n' ..'\n' ct.menu=ct.menu..'
    \n' ..'
  • ' ..(tab~=0 and '' or '') ..'
    calendar_today
    ' ..'' ..(pageIndex~=0 and '' or '') ..(CH_COUNT~=DEF_CH_COUNT and '' or '') ..(interval~=DEF_interval and '' or '') ..'
  • \n' minTime=math.min(math.max(minTime, minTime_-1*24*3600)+timezone, math.max(minTime+timezone, pageTime-2*24*3600)) maxTime=math.min(maxTime+timezone, minTime+9*24*3600) -- 10日間 for i=math.floor((minTime-4*3600)/24/3600),math.floor((maxTime-4*3600)/24/3600) do d=os.date('!*t', i*24*3600) ct.menu=ct.menu..'
  • '..d.month..'/'..d.day..'('..({'日','月','火','水','木','金','土'})[d.wday]..')'..'
  • \n' end ct.menu=ct.menu..'
\n' ct.subheader=ct.subheader..'\n' ct.menu=ct.menu..'\n' end ct.subheader=ct.subheader ..'\n' ..'\n\n' ct.menu=ct.menu ..'
    \n' ..'
  • EPG取得
  • \n' ..'
  • EPG再読み込み
  • \n' ..'
  • スタンバイ
  • \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..'
  • \n' table.insert(Head, '\n') 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..'
  • \n' end end ct.side=ct.side..'
\n
\n' ct.main='
\n' ..(sidePanel and sidePanelTemplate() or '') ..'
' ..'
\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) ct.main=ct.main..'
'..(j==4 and Date.day~=d.day and d.day..'日' or '')..(j<4 and j+24 or j)..'時
\n' 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'))