연령 제한("Sign in to confirm your age") 영상이 플레이리스트 임포트에서
실패하던 문제 해결. 관리자 대시보드에서 Netscape cookies.txt 를 등록하면
단일/플레이리스트 probe 와 실제 다운로드에 모두 --cookies 로 적용된다.
쿠키는 data/cookies.txt 에 0600 으로 저장(git 제외). 연령/로그인 실패 시
yt-dlp 원문 대신 쿠키 등록을 안내하는 메시지를 표시.
Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
다운로드 시작 전, 수정해둔 값(플레이리스트 URL + 항목별 제목/ID/시작/길이/
ID모드/자릿수채우기)을 폴더당 1개 저장하고 나중에 불러올 수 있게 함.
- db: playlist_drafts 테이블 (folder_id PK, JSON data, updated_at)
- storeDb: savePlaylistDraft/getPlaylistDraft/deletePlaylistDraft
- op: GET/POST/POST(delete) /playlist/draft (하위 폴더 한정)
- UI: 임시저장 / 불러오기 / 삭제 버튼 + 진입 시 기존 draft 자동 감지
Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
폴더가 다르면 같은 영상 ID(예: 1,2,3,4)를 재사용할 수 있도록 변경.
ID 가 더 이상 전역 PK 가 아니므로 모든 영상 조회를 폴더 스코프로 전환:
- db: videos PK→UNIQUE(folder_id,id) + 기존 DB 자동 마이그레이션
- storeDb: getVideo→getVideoInFolder(folderId,id) + getVideoByIdGlobal 폴백
- public/op/editor/youtube: 재생·썸네일·편집·삭제·rename 모두 폴더 스코프
- 썸네일을 경로기반 URL(/file/video/<폴더>/<id>/thumb)로 전환
- 클라이언트 mutation 요청에 folderId 동봉
Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
오래된 ffmpeg/yt-dlp 로 다운로드·변환이 실패할 때 관리자 대시보드에서
최신 버전으로 재설치할 수 있게 한다. 재설치 바이너리는 data 볼륨 하위
data/bin 에 두어 컨테이너 재생성에도 유지하고, 바이너리 해석 시 PATH 보다
우선 사용한다.
- src/paths.ts: binDir(data/bin) 추가
- src/editor.ts: binDir 우선 ffmpeg 해석 + getFfprobePath/resetFfmpegResolution
- src/youtube.ts: binDir 우선 yt-dlp 해석 + resetYtDlpResolution
- src/tools.ts(신규): 버전 조회 + 최신 재설치(GitHub yt-dlp, johnvansickle ffmpeg)
- src/routes/op.ts: GET /op/tools, POST /op/tools/:name/update
- views/op/dashboard.ejs, public/dashboard.js, public/styles.css: 도구 관리 UI
- Dockerfile: ffmpeg 정적 빌드(.tar.xz) 해제용 xz-utils 추가
Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
플레이리스트 가져오기 화면에 다음을 추가:
- 항목별 제목 입력을 절반으로 줄이고 오른쪽에 시작/종료 시간 입력 추가
(기본 시작 0, 종료는 영상 길이)
- 정렬 옵션 옆에 일괄 시작/종료 입력과 적용/초기화 버튼 추가
(초기화 = 시작 0, 종료 = 영상 길이)
- 항목 썸네일 클릭 시 YouTube 임베드로 미리보기 재생
- 항목 우클릭 → 자르기 메뉴 → /video/editor 식 타임라인 모달(YouTube IFrame)
에서 구간을 정하면 항목의 시작/종료 입력에 반영
- 백엔드: playlist/start 가 항목별 startSec/endSec 를 받아 다운로드 잡에
실어 보내고, 60fps 후처리 후 ffmpeg 로 해당 구간을 잘라 편집본 생성
Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
1단계 폴더에도 영상을 직접 추가할 수 있게 한다 (하위 폴더와 혼합 가능).
플레이리스트 추가는 기존대로 2단계 폴더 한정.
- op.ts: editor/upload/youtube start 의 parentId===null 차단 제거
(playlist probe/start/new 차단은 유지)
- op/folder.ejs: 1단계에서 "하위 폴더 추가"+"영상 추가" 동시 노출,
서브폴더 그리드와 영상 그리드를 함께 표시
- folder.ejs(public): 1단계에서 하위 폴더 + 영상 함께 표시
- README: 폴더 구조/버튼 설명 갱신
Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
simplify skill 결과 정리:
- editor.ts: HW→libx264 잡 폴백 패턴을 encodeWithFallback() 한 곳으로
모으고 upscale/trim 양쪽에서 호출. 진행률 무전송 변형은 runner 인자로 분기.
- editor.ts: upscaleOriginalTo60Fps 가 fps/해상도/길이를 위해 spawnSync
ffprobe 를 3번 돌리던 것을 probeVideoMeta() 한 번 호출로 통합. 핫패스에서
이벤트 루프 블로킹을 줄임. 이제 미사용이 된 probeVideoResolution/
probeVideoDuration 은 제거.
- routes/helpers.ts: op.ts/public.ts 양쪽에 동일하게 있던
collectFolderSegments 를 공용 모듈로 추출.
- youtube.ts: probeYoutube/probeYoutubePlaylist 의 stderr 누적을
runFfmpeg 와 동일하게 마지막 2KB 만 유지하도록 캡.
README.md 도 5/31 STEP 1~5 (중첩 폴더 + 영상 ID 편집 + 플레이리스트
임포트 + 짧은 공유 URL) 과 5/16 묶음(부드러운 진행바 + 60fps/FHD 캡 +
HW 인코더 자동 감지) 까지 반영해 전반 갱신.
`npm run build` 통과.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds /op/folder/:top/:sub/playlist/new page that lets the operator paste a
YouTube playlist URL, probe entries via yt-dlp, reorder them by drag, edit
title/ID per row, and choose between random IDs or zero-padded sequential
IDs before registering all jobs in one batch.
영상 단건 import 와 동일한 패턴으로 2단계 폴더 전용 endpoint 두 개를
추가했다.
- src/youtube.ts: `probeYoutubePlaylist(url)` — yt-dlp 의
`--flat-playlist --dump-json` 으로 한 줄당 한 항목을 받아
`{ url, title, durationSec, originalIndex }` 배열로 정리한다.
내부 컨테이너 라인(`_type==='playlist'`) 은 스킵.
- src/routes/op.ts:
- POST `/op/folder/:topName/:subName/playlist/probe`
URL 만 받고 위 함수를 호출해서 entries 를 돌려준다.
- POST `/op/folder/:topName/:subName/playlist/start`
UI 가 큐레이션한 `[{ url, title, videoId }]` 를 받아
`isSafeVideoId` 형식 검사, 요청 내 중복 검사, DB 충돌 검사를
순서대로 한 뒤 항목별로 `startYoutubeDownload` 를 호출.
두 endpoint 모두 1단계 폴더 path 는 router 매칭 자체에서 빠져
(sub 만 등록) 자연스럽게 404 가 난다.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
`videoIdExists()`는 잘못된 형식의 ID 에 대해 false 를 반환하기 때문에
형식 오류가 곧바로 `{available:true}` 로 흘러나가는 계약 위반이 있었다.
이제 빈 값 검사 직후 `isSafeVideoId` 로 형식을 먼저 거르고,
형식 오류면 `{available:false, reason:'형식: 영문/숫자/_/- (1~64자)'}`
로 응답한다. 클라이언트 regex 와 동일한 형식이라 메시지도 일관된다.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- routes/op.ts: editor / upload / youtube-start reject when folder.parentId === null
- op/folder.ejs: at depth 1 show only "하위 폴더 추가"; at depth 2 show
"영상 추가" + "플레이리스트 추가". Video grid and sub-folder modal
rendered conditionally.
- folder.ejs (public): at depth 1 render only sub-folder grid; at depth 2
render only video grid.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Review P1: 진행률 폴링이 304 응답을 받으면 r.json() 이 reject 되는데
.catch() 가 없어 setTimeout 도 안 걸리고 폴링이 영구 중단됐습니다.
이게 "60fps 변환 확인 중" 에서 바가 멈춰 보이던 진짜 원인이었어요.
세 곳을 다 고침:
1) src/routes/op.ts `/op/job/:id`
- `Cache-Control: no-store, no-cache, must-revalidate` + `Pragma: no-cache`
- 브라우저가 conditional GET 으로 304 를 받지 않게 한다.
2) public/editor.js fetch
- `{ cache: 'no-store' }` 옵션. 서버 헤더 + 클라 옵션 둘 다.
3) public/editor.js pollJob
- `.catch()` 추가. 일시적 네트워크/파싱 오류여도 2 초 백오프로
폴링을 재개한다. 변환이 오래 걸려도 바가 계속 갱신됨을 보장.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
리뷰어 지적사항 반영:
- "abc" 같은 오타도 Infinity 로 풀리던 문제 수정. 잘못된 값은 기본 1 GiB 로
fallback 하고 경고 로그를 남김. 무제한은 "0" 또는 "Infinity" 만 명시적으로 인정.
- .env.example / README 의 "비우면 무제한" 표현을 코드 동작과 일치시켜
"비우면 기본 1 GiB" 로 정정.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
기본 업로드 한도를 1 GiB (1073741824 바이트) 로 설정. .env 의 UPLOAD_MAX_BYTES 로
바꿀 수 있고, 0 이나 Infinity 로 두면 무제한.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
scripts/setup.mjs runs `npm install`, downloads the platform-specific
yt-dlp binary from GitHub releases to ./bin/yt-dlp (which src/youtube.ts
already prefers), checks for ffmpeg and prints install hints, then runs
`tsc`. One command replaces three for fresh checkouts.
While verifying setup, hit `MulterError: File too large` (LIMIT_FILE_SIZE)
on a 10 GB mkv upload, and ETXTBSY on freshly downloaded yt-dlp.
- ETXTBSY: the redirect path in downloadFile opened a writestream to the
destination before following the redirect, so the (unused) outer stream
still held the file open when the post-download spawnSync ran. Split
redirect-following from file writing so only the final 200 response
opens the destination file.
- LIMIT_FILE_SIZE: removed the hard-coded 4 GB cap. Upload limit now
defaults to Infinity and is configurable via UPLOAD_MAX_BYTES.
Wrapped multer's middleware so its errors (LIMIT_FILE_SIZE etc.) come
back as a clean 413 JSON instead of a stack trace from the global
error handler.
- Also disabled Node's default 5 minute requestTimeout so 10 GB uploads
over slow links don't get cut mid-stream. Configurable via
HTTP_REQUEST_TIMEOUT_MS.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>