Claude Skill

lov-media-fetch

Use when the user asks to find and download a film, series, or long video. 以 aria2 为默认传输后端,完成多源测速、续传、容量预检、版本核验与字幕验收;也适用于“帮我下载这部电影”。

LLM Mart · 0 points · 14 views 0 listing impressions 0 install-command copies
Download lovstudio-skills-skills_media-fetch-0b16007.zip · 69 KB
This skill couldn't be refreshed from GitHub on the last check — you're seeing the last imported snapshot.

Install

skills CLI npx skills add https://github.com/lovstudio/skills/tree/main/skills/media-fetch
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install lovstudio-skills@llmmart
Git git clone https://github.com/lovstudio/skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole lovstudio/skills collection as a plugin from our marketplace. Git is the plain clone.

README

影视寻宝 · Media Finder

Version

一键完成长视频的检索、版本选择、磁盘预检、多源测速下载、可恢复续传、慢源切换和文件验收。

本地安装

通过 Agent Skills 安装器:

npx skills add https://github.com/lovstudio/media-fetch-skill --skill lov-media-fetch

或在本仓库根目录创建开发链接:

export SKILL_SOURCE_DIR="$(pwd)"
mkdir -p "${SKILL_SKILLS_INSTALL_DIR:?请设置本地 Skills 目录}"
ln -s "$SKILL_SOURCE_DIR" \
  "$SKILL_SKILLS_INSTALL_DIR/lov-media-fetch"

安装链接必须解析到当前源码目录;打包文件不等于本地安装。

用户配置

默认下载到 $HOME/Downloads/Media。首次运行先查看解析结果:

python3 scripts/media_config.py show

确认后写入共享配置:

python3 scripts/media_config.py init --write

显式请求和环境变量始终覆盖配置。默认只启用 aria2;可选 qBittorrent 密码只通过 QBITTORRENT_PASSWORD 或系统凭据提供。

使用

  • “帮我找并下载《影片名》的导演剪辑版,优先中英字幕,体积控制在 20GB 内。”
  • “Find and download the best compact 4K release of TITLE, then verify the English and Chinese subtitles.”
  • “这个 Magnet 帮我下载;先确认磁盘够用,太慢就自动换另一个版本。”

自然语言调用默认运行 full 流水线。已有链接使用 download-known;本地文件验收使用 verify。 aria2 默认负责 HTTP(S)、Magnet 和 Torrent 的测速、下载与续传。qBittorrent 仅在 需要搜索插件、队列界面、BT 深度管理或长期做种时启用。每次后端选择与切换都写入 transport trace,不把客户端进度当作最终完成证据。

可选 qBittorrent 连接

启用该适配器时,将 WebUI 限定在本机回环地址。已有兼容客户端时直接复用,密码 保存在系统凭据中,再通过环境变量注入当前任务。

export QBITTORRENT_URL="http://127.0.0.1:8080"
export QBITTORRENT_USERNAME="admin"
export QBITTORRENT_PASSWORD="从安全凭据读取"

主链路依次运行:

python3 scripts/rank_candidates.py --input candidates.json --output decision.json
python3 scripts/storage_preflight.py --decision decision.json
python3 scripts/aria2_acquire.py \
  --input INPUT --job-id JOB_ID --output-dir "$HOME/Downloads/Media" \
  --result aria2-acquisition.json --watch --no-proxy
python3 scripts/verify_media.py --path "$HOME/Downloads/Media" --output verification.json

若直接 URL 的路径没有媒体扩展名,给 aria2 增加 --output-name "TITLE (YEAR).mp4"。可选 qBittorrent 搜索与获取脚本仍保留:

python3 scripts/qbittorrent_search.py --query "TITLE YEAR" --output candidates.json
python3 scripts/qbittorrent_acquire.py \
  --decision decision.json --wait-complete --result qbit-acquisition.json

质量门

python3 scripts/validate_skill.py .
python3 scripts/test_aria2_acquire.py
python3 scripts/media_config.py show --json
python3 scripts/rank_candidates.py \
  --input assets/example-candidates.json \
  --output /tmp/media-fetch-decision.json
python3 scripts/storage_preflight.py \
  --decision /tmp/media-fetch-decision.json \
  --output-dir /tmp
python3 scripts/aria2_acquire.py \
  --input 'https://example.invalid/movie.mp4' \
  --job-id validation-direct --output-dir /tmp \
  --result /tmp/media-fetch-aria2-direct.json --dry-run
python3 scripts/aria2_acquire.py \
  --input 'magnet:?xt=urn:btih:0123456789abcdef0123456789abcdef01234567' \
  --job-id validation-bt --output-dir /tmp \
  --result /tmp/media-fetch-aria2-bt.json --dry-run

依赖

  • Python 3.9+
  • PyYAML(Skill 源码校验)
  • aria2 1.36+(默认 HTTP、Magnet 与 Torrent 下载后端)
  • FFmpeg / ffprobe(媒体验收)
  • 可选:Rats Search(独立 DHT 检索)
  • 可选:qBittorrent 5.x WebUI(搜索插件、队列管理、做种)

字幕分支

默认验收 zh-Hans 与 en。如果成片只有英文字幕,先匹配同一发行版本的外置 SRT,再交给 lov-subtitle-freedom-skill 做时间轴、UTF-8 和 SRT 保真处理。该 Skill 的英文学习提示、人物卡和 ASS 样式均需要明确开启;Media Fetch 不会把它们 作为简中字幕输出。

用户案例

《指环王》三部曲的实际任务验证了后端解耦的价值:可选 qBittorrent 搜索并测速后, 主候选在首轮实测偏慢,aria2 使用同一信息哈希、DHT/PeX/LSD 与 Tracker 续传,最终得到 3 个可读的 1080p HEVC 文件。下载报告为 complete,媒体验收为 passed_with_warnings,唯一开放项是原发行文件未嵌入 zh-Hans,因此报告继续 保留字幕缺口而不是虚报“双语完成”。完整脱敏证据位于 cases/evidence/。

License

MIT

Skill manifest

影视寻宝 · Media Finder

Turn one natural-language request into a verified local media file. Search broadly, identify the actual cut, balance picture quality against size, check storage before transfer, race viable sources, monitor the winner, recover from stalls, and inspect the completed file.

Triggers

Activate when

  • 用户说“帮我找并下载这部电影”“下载导演剪辑版,画质好一点但别太大”“找带中英字幕的完整版”。
  • 用户给出片名、年份、版本偏好,或已有 Magnet/Torrent,希望自动完成选择、下载和验收。
  • The user asks to find and download the best release, fetch an extended cut, or download a compact high-quality copy with Chinese and English subtitles.

Do not activate when

  • 用户只想了解影片资料、比较不同剪辑或获得观看建议,不要求取得本地文件。
  • 用户只要下载普通网页文件、软件安装包、网页视频片段或直播流。
  • 用户明确要求发布、上传、转码压制或制作字幕;这些是下载完成后的独立任务。

Product contract

  • One request should normally run end to end without repeated confirmation.
  • Prefer an edition whose identity is supported by runtime, release metadata, or file-level evidence. A filename alone is weak evidence.
  • “Best” means the highest useful viewing quality inside the user's size and disk budget, not the largest file or highest advertised resolution.
  • Default to embedded Simplified Chinese plus English subtitles. Treat filename claims as hints until streams or synchronized external subtitles are inspected.
  • Ask the user only when title identity is ambiguous, editions contain materially different content, or the top candidates are close enough that taste decides.
  • Never begin payload transfer before the destination capacity check passes.
  • Keep observing an active job. A task added to a client is not a completed result.
  • Completion means that the final local payload exists and the verification report is written. A client-reported 100% is only an intermediate signal.
  • Keep advertised seeders, observed peers, metadata readiness, received bytes, and sustained speed as separate evidence fields. A large seeder count is not a speed promise.
  • Use aria2 as the default transfer backend for direct URLs, Metalinks, Magnets, and Torrent inputs. Enable qBittorrent only when its search plugins, queue UI, swarm inspection, or long-term seeding materially helps the task. Record every backend choice and switch; do not create a second full payload by accident.
  • A missing zh-Hans stream is a recoverable subtitle gap, not a reason to mislabel the media. The subtitle branch may consult lov-subtitle-freedom-skill for timestamp-preserving UTF-8 SRT handling. Its English-learning gloss and ASS modes stay opt-in; plain Chinese subtitle delivery remains a separate, clearly named SRT.

User configuration

Resolve defaults through $KIT_DIR/references/user-config.md. On first use, show the resolved output directory and preferences before persisting them. Keep credentials in environment variables or the operating system credential store.

Skill Kit modules

Load the selected module completely before acting:

  • $SKILL_DIR/skills/media-discovery/SKILL.md — identify the title and collect normalized candidates from several independent discovery paths.
  • $SKILL_DIR/skills/media-selection/SKILL.md — verify editions and rank picture, codec, size, audio, subtitles, health, and evidence.
  • $SKILL_DIR/skills/media-acquisition/SKILL.md — capacity preflight, parallel swarm probing, winner selection, progress observation, stall recovery, and cleanup.
  • $SKILL_DIR/skills/media-verification/SKILL.md — inspect the downloaded files, edition runtime, streams, subtitle coverage, completeness, and final path.

kit.yaml defines the available pipelines. Shared schemas and decision rules live in $KIT_DIR/references/.

Workflow (MANDATORY)

You MUST follow these steps in order.

Step 0: Resolve runtime and select a pipeline

  1. Resolve SKILL_DIR, KIT_DIR, configuration, aria2 availability, and ffprobe. Detect qBittorrent as an optional capability; its absence must not block discovery, transfer, resume, verification, or reporting.
  2. On first use, bootstrap missing stable aria2 and ffprobe dependencies through the platform's native package manager. When qBittorrent is explicitly enabled, keep its WebUI on loopback and its credential in the operating system credential store. Do not put secrets in profile or reports.
  3. Preserve existing client tasks. Every task created by this Skill must receive a unique job tag and an isolated probe directory.
  4. Select full for a title request, choose for comparison only, download-known for supplied links, resume for an existing job, or verify for a local file.
  5. Read $KIT_DIR/references/candidate-schema.md, then validate all handoff JSON.

Step 1: Resolve the requested work

Capture title, year, media type, season/episode when relevant, edition preference, maximum size, destination override, audio/subtitle preference, and urgency. Infer omitted values from the portable profile. Do not ask the user to choose tooling.

Step 2: Discover independent candidates

Run the discovery module. Use at least two independent discovery paths when possible: direct web or catalog research, a local DHT index such as Rats Search, user-supplied links, or the optional qBittorrent search API. Deduplicate by info hash and canonical release identity. Preserve a .torrent URL or local Torrent path even when its info hash is not known until metadata resolution.

For title and edition truth, prefer distributor, studio, disc, catalog, or reliable release metadata. Keep search-result claims separate from verified facts.

Step 3: Rank releases and resolve genuine ambiguity

Run the selection module and scripts/rank_candidates.py. Apply $KIT_DIR/references/quality-policy.md.

  • Auto-select when one candidate clearly leads and its edition is supported.
  • Show at most three concise choices when the output says choice_required=true.
  • Explain only the user-facing tradeoff: edition/content, picture, size, subtitles, and current health. Do not expose internal scoring mechanics unless asked.

Step 4: Preflight destination capacity

Resolve the destination, candidate size, probe concurrency, temporary probe budget, fallback resume allowance, and free-space reserve. Run scripts/storage_preflight.py before starting either backend.

If capacity is short, report available, required, and shortfall immediately. Offer the best smaller candidate or a different destination, then wait for that user-facing decision. Never silently consume the reserve.

Step 5: Probe, select, and download

Run the acquisition module and $KIT_DIR/references/acquisition-policy.md.

  1. Probe up to the configured concurrency in isolated per-candidate directories. Use aria2 by default and allocate distinct listen/RPC ports for concurrent jobs.
  2. Observe warm speed, sustained speed, availability, peers, metadata readiness, and ETA; a short burst alone does not win.
  3. Pause non-winners, move the winner to the final destination, and continue polling.
  4. If the winner stalls beyond the configured threshold, pause it and first try the next proven candidate. Preserve the same aria2 job identity and .aria2 state when restarting an input. Switch to qBittorrent only when it is enabled and measured evidence shows a healthier swarm or the user needs its queue/seeding behavior. Record the reason, backend, and observed rate for each switch.
  5. If all candidates are slow, return to discovery for another wave.
  6. Keep the terminal session alive and poll at intervals short enough to provide the user a progress update at least once per minute during active work.
  7. Clean only exact job-tagged losing tasks and their isolated probe files after the final candidate is complete. Leave pre-existing client tasks untouched.

Step 6: Verify the completed media

Run the verification module and scripts/verify_media.py.

  • Confirm a readable video stream, non-zero duration, expected resolution and codec, audio tracks, subtitle streams, and duration close to the selected edition.
  • Inspect every episode for episodic requests; a season folder is complete only when the requested episode set is present.
  • When preferred subtitles are missing, search for a subtitle from the exact release or a synchronized subtitle checked against duration and scene boundaries. For a Simplified Chinese SRT handoff, preserve cue timing, UTF-8, source immutability, and adjacent naming as described in references/subtitle-handoff.md; do not create an English-learning gloss or ASS file unless explicitly requested.
  • Recheck final free space and ensure no partial suffix remains on the primary file.

Step 7: Report the result

Lead with completion status and the exact local path. Include title/edition, video and audio summary, subtitle coverage, final size, advertised versus observed source health, transport trace, elapsed time, and any remaining evidence gap. Distinguish download_status, verification_status, and subtitle_status.

References

  • $KIT_DIR/references/candidate-schema.md — normalized candidate and decision JSON.
  • $KIT_DIR/references/quality-policy.md — edition, picture, codec, size, language, and ambiguity rules.
  • $KIT_DIR/references/acquisition-policy.md — capacity, probing, monitoring, switching, and cleanup rules.
  • $KIT_DIR/references/user-config.md — portable defaults and secrets handling.
  • $KIT_DIR/references/subtitle-handoff.md — Simplified Chinese SRT matching and the opt-in handoff to lov-subtitle-freedom-skill.

Dependencies

  • Python 3.9+ for deterministic helpers.
  • aria2 1.36+ for primary HTTP(S), Metalink, Magnet, and Torrent acquisition.
  • Optional qBittorrent 5.x with WebUI enabled for integrated search, BT management, queue visibility, or long-term seeding.
  • Search plugins or another discovery adapter for title search.
  • ffprobe from FFmpeg for final stream and duration inspection.
  • Optional Rats Search for independent DHT discovery.

Runtime context (shared)

运行前读取本 Skill 包的 skill.yaml,由宿主提供 skill-runtime/v1 上下文。字段解析顺序为:当前请求、项目上下文、个人 Preferences、品牌 Profile、通用默认值。

  • 只使用 Manifest 声明的字段;Profile 保存公开品牌事实,Preferences 保存个人工作偏好。
  • required: true 字段缺失时,按 Manifest 的问题配置向用户提出一个聚焦问题;用户明确同意后再保存回答。
  • 报错提供可复制的 context_id、字段路径与来源,诊断内容避开秘密、完整私人路径和原始配置。
Files (skills)
  • assets
    • example-candidates.json 2.8 KB
      Loading…
    • example-qbit-results.json 708 B
      Loading…
  • cases
    • evidence
      • lotr-download.json 1.3 KB
        Loading…
      • lotr-verification.json 1.2 KB
        Loading…
    • cases.json 1.6 KB
      Loading…
  • references
    • acquisition-policy.md 4 KB
      Loading…
    • candidate-schema.md 3.5 KB
      Loading…
    • quality-policy.md 3.3 KB
      Loading…
    • subtitle-handoff.md 1.5 KB
      Loading…
    • user-config.md 3.1 KB
      Loading…
  • scripts
    • aria2_acquire.py 19.5 KB
      Loading…
    • media_config.py 6.8 KB
      Loading…
    • qbittorrent_acquire.py 18 KB
      Loading…
    • qbittorrent_search.py 7.5 KB
      Loading…
    • rank_candidates.py 9.9 KB
      Loading…
    • storage_preflight.py 4.4 KB
      Loading…
    • test_aria2_acquire.py 3.2 KB
      Loading…
    • validate_skill.py 17.5 KB
      Loading…
    • verify_media.py 7.9 KB
      Loading…
  • skills
    • media-acquisition
      • SKILL.md 5.2 KB
        Loading…
    • media-discovery
      • SKILL.md 4.2 KB
        Loading…
    • media-selection
      • SKILL.md 4 KB
        Loading…
    • media-verification
      • SKILL.md 3.6 KB
        Loading…
  • .gitignore 84 B · in bundle
  • AGENTS.md 1 KB
    Loading…
  • CHANGELOG.md 1.4 KB
    Loading…
  • kit.yaml 874 B
    Loading…
  • LICENSE 1 KB · in bundle
  • pricing-card.yaml 648 B
    Loading…
  • README.md 4.8 KB
    # 影视寻宝 · Media Finder
    
    ![Version](https://img.shields.io/badge/version-0.4.0-CC785C)
    
    一键完成长视频的检索、版本选择、磁盘预检、多源测速下载、可恢复续传、慢源切换和文件验收。
    
    ## 本地安装
    
    通过 Agent Skills 安装器:
    
    ```bash
    npx skills add https://github.com/lovstudio/media-fetch-skill --skill lov-media-fetch
    ```
    
    或在本仓库根目录创建开发链接:
    
    ```bash
    export SKILL_SOURCE_DIR="$(pwd)"
    mkdir -p "${SKILL_SKILLS_INSTALL_DIR:?请设置本地 Skills 目录}"
    ln -s "$SKILL_SOURCE_DIR" \
      "$SKILL_SKILLS_INSTALL_DIR/lov-media-fetch"
    ```
    
    安装链接必须解析到当前源码目录;打包文件不等于本地安装。
    
    ## 用户配置
    
    默认下载到 `$HOME/Downloads/Media`。首次运行先查看解析结果:
    
    ```bash
    python3 scripts/media_config.py show
    ```
    
    确认后写入共享配置:
    
    ```bash
    python3 scripts/media_config.py init --write
    ```
    
    显式请求和环境变量始终覆盖配置。默认只启用 aria2;可选 qBittorrent 密码只通过
    `QBITTORRENT_PASSWORD` 或系统凭据提供。
    
    ## 使用
    
    - “帮我找并下载《影片名》的导演剪辑版,优先中英字幕,体积控制在 20GB 内。”
    - “Find and download the best compact 4K release of TITLE, then verify the English and Chinese subtitles.”
    - “这个 Magnet 帮我下载;先确认磁盘够用,太慢就自动换另一个版本。”
    
    自然语言调用默认运行 `full` 流水线。已有链接使用 `download-known`;本地文件验收使用 `verify`。
    aria2 默认负责 HTTP(S)、Magnet 和 Torrent 的测速、下载与续传。qBittorrent 仅在
    需要搜索插件、队列界面、BT 深度管理或长期做种时启用。每次后端选择与切换都写入
    transport trace,不把客户端进度当作最终完成证据。
    
    ## 可选 qBittorrent 连接
    
    启用该适配器时,将 WebUI 限定在本机回环地址。已有兼容客户端时直接复用,密码
    保存在系统凭据中,再通过环境变量注入当前任务。
    
    ```bash
    export QBITTORRENT_URL="http://127.0.0.1:8080"
    export QBITTORRENT_USERNAME="admin"
    export QBITTORRENT_PASSWORD="从安全凭据读取"
    ```
    
    主链路依次运行:
    
    ```bash
    python3 scripts/rank_candidates.py --input candidates.json --output decision.json
    python3 scripts/storage_preflight.py --decision decision.json
    python3 scripts/aria2_acquire.py \
      --input INPUT --job-id JOB_ID --output-dir "$HOME/Downloads/Media" \
      --result aria2-acquisition.json --watch --no-proxy
    python3 scripts/verify_media.py --path "$HOME/Downloads/Media" --output verification.json
    ```
    
    若直接 URL 的路径没有媒体扩展名,给 aria2 增加
    `--output-name "TITLE (YEAR).mp4"`。可选 qBittorrent 搜索与获取脚本仍保留:
    
    ```bash
    python3 scripts/qbittorrent_search.py --query "TITLE YEAR" --output candidates.json
    python3 scripts/qbittorrent_acquire.py \
      --decision decision.json --wait-complete --result qbit-acquisition.json
    ```
    
    ## 质量门
    
    ```bash
    python3 scripts/validate_skill.py .
    python3 scripts/test_aria2_acquire.py
    python3 scripts/media_config.py show --json
    python3 scripts/rank_candidates.py \
      --input assets/example-candidates.json \
      --output /tmp/media-fetch-decision.json
    python3 scripts/storage_preflight.py \
      --decision /tmp/media-fetch-decision.json \
      --output-dir /tmp
    python3 scripts/aria2_acquire.py \
      --input 'https://example.invalid/movie.mp4' \
      --job-id validation-direct --output-dir /tmp \
      --result /tmp/media-fetch-aria2-direct.json --dry-run
    python3 scripts/aria2_acquire.py \
      --input 'magnet:?xt=urn:btih:0123456789abcdef0123456789abcdef01234567' \
      --job-id validation-bt --output-dir /tmp \
      --result /tmp/media-fetch-aria2-bt.json --dry-run
    ```
    
    ## 依赖
    
    - Python 3.9+
    - PyYAML(Skill 源码校验)
    - aria2 1.36+(默认 HTTP、Magnet 与 Torrent 下载后端)
    - FFmpeg / `ffprobe`(媒体验收)
    - 可选:Rats Search(独立 DHT 检索)
    - 可选:qBittorrent 5.x WebUI(搜索插件、队列管理、做种)
    
    ## 字幕分支
    
    默认验收 `zh-Hans` 与 `en`。如果成片只有英文字幕,先匹配同一发行版本的外置
    SRT,再交给 `lov-subtitle-freedom-skill` 做时间轴、UTF-8 和 SRT 保真处理。该
    Skill 的英文学习提示、人物卡和 ASS 样式均需要明确开启;Media Fetch 不会把它们
    作为简中字幕输出。
    
    ## 用户案例
    
    《指环王》三部曲的实际任务验证了后端解耦的价值:可选 qBittorrent 搜索并测速后,
    主候选在首轮实测偏慢,aria2 使用同一信息哈希、DHT/PeX/LSD 与 Tracker 续传,最终得到
    3 个可读的 1080p HEVC 文件。下载报告为 `complete`,媒体验收为
    `passed_with_warnings`,唯一开放项是原发行文件未嵌入 `zh-Hans`,因此报告继续
    保留字幕缺口而不是虚报“双语完成”。完整脱敏证据位于 `cases/evidence/`。
    
    ## License
    
    MIT
    
  • skill-card.md 4.2 KB
    Loading…
  • skill-card.yaml 6.2 KB
    Loading…
  • SKILL.md 11.6 KB
    ---
    name: lov-media-fetch
    description: >
      Use when the user asks to find and download a film, series, or long video. 以 aria2 为默认传输后端,完成多源测速、续传、容量预检、版本核验与字幕验收;也适用于“帮我下载这部电影”。
    license: MIT
    compatibility: >
      Portable Agent Skills format; Python 3.9+, aria2 1.36+, and ffprobe recommended.
      qBittorrent 5.x Web API is an optional discovery, BitTorrent-management, and seeding adapter.
    metadata:
      author: contributors
      version: "0.4.0"
      tags:
        - media-discovery
        - release-selection
        - download-orchestration
        - quality-control
        - aria2-primary
        - optional-qbittorrent
        - resumable-download
        - subtitle-handoff
      card_standard: "lovstudio/skill-card/v1"
      dependencies:
        - python
        - pyyaml
        - aria2
        - ffprobe
    ---
    
    # 影视寻宝 · Media Finder
    
    Turn one natural-language request into a verified local media file. Search broadly,
    identify the actual cut, balance picture quality against size, check storage before
    transfer, race viable sources, monitor the winner, recover from stalls, and inspect
    the completed file.
    
    ## Triggers
    
    ### Activate when
    
    - 用户说“帮我找并下载这部电影”“下载导演剪辑版,画质好一点但别太大”“找带中英字幕的完整版”。
    - 用户给出片名、年份、版本偏好,或已有 Magnet/Torrent,希望自动完成选择、下载和验收。
    - The user asks to find and download the best release, fetch an extended cut, or download a compact high-quality copy with Chinese and English subtitles.
    
    ### Do not activate when
    
    - 用户只想了解影片资料、比较不同剪辑或获得观看建议,不要求取得本地文件。
    - 用户只要下载普通网页文件、软件安装包、网页视频片段或直播流。
    - 用户明确要求发布、上传、转码压制或制作字幕;这些是下载完成后的独立任务。
    
    ## Product contract
    
    - One request should normally run end to end without repeated confirmation.
    - Prefer an edition whose identity is supported by runtime, release metadata, or
      file-level evidence. A filename alone is weak evidence.
    - “Best” means the highest useful viewing quality inside the user's size and disk
      budget, not the largest file or highest advertised resolution.
    - Default to embedded Simplified Chinese plus English subtitles. Treat filename
      claims as hints until streams or synchronized external subtitles are inspected.
    - Ask the user only when title identity is ambiguous, editions contain materially
      different content, or the top candidates are close enough that taste decides.
    - Never begin payload transfer before the destination capacity check passes.
    - Keep observing an active job. A task added to a client is not a completed result.
    - Completion means that the final local payload exists and the verification report is
      written. A client-reported 100% is only an intermediate signal.
    - Keep advertised seeders, observed peers, metadata readiness, received bytes, and
      sustained speed as separate evidence fields. A large seeder count is not a speed
      promise.
    - Use aria2 as the default transfer backend for direct URLs, Metalinks, Magnets, and
      Torrent inputs. Enable qBittorrent only when its search plugins, queue UI, swarm
      inspection, or long-term seeding materially helps the task. Record every backend
      choice and switch; do not create a second full payload by accident.
    - A missing `zh-Hans` stream is a recoverable subtitle gap, not a reason to mislabel
      the media. The subtitle branch may consult `lov-subtitle-freedom-skill` for
      timestamp-preserving UTF-8 SRT handling. Its English-learning gloss and ASS modes
      stay opt-in; plain Chinese subtitle delivery remains a separate, clearly named SRT.
    
    ## User configuration
    
    Resolve defaults through `$KIT_DIR/references/user-config.md`. On first use, show the
    resolved output directory and preferences before persisting them. Keep credentials in
    environment variables or the operating system credential store.
    
    ## Skill Kit modules
    
    Load the selected module completely before acting:
    
    - `$SKILL_DIR/skills/media-discovery/SKILL.md` — identify the title and collect normalized candidates from several independent discovery paths.
    - `$SKILL_DIR/skills/media-selection/SKILL.md` — verify editions and rank picture, codec, size, audio, subtitles, health, and evidence.
    - `$SKILL_DIR/skills/media-acquisition/SKILL.md` — capacity preflight, parallel swarm probing, winner selection, progress observation, stall recovery, and cleanup.
    - `$SKILL_DIR/skills/media-verification/SKILL.md` — inspect the downloaded files, edition runtime, streams, subtitle coverage, completeness, and final path.
    
    `kit.yaml` defines the available pipelines. Shared schemas and decision rules live in
    `$KIT_DIR/references/`.
    
    ## Workflow (MANDATORY)
    
    **You MUST follow these steps in order.**
    
    ### Step 0: Resolve runtime and select a pipeline
    
    1. Resolve `SKILL_DIR`, `KIT_DIR`, configuration, aria2 availability, and `ffprobe`.
       Detect qBittorrent as an optional capability; its absence must not block discovery,
       transfer, resume, verification, or reporting.
    2. On first use, bootstrap missing stable aria2 and ffprobe dependencies through the
       platform's native package manager. When qBittorrent is explicitly enabled, keep its
       WebUI on loopback and its credential in the operating system credential store. Do
       not put secrets in profile or reports.
    3. Preserve existing client tasks. Every task created by this Skill must receive a
       unique job tag and an isolated probe directory.
    4. Select `full` for a title request, `choose` for comparison only, `download-known`
       for supplied links, `resume` for an existing job, or `verify` for a local file.
    5. Read `$KIT_DIR/references/candidate-schema.md`, then validate all handoff JSON.
    
    ### Step 1: Resolve the requested work
    
    Capture title, year, media type, season/episode when relevant, edition preference,
    maximum size, destination override, audio/subtitle preference, and urgency. Infer
    omitted values from the portable profile. Do not ask the user to choose tooling.
    
    ### Step 2: Discover independent candidates
    
    Run the discovery module. Use at least two independent discovery paths when possible:
    direct web or catalog research, a local DHT index such as Rats Search, user-supplied
    links, or the optional qBittorrent search API. Deduplicate by info hash and canonical release identity. Preserve
    a `.torrent` URL or local Torrent path even when its info hash is not known until
    metadata resolution.
    
    For title and edition truth, prefer distributor, studio, disc, catalog, or reliable
    release metadata. Keep search-result claims separate from verified facts.
    
    ### Step 3: Rank releases and resolve genuine ambiguity
    
    Run the selection module and `scripts/rank_candidates.py`. Apply
    `$KIT_DIR/references/quality-policy.md`.
    
    - Auto-select when one candidate clearly leads and its edition is supported.
    - Show at most three concise choices when the output says `choice_required=true`.
    - Explain only the user-facing tradeoff: edition/content, picture, size, subtitles,
      and current health. Do not expose internal scoring mechanics unless asked.
    
    ### Step 4: Preflight destination capacity
    
    Resolve the destination, candidate size, probe concurrency, temporary probe budget,
    fallback resume allowance, and free-space reserve. Run `scripts/storage_preflight.py`
    before starting either backend.
    
    If capacity is short, report available, required, and shortfall immediately. Offer the
    best smaller candidate or a different destination, then wait for that user-facing
    decision. Never silently consume the reserve.
    
    ### Step 5: Probe, select, and download
    
    Run the acquisition module and `$KIT_DIR/references/acquisition-policy.md`.
    
    1. Probe up to the configured concurrency in isolated per-candidate directories. Use
       aria2 by default and allocate distinct listen/RPC ports for concurrent jobs.
    2. Observe warm speed, sustained speed, availability, peers, metadata readiness, and
       ETA; a short burst alone does not win.
    3. Pause non-winners, move the winner to the final destination, and continue polling.
    4. If the winner stalls beyond the configured threshold, pause it and first try the
       next proven candidate. Preserve the same aria2 job identity and `.aria2` state when
       restarting an input. Switch to qBittorrent only when it is enabled and measured
       evidence shows a healthier swarm or the user needs its queue/seeding behavior.
       Record the reason, backend, and observed rate for each switch.
    5. If all candidates are slow, return to discovery for another wave.
    6. Keep the terminal session alive and poll at intervals short enough to provide the
       user a progress update at least once per minute during active work.
    7. Clean only exact job-tagged losing tasks and their isolated probe files after the
       final candidate is complete. Leave pre-existing client tasks untouched.
    
    ### Step 6: Verify the completed media
    
    Run the verification module and `scripts/verify_media.py`.
    
    - Confirm a readable video stream, non-zero duration, expected resolution and codec,
      audio tracks, subtitle streams, and duration close to the selected edition.
    - Inspect every episode for episodic requests; a season folder is complete only when
      the requested episode set is present.
    - When preferred subtitles are missing, search for a subtitle from the exact release
      or a synchronized subtitle checked against duration and scene boundaries. For a
      Simplified Chinese SRT handoff, preserve cue timing, UTF-8, source immutability,
      and adjacent naming as described in `references/subtitle-handoff.md`; do not create
      an English-learning gloss or ASS file unless explicitly requested.
    - Recheck final free space and ensure no partial suffix remains on the primary file.
    
    ### Step 7: Report the result
    
    Lead with completion status and the exact local path. Include title/edition, video and
    audio summary, subtitle coverage, final size, advertised versus observed source
    health, transport trace, elapsed time, and any remaining evidence gap. Distinguish
    `download_status`, `verification_status`, and `subtitle_status`.
    
    ## References
    
    - `$KIT_DIR/references/candidate-schema.md` — normalized candidate and decision JSON.
    - `$KIT_DIR/references/quality-policy.md` — edition, picture, codec, size, language, and ambiguity rules.
    - `$KIT_DIR/references/acquisition-policy.md` — capacity, probing, monitoring, switching, and cleanup rules.
    - `$KIT_DIR/references/user-config.md` — portable defaults and secrets handling.
    - `$KIT_DIR/references/subtitle-handoff.md` — Simplified Chinese SRT matching and the
      opt-in handoff to `lov-subtitle-freedom-skill`.
    
    ## Dependencies
    
    - Python 3.9+ for deterministic helpers.
    - aria2 1.36+ for primary HTTP(S), Metalink, Magnet, and Torrent acquisition.
    - Optional qBittorrent 5.x with WebUI enabled for integrated search, BT management,
      queue visibility, or long-term seeding.
    - Search plugins or another discovery adapter for title search.
    - `ffprobe` from FFmpeg for final stream and duration inspection.
    - Optional Rats Search for independent DHT discovery.
    
    ## Runtime context (shared)
    
    运行前读取本 Skill 包的 `skill.yaml`,由宿主提供 `skill-runtime/v1` 上下文。字段解析顺序为:当前请求、项目上下文、个人 Preferences、品牌 Profile、通用默认值。
    
    - 只使用 Manifest 声明的字段;Profile 保存公开品牌事实,Preferences 保存个人工作偏好。
    - `required: true` 字段缺失时,按 Manifest 的问题配置向用户提出一个聚焦问题;用户明确同意后再保存回答。
    - 报错提供可复制的 `context_id`、字段路径与来源,诊断内容避开秘密、完整私人路径和原始配置。
    
  • skill.yaml 749 B
    Loading…

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.