-- vim:set ft=lua:
dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua')
ct={title='録画結果'}
focus=nil
post=AssertPost()
if post then
focus=edcb.GetRecFileInfoBasic(GetVarInt(post,'del') or 0)
if focus then
edcb.DelRecFileInfo(focus.id)
ct.js=''
end
end
b=edcb.GetRecFileInfoBasic()
edcb.htmlEscape=15
a=edcb.GetRecFileInfoBasic()
if not focus then
focus=GetVarInt(mg.request_info.query_string,'id')
focus=focus and BinarySearch(a,{id=focus},CompareFields('id'))
end
table.sort(a, function(a,b) return os.time(a.startTime) > os.time(b.startTime) end)
table.sort(b, function(a,b) return os.time(a.startTime) > os.time(b.startTime) end)
pageCount=tonumber(edcb.GetPrivateProfile('SET','PAGE_COUNT','30',INI))
if pageCount==0 then pageCount=#a end
if focus then
--focusの行を含むページを探す
focusIndex=BinarySearchBound(a,focus,function(a,b) return os.time(a.startTime)>os.time(b.startTime) end)
page=math.floor(math.max(math.min(focusIndex-1,#a-1),0)/pageCount)
else
page=GetVarInt(mg.request_info.query_string,'page',0,(#a-1)/pageCount) or 0
end
ctt={}
for i=page*pageCount+1,math.min(#a,(page+1)*pageCount) do
v=a[i]
if SHOW_THUMB_IN_RECINFO then
table.insert(ctt, '
'
..(EdcbFindFilePlain(b[i].recFilePath) and '
movie
'
or '
movie_off
')
..'
'
..'
'..ConvertTitle(v.title)
..''..FormatTimeAndDuration(v.startTime, v.durationSecond)
..'
'..v.serviceName
..''
..MdlChip:tag(v.comment)..''
..MdlChip:tag('ドロップ : 0 and ' class="mdl-color-text--red-A700">' or '>')..v.drops..'', MdlChip:getColorClass('ドロップ : '))
..MdlChip:tag('スクランブル : 0 and ' class="mdl-color-text--red-A700">' or '>')..v.scrambles..'', MdlChip:getColorClass('スクランブル : '), v.scrambles>0 and ' mdl-color-text--red-A700')
..'
\n')
else
table.insert(ctt, '\n'
..' | '..FormatTimeAndDuration(v.startTime, v.durationSecond)
..'\n | '..ConvertTitle(v.title)
..'\n | '..v.serviceName
..'\n | Drop:'..v.drops
..'\n | Scrambles:'..v.scrambles
..'\n')
end
end
pageNav=Pagination(page, a)
ct.main='\n'
..SidePanelTemplate(true)
..''..pageNav..' ' or '>')
..' \n'
..(SHOW_THUMB_IN_RECINFO and ' \n'
..' '
..' '..#a..' 件中 '..math.min(#a,page*pageCount+1)..' - '..math.min(#a,(page+1)*pageCount)..' 件 \n'
..table.concat(ctt)
..' \n'
..'\n\n'
..'\n'
or ' '..#a..' 件中 '..math.min(#a,page*pageCount+1)..' - '..math.min(#a,(page+1)*pageCount)..' 件\n'
..' \n\n'
..' | 日付\n'
..' | タイトル\n'
..' | サービス\n'
..' | D\n'
..' | S\n'
..' | \n'
..table.concat(ctt)
..'\n\n')
..pageNav..'\n'
..'add'
ct=Template(ct)
mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len,ct.gzip)..'\r\n'))
|