Add optional filename_template support and filename migration CLI#826
Open
Add optional filename_template support and filename migration CLI#826
Conversation
There was a problem hiding this comment.
Pull request overview
Adds optional, token-based filename templating for downloaded media and RSS enclosure paths, plus a CLI mode to migrate already-downloaded files from legacy ID-based names to the configured template.
Changes:
- Introduces
filename_templatein feed config and validates allowed tokens during config loading. - Updates naming logic (download output + RSS enclosure URLs) to use the templated, sanitized episode filename.
- Adds
--migrate-filenames/--migrate-filenames-dry-runflow and a new migration service with tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| services/migrate/migrate.go | Adds filename migration service to rename legacy files to templated names. |
| services/migrate/migrate_test.go | Tests migration behavior (rename + dry-run). |
| pkg/ytdl/ytdl.go | Uses new episode base/name helpers for youtube-dl output naming. |
| pkg/feed/xml.go | Implements templated filename rendering/sanitization and token validation; refactors extension handling. |
| pkg/feed/xml_test.go | Adds tests for enclosure URL formatting and template validation/name generation. |
| pkg/feed/config.go | Adds FilenameTemplate to feed config struct. |
| config.toml.example | Documents filename_template usage and example output. |
| cmd/podsync/main.go | Adds migration CLI flags and executes migration mode before downloader/updater. |
| cmd/podsync/config.go | Validates filename_template during config validation. |
| cmd/podsync/config_test.go | Extends config parsing tests and adds validation failure test for bad tokens. |
| README.md | Documents the fork feature set and the migration CLI usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds optional filename templating for downloaded media (and enclosure paths) while preserving existing behavior by default.
What’s included
filename_template{{id}},{{title}},{{pub_date}},{{feed_id}}--migrate-filenames--migrate-filenames-dry-runconfig.toml.example, README)Backward compatibility
filename_templateis unset/empty, behavior remains legacy (ID-based naming).Why
Many users want readable/stable filenames that include publish date/title while retaining deterministic IDs.
Example
Use this in
config.toml:Migration
For existing downloaded media, users can migrate once:
Preview only: