-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua') ct={ title='予約一覧', css='
\n', js='
\n', progres=true, macro=sidePanel, searchlinks=true } edcb.htmlEscape=15 a=edcb.GetReserveData() table.sort(a, function(a,b) return os.time(a.startTime) < os.time(b.startTime) end) pageIndex=GetVarInt(mg.request_info.query_string,'page',0,100000) or 0 PAGE_COUNT=tonumber(edcb.GetPrivateProfile('SET','PAGE_COUNT','30',ini)) if PAGE_COUNT==0 then PAGE_COUNT=#a end if math.ceil((#a/PAGE_COUNT)-1)>0 then pg='0 and 'href="reserve.html?page=0"' or 'disabled')..'>first_page\n' ..'0 and 'href="reserve.html?page='..(pageIndex-1)..'"' or 'disabled')..'>chevron_left\n' n=pageIndex>(#a/PAGE_COUNT-2) and math.floor(#a/PAGE_COUNT)-4 or math.max(0,pageIndex-2) for i=n, n+4 do pg=pg..(i>=0 and i<#a/PAGE_COUNT and ''..(i+1)..'\n' or '') end pg=pg..'chevron_right\n' ..'last_page\n' pg='
\n'..pg..'
\n' end ct.main='
\n' ..(sidePanel and sidePanelTemplate(true) or '') ..'
' ..(pg or '')..'
' ..'

\n' ..'
'..#a..' 件中 '..math.max(1,pageIndex*PAGE_COUNT+1)..' － '..math.min(#a,(pageIndex+1)*PAGE_COUNT)..' 件
\n' ..'
\n
\n' ..' 録画\n' ..' | 日付\n' ..' | 番組名\n' ..' | サービス\n' ..' | コメント\n' ..' | 予想サイズ\n' ..' | 優先度\n' ..'
--- | --- | --- | --- | --- | --- | ---
\n' ctt={} rsdef=(edcb.GetReserveData(0x7FFFFFFF) or {}).recSetting rate={} for i=pageIndex*PAGE_COUNT+1,math.min(#a,(pageIndex+1)*PAGE_COUNT) do v=a[i] size=nil if v.recSetting.recMode~=4 then --予想ファイルサイズ for j=1,4 do key=('%04X%04X%04X'):format((j>3 and 65535 or v.onid),(j>2 and 65535 or v.tsid),(j>1 and 65535 or v.sid)) rate[key]=rate[key] or tonumber(edcb.GetPrivateProfile('BITRATE',key,0,'Bitrate.ini')) or 0 if rate[key]>0 then break elseif j==4 then rate[key]=19456 end end size=rate[key]/8*1000*math.max((v.recSetting.startMargin or rsdef and rsdef.startMargin or 0)+ (v.recSetting.endMargin or rsdef and rsdef.endMargin or 0)+v.durationSecond,0) end bg=v.recSetting.recMode==5 and ' disabled' or v.overlapMode==1 and ' partially' or v.overlapMode==2 and ' shortage' or nil table.insert(ctt, '
\n' ..' os.time() and '>' or ' class="recmark">') ..'\n | '..FormatTimeAndDuration(v.startTime, v.durationSecond) ..'\n | '..ConvertTitle(v.title) ..'\n | '..v.stationName ..'\n | '..v.comment ..'\n | '..(size and ('%.1fGB'):format(size/1024/1024/1024) or '-') ..'\n | grade'..v.recSetting.priority ..'\n | '..SearchConverter((edcb.SearchEpg(v.onid, v.tsid, v.sid, v.eid) or {shortInfo={event_name=v.title,text_char=''},startTime=v.startTime,durationSecond=v.durationSecond}), v.stationName) ..'\n') end ct.main=ct.main..table.concat(ctt)..'

\n
\n'..(pg or '')..'
\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'))