-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua') function AddOrChange(dataID,post) local aa={dataID=dataID} local found=nil local presetID=GetVarInt(post,'presetID',0,65534) if presetID then found=BinarySearch(edcb.EnumRecPresetInfo(),{id=presetID},CompareFields('id')) elseif dataID~=0 then found=BinarySearch(edcb.EnumAutoAdd(),aa,CompareFields('dataID')) end if found then local useMargin=GetVarInt(post,'useDefMarginFlag')~=1 or nil aa.recSetting={ batFilePath=found.recSetting.batFilePath, recFolderList=found.recSetting.recFolderList, partialRecFolder=found.recSetting.partialRecFolder, recMode=GetVarInt(post,'recEnabled')~=1 and 5 or GetVarInt(post,'recMode',0,4), noRecMode=GetVarInt(post,'recMode',0,4), tuijyuuFlag=GetVarInt(post,'tuijyuuFlag')==1, priority=GetVarInt(post,'priority',1,5), pittariFlag=GetVarInt(post,'pittariFlag')==1, suspendMode=GetVarInt(post,'suspendMode',0,4), rebootFlag=GetVarInt(post,'rebootFlag')==1, startMargin=useMargin and GetVarInt(post,'startMargin',-6*3600,6*3600), endMargin=useMargin and GetVarInt(post,'endMargin',-6*3600,6*3600), serviceMode=GetVarInt(post,'serviceMode')==1 and 0 or 1+16*(GetVarInt(post,'serviceMode_1',0,1) or 0)+32*(GetVarInt(post,'serviceMode_2',0,1) or 0), continueRecFlag=GetVarInt(post,'continueRecFlag')==1, tunerID=GetVarInt(post,'tunerID'), partialRecFlag=GetVarInt(post,'partialRecFlag',0,1) or 0 } if aa.recSetting.recMode and aa.recSetting.priority and aa.recSetting.suspendMode and (not useMargin or aa.recSetting.startMargin and aa.recSetting.endMargin) and aa.recSetting.tunerID then local notKey=mg.get_var(post,'notKey') or '' local note=mg.get_var(post,'note') or '' if #note>0 or notKey:find('^:note:') then notKey=':note:'..note:gsub('\\','\\\\'):gsub(' ','\\s'):gsub(' ','\\m')..(#notKey>0 and ' '..notKey or '') end aa.searchInfo={ --制御文字は消す andKey=(GetVarInt(post,'disableFlag')==1 and '^!{999}' or '') ..(GetVarInt(post,'caseFlag')==1 and 'C!{999}' or '') ..(mg.get_var(post,'andKey') or ''):gsub('%c',''), notKey=notKey:gsub('%c',''), regExpFlag=GetVarInt(post,'regExpFlag')==1, titleOnlyFlag=GetVarInt(post,'titleOnlyFlag')==1, aimaiFlag=GetVarInt(post,'aimaiFlag')==1, notContetFlag=GetVarInt(post,'notContetFlag')==1, notDateFlag=GetVarInt(post,'notDateFlag')==1, freeCAFlag=GetVarInt(post,'freeCAFlag',0,2) or 0, chkRecEnd=GetVarInt(post,'chkRecEnd')==1, chkRecDay=GetVarInt(post,'chkRecDay') or 0, chkRecNoService=GetVarInt(post,'chkRecNoService')==1, chkDurationMin=GetVarInt(post,'chkDurationMin') or 0, chkDurationMax=GetVarInt(post,'chkDurationMax') or 0 } aa.searchInfo.contentList={} for i=0,10000 do local v=GetVarInt(post,'contentList',0,65535,i) if not v then break end table.insert(aa.searchInfo.contentList,{content_nibble=v}) end aa.searchInfo.serviceList={} for i=0,10000 do local v=mg.get_var(post,'serviceList',i) if not v then break end local m={v:match('^(%d?%d?%d?%d?%d)%-(%d?%d?%d?%d?%d)%-(%d?%d?%d?%d?%d)$')} if #m==3 then table.insert(aa.searchInfo.serviceList,{onid=0+m[1],tsid=0+m[2],sid=0+m[3]}) end end aa.searchInfo.dateList={} for v in (mg.get_var(post,'dateList') or ''):gmatch('[^,]+') do local m={v:match('^ *([a-z][a-z])[a-z](%d?%d):(%d?%d)%-([a-z][a-z])[a-z](%d?%d):(%d?%d) *$')} if #m==6 then local dateInfo={ startDayOfWeek=({su=0,mo=1,tu=2,we=3,th=4,fr=5,sa=6})[m[1]], startHour=0+m[2], startMin=0+m[3], endDayOfWeek=({su=0,mo=1,tu=2,we=3,th=4,fr=5,sa=6})[m[4]], endHour=0+m[5], endMin=0+m[6] } if dateInfo.startDayOfWeek and dateInfo.startHour<24 and dateInfo.startMin<60 and dateInfo.endDayOfWeek and dateInfo.endHour<24 and dateInfo.endMin<60 then table.insert(aa.searchInfo.dateList,dateInfo) end end end return edcb.AddOrChgAutoAdd(aa) end end return false end ct=CreateContentBuilder(GZIP_THRESHOLD_BYTE) ct:Append(DOCTYPE_HTML4_STRICT..[=[ EPG予約 - EDCB ]=]) aa={dataID=GetVarInt(mg.request_info.query_string,'id') or 0} if aa.dataID==0 then ct:Append('

EPG予約 新規条件追加

\n
\n') post=AssertPost() if post then if mg.get_var(post,'addchg') then ct:Append('
'..(AddOrChange(0,post) and '追加しました' or '入力値不正')..'
\n') end else aa.searchInfo={ andKey='', notKey='', regExpFlag=false, titleOnlyFlag=false, aimaiFlag=false, notContetFlag=false, notDateFlag=false, freeCAFlag=0, chkRecEnd=false, chkRecDay=6, chkRecNoService=false, chkDurationMin=0, chkDurationMax=0, contentList={}, dateList={}, serviceList={} } end edcb.htmlEscape=15 else ct:Append('

EPG予約 条件変更

\n
\n') post=AssertPost() if post then if mg.get_var(post,'addchg') then ct:Append('
'..(AddOrChange(aa.dataID,post) and '変更しました' or '入力値不正')..'
\n') end end edcb.htmlEscape=15 aa=BinarySearch(edcb.EnumAutoAdd(),aa,CompareFields('dataID')) or aa end if aa.searchInfo then si=aa.searchInfo ct:Append('
\n' ..'
プリセット
\n' ..'
\n' ..'
\n' ..'
条件
\n' ..'
\n' ..'
\n' ..'\n' ..'
\n' ..'

検索条件

\n' ..'検索キーワード

\n' ..'NOTキーワード

\n' ..'メモ

\n' ..' \n' ..'
\n' ..'
\n' ..'
\n' ..'

\n' ..'ジャンル絞り込み(Ctrl+複数選択) \n' ..'
\n'..table.concat(selList,'; ',1,math.min(#selList,10)) ..(#selList>10 and '; ほか'..(#selList-10)..'項目' or '')..'

\n' ..'サービス絞り込み(Ctrl+複数選択)
\n'..table.concat(selList,'; ',1,math.min(#selList,10)) ..(#selList>10 and '; ほか'..(#selList-10)..'項目' or '')..'

\n' ..'時間絞り込み
\n' ..'
\n書式: (sun|mon|tue|wed|thu|fri|sat)H:M-(...)H:M, (例: sun23:0-mon5:0, wed3:0-wed5:0)
\n' ..'
\n') if aa.dataID~=0 then ct:Append('
-
\n' ..'
\n' ..'\n' ..'\n' ..'
\n') end ct:Append('
\n') end ct:Append([=[
]=]) ct:Finish() mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len,ct.gzip)..'\r\n'))