-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua') if JKRDLOG_PATH then dofile(mg.script_name:gsub('[^\\/]*$','')..'jkconst.lua') end function Change(id,post) local r=edcb.GetReserveData(id) if r then if mg.get_var(post,'start-y') then r.startTime={ year=GetVarInt(post,'start-y',1900,3000), month=GetVarInt(post,'start-m',1,12), day=GetVarInt(post,'start-d',1,31), hour=GetVarInt(post,'start-h',0,23), min=GetVarInt(post,'start-i',0,59), sec=GetVarInt(post,'start-s',0,59) } local endHour=GetVarInt(post,'end-h',0,23) local endMin=GetVarInt(post,'end-i',0,59) local endSec=GetVarInt(post,'end-s',0,59) --正当な日時か検査 if r.startTime.year and r.startTime.month and r.startTime.day and r.startTime.hour and r.startTime.min and r.startTime.sec and os.time(r.startTime) and endHour and endMin and endSec then --プログラム予約化 r.eid=65535 r.durationSecond=(endHour-r.startTime.hour)*3600+(endMin-r.startTime.min)*60+endSec-r.startTime.sec r.durationSecond=r.durationSecond+(r.durationSecond<0 and 24*3600 or 0) return edcb.ChgReserveData(r) end else local presetID=GetVarInt(post,'presetID',0,65534) if presetID then local found=BinarySearch(edcb.EnumRecPresetInfo(),{id=presetID},CompareFields('id')) r.recSetting=found and found.recSetting end if r.recSetting then local useMargin=GetVarInt(post,'useDefMarginFlag')~=1 or nil r.recSetting={ batFilePath=r.recSetting.batFilePath, recFolderList=r.recSetting.recFolderList, partialRecFolder=r.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 r.recSetting.recMode and r.recSetting.priority and r.recSetting.suspendMode and (not useMargin or r.recSetting.startMargin and r.recSetting.endMargin) and r.recSetting.tunerID then return edcb.ChgReserveData(r) end end end end return false end --<0:再生画面へのリンク, 0:DLリンク, 1:トランスコード再生画面, 2～:直接再生画面(偶数:ローカルファイル再生) vtag=GetVarInt(mg.request_info.query_string,'vtag') or -1 ct=CreateContentBuilder(GZIP_THRESHOLD_BYTE) ct:Append((vtag<=0 and DOCTYPE_HTML4_STRICT or '\n')..[=[
]=]..DefaultHeadContents()..[=[

# 予約詳細

]=]) id=GetVarInt(mg.request_info.query_string,'id') or 0 fromepg=GetVarInt(mg.request_info.query_string,'fromepg')==1 xq=GetTranscodeQueries(mg.request_info.query_string) post=AssertPost() if post then if mg.get_var(post,'addchg') then ct:Append('
'..(Change(id,post) and '変更しました' or '入力値不正')..'
\n') elseif mg.get_var(post,'del') then rdel=edcb.GetReserveData(id) edcb.DelReserveData(id) ct:Append('
削除しました
\n') end end thumbs={''} recFilePath=edcb.GetRecFilePath(id) edcb.htmlEscape=15 epgDate=0 r=edcb.GetReserveData(id) if r then --番組表のdateクエリは今日(深夜4時区切り)を基準(=0)とする epgDate=math.floor((TimeWithZone(r.startTime)-4*3600)/(24*3600))-math.floor((os.time()+(9-4)*3600)/(24*3600)) epgInfo=ConvertProgramText(edcb.SearchEpg(r.onid,r.tsid,r.sid,r.eid)) dur=r.startTime.hour*3600+r.startTime.min*60+r.startTime.sec+r.durationSecond ct:Append('

\n' ..'
番組情報
0 and ' id="pginfo-desc">'..DecorateProgramText(epgInfo) or '>'..FormatTimeAndDuration(r.startTime, r.durationSecond)..'
'..r.stationName..'
'..r.title..'
' ..('OriginalNetworkID:%d(0x%04X)
'):format(r.onid,r.onid) ..('TransportStreamID:%d(0x%04X)
'):format(r.tsid,r.tsid) ..('ServiceID:%d(0x%04X)
'):format(r.sid,r.sid) )..'\n' ..'
ファイル
  \n') ref=recFilePath and NativeToDocumentPath(recFilePath) if ref then xlist={table.unpack(MEDIA_EXTENSION_LIST)} xlist[#xlist+1]='' for i,ext in ipairs(xlist) do ff=EdcbFindFilePlain(recFilePath..ext) if ff then if vtag==i*2 or vtag==i*2+1 then if vtag%2==0 then ct:Append('
  '..(ext=='' and '(filename:'..mg.md5(ref:upper()):sub(27)..')' or '')..'
  ') end ct:Append(VideoWrapperBegin() ..'/'..EdcbHtmlEscape(ref..ext) ..'' ..''..VideoWrapperEnd(JKRDLOG_PATH and GetChatStreamNameList(),true)..'\n'..VideoScriptTemplate(ext=='')) else ct:Append((ext=='' and '' or '') ..'/'..EdcbHtmlEscape(ref..ext)..(ext=='' and '' or '') ..'\n[OpenFile]' ..'\n[DL]') end if ext=='' then fsec,fsize=0,0 f=edcb.io.open(recFilePath,'rb') if f then fsec,fsize=GetDurationSec(f) if vtag<=0 then thumbs=ThumbnailTemplate(f,fsec,fsize,ref) end f:close() end ct:Append(' ('..('%dm%02ds|'):format(math.floor(fsec/60),fsec%60)..math.floor(fsize/1048576)..'M)
  \n' ..'
  \n' ..(vtag==0 and '\n' or '\n' ..(fromepg and '\n' or '') ..'\n' ..'\n') ..'
  \n' ..'→Video' or '0">DL')..'\n' ..TranscodeSettingTemplate(xq,vtag==0,fsec) ..(vtag==0 and '
  ※OpenFile用のファイルを作成するときは[TS-Live!以外][0m00s][x1.0]を選択してxcodeしてください\n' or '') ..'
  '..thumbs[1]) if vtag==1 then src='xcode.lua?fname='..mg.url_encode(ref)..ConstructTranscodeQueries(xq) ct:Append('\n'..VideoWrapperBegin() ..(xq.tslive and '
  ' or 'xcode') ..VideoWrapperEnd(JKRDLOG_PATH and GetChatStreamNameList())..'\n'..TranscodeScriptTemplate(false,xq.caption,xq.jikkyo,{ofssec=fsec*(xq.offset or 0)/100,fast=xq.fast})) if xq.tslive then ct:Append(TsliveScriptTemplate(xq.autoCinema)) elseif ALLOW_HLS then ct:Append(HlsScriptTemplate('xcode.lua')) end end ct:Append([=[
  字幕リスト
  ]=]) else ct:Append((vtag~=i*2 and vtag~=i*2+1 and '\n[Mux-to-TS]' or '') ..' ('..math.floor(ff.size/1048576)..'M)
  \n') end end end end ct:Append('
\n' ..'
'..(r.eid==65535 and 'プログラム予約' or 'プログラム予約化（プログラム予約化は元に戻せません。番組を特定できなくなるため追従もできません。）') ..'
  \n' ..'
  \n' ..'\n' ..'予約日時: //\n:: ～\n::
  \n' ..'
\n' ..'
プリセット
  \n' ..'
  \n' ..'\n' ..(fromepg and '\n' or '') ..'
\n' ..'
録画設定
  \n' ..'
  \n' ..'\n' ..'\n' ..RecSettingTemplate(rs)..'
\n' ..'
-
  \n') if fromepg then --一覧に戻ると使い勝手が悪いため ct:Append('
  \n' ..'\n' ..'\n') else ct:Append('
  \n' ..'\n' ..'\n') end ct:Append('
\n' ..'

\n') end ct:Append([=[
]=]) for i=2,#thumbs do ct:Append(thumbs[i]) end ct:Append([=[
]=]) ct:Finish() mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len,ct.gzip) ..'Cross-Origin-Embedder-Policy: require-corp\r\n' ..'Cross-Origin-Opener-Policy: same-origin\r\n' ..'\r\n'))