-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua') 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')..[=[ 録画済み詳細 - EDCB

録画済み詳細

]=]) id=GetVarInt(mg.request_info.query_string,'id') or 0 xq=GetTranscodeQueries(mg.request_info.query_string) w=edcb.GetRecFileInfoBasic(id) post=AssertPost() if post then if mg.get_var(post,'protect') then edcb.ChgProtectRecFileInfo(id,mg.get_var(post,'protect')=='y') ct:Append('
変更しました
\n') elseif mg.get_var(post,'ren') then ren=DocumentToNativePath(mg.get_var(post,'ren')) if not w or not ren then ct:Append('
パスが不正のためリネームできません
\n') elseif not ren:find('[^'..DIR_SEPS..']%.[0-9A-Za-z]+$') or not IsEqualPath(ren:match('%.[0-9A-Za-z]+$'),w.recFilePath:match('%.[0-9A-Za-z]+$') or '') then ct:Append('
拡張子はリネームできません
\n') elseif not ren:find('['..DIR_SEPS..'][^'..DIR_SEPS..']+$') or not (EdcbFindFilePlain(ren:gsub('['..DIR_SEPS..'][^'..DIR_SEPS..']+$','')) or {}).isdir then ct:Append('
移動先のディレクトリが存在しません
\n') elseif not EdcbFindFilePlain(w.recFilePath) then --情報だけ変更 edcb.ChgPathRecFileInfo(id,ren) w.recFilePath=ren ct:Append('
リネームしました
\n') elseif not IsEqualPath(ren,w.recFilePath) and EdcbFindFilePlain(ren) then ct:Append('
移動先にファイルが存在します
\n') elseif not edcb.os.rename(w.recFilePath,ren) then ct:Append('
ファイルを移動できません
\n') else --拡張子が付加されたファイルも移動する oriName=w.recFilePath:match('[^'..DIR_SEPS..']*$') for i,v in ipairs(edcb.FindFile(w.recFilePath:sub(1,#w.recFilePath-#oriName)..oriName:gsub('%*','?')..'.*',0) or {}) do if #oriName<#v.name and IsEqualPath(oriName,v.name:sub(1,#oriName)) then edcb.os.rename(w.recFilePath..v.name:sub(#oriName+1),ren..v.name:sub(#oriName+1)) end end --録画情報保存フォルダのファイルも移動する recInfoFolder=edcb.GetPrivateProfile('SET','RecInfoFolder','','Common.ini') if recInfoFolder~='' then renName=ren:match('[^'..DIR_SEPS..']*$') for i,v in ipairs({'.err','.program.txt'}) do edcb.os.rename(PathAppend(recInfoFolder,oriName..v),PathAppend(recInfoFolder,renName..v)) end end edcb.ChgPathRecFileInfo(id,ren) w.recFilePath=ren ct:Append('
リネームしました
\n') end end end edcb.htmlEscape=15 v=edcb.GetRecFileInfo(id) if v then if #v.programInfo>0 then v.programInfo=DecorateUri(v.programInfo) elseif v.eid~=65535 then --過去番組情報を探してみる ev=edcb.EnumEventInfoArchive and edcb.EnumEventInfoArchive({{onid=v.onid,tsid=v.tsid,sid=v.sid}},{startTime=v.startTime,durationSecond=1}) if ev and #ev>0 then v.programInfo=ConvertProgramText(ev[1]) else --番組情報を探してみる ev=edcb.SearchEpg(v.onid,v.tsid,v.sid,v.eid) if ev and ev.startTime and os.time(ev.startTime)==os.time(v.startTime) then v.programInfo=ConvertProgramText(ev) end end end ct:Append('
\n' ..'
番組名
'..FormatTimeAndDuration(v.startTime, v.durationSecond)..'
'..v.serviceName..'
'..v.title..'
\n' ..'
結果
'..v.comment..'
\n' ..'
ドロップ
'..v.drops..'
\n' ..'
スクランブル
'..v.scrambles..'
\n' ..'
ファイル
\n') ref=w and NativeToDocumentPath(w.recFilePath) if ref then xlist={table.unpack(MEDIA_EXTENSION_LIST)} xlist[#xlist+1]='' for i,ext in ipairs(xlist) do ff=EdcbFindFilePlain(w.recFilePath..ext) if ff then if vtag==i then ct:Append(VideoWrapperBegin() ..''..VideoWrapperEnd()..'\n'..VideoScriptTemplate()) else ct:Append('/'..EdcbHtmlEscape(ref..ext) ..'\n[DL]') end if ext=='' then fsec,fsize=0,0 f=edcb.io.open(w.recFilePath,'rb') if f then fsec,fsize=GetDurationSec(f) f:close() end ct:Append(' ('..('%dm%02ds|'):format(math.floor(fsec/60),fsec%60)..math.floor(fsize/1048576)..'M)\n' ..'\n' ..'
\n' ..'\n' ..'
\n' ..'※拡張子が付加されたファイルも移動します(.err, .program.txtなど)\n' ..'
\n' ..'
\n' ..(vtag==0 and '\n' or '\n\n' ..'\n') ..'\n' ..'→Video' or '0">DL')..'\n' ..TranscodeSettingTemplate(xq,fsec) ..'
') if vtag==10 then src='xcode.lua?fname='..mg.url_encode(ref)..ConstructTranscodeQueries(xq) ct:Append('\n'..VideoWrapperBegin() ..(xq.tslive and '' or '') ..VideoWrapperEnd()..'\n' ..'\n'..TranscodeScriptTemplate(false,xq.caption,xq.jikkyo,{ofssec=fsec*(xq.offset or 0)/100,fast=xq.fast})) if xq.tslive then ct:Append(TsliveScriptTemplate()) elseif ALLOW_HLS then ct:Append(HlsScriptTemplate('xcode.lua')) end end else ct:Append((vtag~=i and '\n[Mux-to-TS]' or '') ..' ('..math.floor(ff.size/1048576)..'M)
\n') end else --ファイルが見つからない場合もリネームはできるようにしておく if ext=='' then ct:Append('
\n' ..'\n' ..'
\n' ..'
\n') end end end end ct:Append('
\n' ..'
プロテクト
\n' ..'
\n' ..'\n' ..'\n' ..'
\n' ..(#v.programInfo>0 and '
番組情報
\n'..v.programInfo:gsub('\r?\n', '
\n')..'
\n' or '') ..(#v.errInfo>0 and '
エラーログ
\n'..v.errInfo:gsub('\r?\n', '
\n')..'
\n' or '') ..'
-
\n' ..'
\n' ..'\n' ..'\n' ..'
\n' ..'
\n') 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'))