Recipes & How-tos¶
These walkthroughs illustrate how to adapt Playbook to new sports, tune regexes, and validate results quickly. Use them as repeatable playbooks for common tasks.
Quick Reference¶
| Scenario | Recipe |
|---|---|
| Onboard a new sport | Extending to New Sports |
| Tweak per-league notifications | Customizing Notifications per Sport |
| Build downloader filters | Autobrr Filter Walkthrough |
| Vet pattern changes safely | Testing Pattern Changes Quickly |
| Validate metadata-driven workflows | Figure Skating Grand Prix Example |
Extending to New Sports¶
- Copy
config/playbook.sample.yamland enable the sport by listing the relevantpattern_sets(e.g.,formula1,motogp). - Update
metadata.url/show_key,source_globs, andsource_extensionsfor your release group. - If no template exists yet, copy the closest set from
src/playbook/pattern_templates.yamlinto your config and adjust the regex/aliases. - Run
python -m playbook.cli --config playbook.yaml --dry-run --verboseand review both console output andplaybook.logfor skipped/ignored diagnostics. - Iterate on patterns, aliases, and destination templates until every file links where you expect. Consider upstreaming new templates via a PR once battle-tested.
Checklist¶
- [ ] Metadata URL reachable from the container/host.
- [ ]
pattern_setsentries spelled exactly as defined insrc/playbook/pattern_templates.yaml. - [ ] Regex capture groups line up with
season_selectorandepisode_selector. - [ ] Notifications configured for the new
sport_id. - [ ]
tests/data/pattern_samples.yamlupdated with at least one real release name.
Sample Figure Skating Grand Prix Workflow¶
Pair the figure_skating_grand_prix pattern set with the Figure Skating Grand Prix 2025 metadata feed to normalize releases such as:
Figure Skating Grand Prix France 2025 Pairs Short Program 17 10 720pEN50fps ESFigure Skating Grand Prix France 2025 Ice Dancing Rhythm Dance 18 10 720pEN50fps ESFigure Skating Grand Prix China 2025 Exhibition Gala 26 10 720pEN50fps ESFigure Skating Grand Prix Final 2025 Women Free Program 06 12 1080pEN50fps.mkv
Tips:
- When releases omit round numbers, use
season_selector.mode: titleplussession_aliasesto mapRhythm Dance/Free Programonto canonical metadata. - Add
destination.filename_templateoverrides if you need federation-specific folder structures ({season_round:02} {season_title}works well for multi-stop tours). - Keep
allow_unmatched: trueduring onboarding to reduce noise while you iterate on regexes.
Customizing Notifications per Sport¶
Use notifications.mentions to ping only the subscribers who care about a specific league:
notifications:
mentions:
formula1: "<@&222333444555666777>"
premier_league: "<@&123456789012345678>"
default: "@here"
Recipes:
- Override mentions per target to opt certain Discord webhooks into extra pings.
- Mix
autoscantargets with Discord webhooks so watchers get immediate scans plus human-friendly summaries. - Gate daily batch posts through
notifications.batch_daily+notifications.flush_time(e.g., setflush_time: "06:00"so overnight events roll into the previous “day”).
Autobrr Filter Walkthrough¶
Autobrr filters keep Playbook’s SOURCE_DIR populated with trusted releases. Start from this template:
--8<-- "snippets/autobrr-filter.md"
How to adapt it:
- Update
match_releaseswith sport/year/resolution-specific regexes. - Use
required_words/excluded_wordsfor release-group whitelisting. - Set
actionsto push directly into qBittorrent/Deluge with the correct category, or trigger custom scripts/webhooks. - Run Autobrr’s regex tester before enabling the filter, then monitor the “History” tab to confirm matches.
Pair each Autobrr category with a dedicated Playbook sport (or variant) so source_globs stay simple.
Testing Pattern Changes Quickly¶
- Edit
tests/data/pattern_samples.yamlwith real release names and runpytest tests/test_pattern_samples.py. - Combine
--dry-runwithVERBOSE=trueto see every capture group and template rendered in the console. - Use
--clear-processed-cachewhen you need to reprocess the same files repeatedly during regex tuning. - Add
--trace-matchesto dump match JSON artifacts intocache_dir/traces, then inspect them with your favorite JSON viewer.
Validation Runbook¶
python -m playbook.cli validate-config --config playbook.yaml --diff-sample --show-trace.python -m playbook.cli --config playbook.yaml --dry-run --verbose --trace-matches.- Inspect
playbook.logfor warnings, unmatched files, or Kometa/Autoscan issues. - Tail notifications (Discord/Slack) to ensure new sports trigger the right channels.
- Promote changes to a staging environment (or run the Docker image with bind mounts) before rolling to production.
Have a favorite workflow that should live here? Open an issue or PR and drop it under docs/recipes.md.