0fb59a4581
The four resolve_*_destination use cases now route through a private
_resolve_parsed helper that picks the right entry point:
- source path provided AND it exists -> inspect_release(name, path)
runs the full pipeline (parse + media-type refinement + probe
+ enrich), so missing tech tokens (quality, codec, ...) get
filled by ffprobe and the refreshed tech_string lands in the
destination folder / file names.
- source path missing or absent -> parse_release(name) only,
same behavior as before. Back-compat: tests using fake /dl/*.mkv
paths still pass unchanged.
resolve_episode_destination / resolve_movie_destination reuse their
existing source_file parameter as the inspection target. The two
folder-move use cases (season / series) gain a new OPTIONAL
source_path parameter — threaded through the agent tool wrappers
and documented in the YAML specs.
The lazy import inside _resolve_parsed avoids a circular import:
inspect_release imports detect_media_type / enrich_from_probe from
the same application.filesystem package whose __init__ re-exports
resolve_destination.
Three new tests in TestProbeEnrichmentWiring with a stub MediaProber
prove the wiring: movie picks up probe quality, season picks it up
via source_path, and a missing path correctly skips probe (back-compat
guard).
96 lines
3.8 KiB
YAML
96 lines
3.8 KiB
YAML
name: resolve_season_destination
|
|
|
|
summary: >
|
|
Compute destination paths for a season pack (folder move) in the TV library.
|
|
|
|
description: |
|
|
Resolves the target series folder and season subfolder for a complete-season
|
|
download. Returns the paths only — does not perform any move. If a series
|
|
folder for this show already exists in the library with a different name
|
|
(different group/quality/source), returns needs_clarification so the user
|
|
can decide whether to merge into the existing folder or create a new one.
|
|
|
|
when_to_use: |
|
|
Use after analyze_release has identified the release as a season pack
|
|
(media_type=tv_show, season set, episode unset). TMDB must already be
|
|
queried so tmdb_title and tmdb_year are canonical values, not raw tokens
|
|
from the release name.
|
|
|
|
when_not_to_use: |
|
|
- Single-episode files: use resolve_episode_destination instead.
|
|
- Multi-season packs (S01-S05 etc.): use resolve_series_destination.
|
|
- Movies: use resolve_movie_destination.
|
|
|
|
next_steps: |
|
|
- On status=ok: call move_to_destination with source=<download folder> and
|
|
destination=season_folder.
|
|
- On status=needs_clarification: present the question and options to the
|
|
user, then re-call this tool with confirmed_folder set to the user's pick.
|
|
- On status=error: surface the message to the user; do not move anything.
|
|
|
|
parameters:
|
|
release_name:
|
|
description: Raw release folder name as it appears on disk.
|
|
why_needed: |
|
|
Drives extraction of quality/source/codec/group tokens — these are
|
|
embedded in the target folder name (Title.Year.Quality.Source.Codec-GROUP)
|
|
to make releases self-describing on the filesystem.
|
|
example: Oz.S03.1080p.WEBRip.x265-KONTRAST
|
|
|
|
tmdb_title:
|
|
description: Canonical show title from TMDB.
|
|
why_needed: |
|
|
Builds the title prefix of the folder name. Must come from TMDB to
|
|
avoid typos and variant spellings present in the raw release name.
|
|
example: Oz
|
|
|
|
tmdb_year:
|
|
description: Show start year from TMDB.
|
|
why_needed: |
|
|
Disambiguates shows that share a title across decades (e.g. multiple
|
|
remakes of "The Office") and locks the folder identity.
|
|
example: "1997"
|
|
|
|
confirmed_folder:
|
|
description: |
|
|
Folder name chosen by the user after a previous needs_clarification
|
|
response.
|
|
why_needed: |
|
|
Short-circuits the existing-folder detection and forces the use case
|
|
to use this exact folder name, even if it doesn't match the computed
|
|
one.
|
|
example: Oz.1997.1080p.WEBRip.x265-KONTRAST
|
|
|
|
source_path:
|
|
description: |
|
|
Absolute path to the release folder on disk. Optional.
|
|
why_needed: |
|
|
When provided, the tool runs ffprobe on the main video inside the
|
|
folder and uses the probe data to fill quality/codec tokens that
|
|
may be missing from the release name. The enriched tech tokens
|
|
end up in the destination folder name, so providing source_path
|
|
gives more accurate names for releases with sparse metadata.
|
|
example: /downloads/Oz.S03.1080p.WEBRip.x265-KONTRAST
|
|
|
|
returns:
|
|
ok:
|
|
description: Paths resolved unambiguously; ready to move.
|
|
fields:
|
|
series_folder: Absolute path to the series root folder.
|
|
season_folder: Absolute path to the season subfolder (move target).
|
|
series_folder_name: Just the series folder name, for display.
|
|
season_folder_name: Just the season folder name, for display.
|
|
is_new_series_folder: True if the series folder doesn't exist yet.
|
|
|
|
needs_clarification:
|
|
description: A folder already exists with a different name; ask the user.
|
|
fields:
|
|
question: Human-readable question for the user.
|
|
options: List of folder names the user can pick from.
|
|
|
|
error:
|
|
description: Resolution failed (config missing, invalid release name, etc.).
|
|
fields:
|
|
error: Short error code (e.g. library_not_set).
|
|
message: Human-readable explanation.
|