97adfbda45
Rename workflow files and their 'name' field with a 'media.' domain prefix to anticipate future multi-domain expansion (mail.*, calendar.*, ...). - organize_media -> media.organize_media - manage_subtitles -> media.manage_subtitles WorkflowLoader picks them up unchanged (uses data['name']).
70 lines
2.3 KiB
YAML
70 lines
2.3 KiB
YAML
name: media.manage_subtitles
|
|
description: >
|
|
Place subtitle files alongside a video that has just been organised into the library.
|
|
Detects the release pattern automatically, identifies and classifies all tracks,
|
|
filters by user rules, and hard-links matching files to the destination.
|
|
If any tracks are unrecognised, asks the user and optionally teaches Alfred.
|
|
|
|
trigger:
|
|
examples:
|
|
- "handle subtitles for The X-Files S01E01"
|
|
- "place the subs next to the file"
|
|
- "subtitles are in the Subs/ folder"
|
|
- "add subtitles"
|
|
|
|
tools:
|
|
- manage_subtitles
|
|
- learn
|
|
|
|
memory:
|
|
SubtitlePreferences: read
|
|
Workflow: read-write
|
|
|
|
steps:
|
|
- id: place_subtitles
|
|
tool: manage_subtitles
|
|
description: >
|
|
Detect release pattern, identify and classify all subtitle tracks,
|
|
filter by rules, hard-link matching files next to the destination video.
|
|
Reads SubtitlePreferences from LTM for language/type/format filtering.
|
|
params:
|
|
source_video: "{source_video}"
|
|
destination_video: "{destination_video}"
|
|
imdb_id: "{imdb_id}"
|
|
media_type: "{media_type}"
|
|
release_group: "{release_group}"
|
|
season: "{season}"
|
|
episode: "{episode}"
|
|
on_result:
|
|
ok_placed_zero: skip # no subtitles found — not an error
|
|
needs_clarification: ask_user # unrecognised tokens found
|
|
|
|
- id: ask_user
|
|
description: >
|
|
Some tracks could not be classified. Show the user the unresolved tokens
|
|
and ask if they want to teach Alfred what they mean.
|
|
If yes → go to learn_tokens. If no → end workflow.
|
|
ask_user:
|
|
question: >
|
|
I could not identify some tokens in the subtitle files: {unresolved}.
|
|
Do you want to teach me what they mean?
|
|
answers:
|
|
yes: { next_step: learn_tokens }
|
|
no: { next_step: end }
|
|
|
|
- id: learn_tokens
|
|
tool: learn
|
|
description: >
|
|
Persist a new token mapping to the learned knowledge pack so Alfred
|
|
recognises it in future scans without asking again.
|
|
params:
|
|
pack: "subtitles"
|
|
category: "{token_category}" # "languages" or "types"
|
|
key: "{token_key}" # e.g. "es", "de"
|
|
values: "{token_values}" # e.g. ["spanish", "espanol"]
|
|
|
|
subtitle_naming:
|
|
standard: "{lang}.{ext}"
|
|
sdh: "{lang}.sdh.{ext}"
|
|
forced: "{lang}.forced.{ext}"
|