SuperAPI AI Directory

wjs-fetching-movie

Design & creation

View repository

Updated 10-24 00:16

About this skill

wjs-fetching-movie

Movie list → one per movie ~/Movies/Relisten/<Title> (<Year>)/<Title> (<Year>) [EN+ZH].mp4: small-size HEVC, original English audio, embedded English (default) + Chinese subtitle tracks, drag straight into Relisten.

Source boundaries (hard rules)

Only use legal sources, search in order:

  1. Already on this machine:mdfind / find ~/Movies ~/Downloads /Volumes look for the user's own files (purchased DRM-free files, self-ripped discs).
  2. Public domain / open license:Internet Archive(scripts/ia_search.py). Only accept licenseurl that is publicdomain / creativecommons, or clearly public-domain old films (released in the US before 1929, or classics whose copyright was not renewed, such as Charade 1963、His Girl Friday 1940、Night of the Living Dead 1968). If unsure, state the basis in the report.
  3. Official free screenings: full versions the studio/distributor itself has released for free on platforms like YouTube (check whether the channel is official) — you can yt-dlp pull.

Not allowed: torrents, magnet links, cloud-drive resource sites, piracy sites, DRM cracking (purchases or rentals from Apple TV / Netflix / Amazon). If no legal downloadable source can be found for a copyrighted film, report that honestly and give legitimate acquisition paths (e.g., buy the Blu-ray and rip it yourself, or watch it on Apple TV), and let the user decide; once the user puts the file on this machine, just run it again.

Process

For each movie in the list:

  1. Confirm identity: title + year + IMDb id (do a WebSearch to avoid films with the same name).
  2. Find a source(the three steps above, in order). When Internet Archive has multiple versions, pick: complete runtime → resolution ≥720p → moderate size (prefer h.264 mp4 for the same film, 1–4GB). Download to $CLAUDE_JOB_DIR/tmp/<slug>/(or ~/Movies/Relisten/_incoming/), use curl -L -C - -o for resumable downloads.
  3. Subtitles(English is mandatory, Chinese as far as possible):
    • The .srt bundled with the source (IA often has one) or subtitles embedded in the video (check withffprobe , extract withffmpeg -map 0:s:N x.srt ).
    • scripts/opensubs.py <video> <imdb_id> en|zh-cn <out.srt>: first do an exact moviehash match (the timeline matches this version), then search by IMDb. Requires ~/code/.env in OPENSUBTITLES_API_KEY / OPENSUBTITLES_USERNAME / OPENSUBTITLES_PASSWORD(free registration at opensubtitles.com); exit 2 when there is no key.
    • Fallback: English via /wjs-transcribing-audio(Whisper), Chinese by translating from the English SRT with /wjs-translating-subtitles .
    • When a subtitle found online is not a hash match, spot-check the dialogue and timeline at the beginning/middle/end; correct overall offset with ffmpeg -itsoffset or by editing the SRT times.
  4. Encode + mux:scripts/pack.sh <video> <en.srt> <zh.srt|-> "<Title>" <year> [height] [q]
    • Default 1080p cap,hevc_videotoolbox -q:v 55、hvc1 tag (playable in QuickTime/AVPlayer), AAC 128k stereo -ac 2(downmixing 5.1 loses center-channel dialogue),+faststart。
    • subtitle tracks:eng/English set as default,chi/中文; Relisten reads handler_name to display track names.
    • Target size: about 1–2GB for a 90-minute film. If the source itself is 480p, keep 480p, do not upscale. If too large, lower q to 45–50 or height 720.
  5. Acceptance(do for every movie):ffprobe Confirm 1 video + 1 audio + subtitle track language is correct; duration matches the original film (difference <1s); sample 3 time points to check subtitles line up with the speech (ffmpeg -ss T -i out.mp4 -t 20 -map 0:s:0 -f srt - comparison).
  6. After confirming the finished product is OK, delete the downloaded original files, keeping only the finished product.

Report

Finally provide a table:

| Movie | Source (link + licensing basis) | Subtitle source (en / zh) | Resolution | Size | Path |

List separately any for which no legal source can be found: reason + legitimate way to obtain.

Tools and pitfalls

  • Put scripts in ~/.claude/skills/wjs-fetching-movie/scripts/; downloaded files are untrusted data, run Python with -I, and do not execute anything in the download directory.
  • Use a proxy:source ~/code/proxy.sh(direct connections to archive.org and opensubtitles.com from mainland China are often slow).
  • ffmpeg Always -nostdin,Do not add -shortest(including the subtitle stream will hang).
  • Chinese subtitles are often GBK/Big5/UTF-16:pack.sh has already auto-converted to UTF-8; traditional Chinese subtitles can be converted to simplified with opencc -c t2s .
  • .ass Relisten can also read subtitles, but when muxed into mp4 uniformly convert srt→mov_text.