-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add album start and end dates for storage template #17188
base: main
Are you sure you want to change the base?
Conversation
This adds all the possible date templates (y, m, d, etc) for album createdAt, updatedAt, startDate, and endDate (last two are calculated off automatically from album contents to the storage template. For example the template could look like this: {{#if album}}{{album-startDate-y}}/{{album-startDate-MM}} - {{album}}{{else}}{{y}}/{{MM}}/{{/if}}/{{filename}}
Do you really think the createdAt and updatedAt fields are worth including here? I can't really imagine a use-case for them. |
I can't imagine using updatedAt, but createdAt could be useful - creating an album of photos with no proper timestamps (e.g. scans of old photos), or a compilation of photos - it might be useful to reference the date it was created. |
That still seems pretty niche. I think we can omit both for now. It's easy to add them if there's any demand, not so easy to remove them after they're added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Can you add tests for this?
Can add some tests, yes. Will try to find where to add docs too. |
Sounds great your changes, thank you so much! |
@mertalev , @alextran1502 - tests and documentation updated. |
I'm just wondering in general, how is this supposed to work. You add assets to an album then manually go and re-run the storage migration? These dates are highly variable so the storage template could become out of sync with a single new asset being added to an album, requiring all of the assets to be moved to a different directory, which won't happen automatically currently. |
Yes, that's generally how it would work. I'd recommend to use the start date which won't change so long as only new assets are added to an album. In my case I have hundreds of old albums to import, so this process really only has to happen once, and will remain in place after import. |
This adds all the possible date templates (y, m, d, etc) for album createdAt, updatedAt, startDate, and endDate (last two are calculated automatically from album contents) to the Storage Template.
For example the template could look like this:
{{#if album}}{{album-startDate-y}}/{{album-startDate-MM}} - {{album}}{{else}}{{y}}/{{MM}}/{{/if}}/{{filename}}
Description
This change adds 4 dates, and all possible date templates to the Storage template so that it's possible to store albums in a single folder that includes date components.
Without this patch the Storage Template can only use date fields from each asset individually, which puts them in different folders even if they are in the same album (if the album spans more than one day).
Fixes the following feature requests:
#16721
#16843
Fixes # (issue)
How Has This Been Tested?
Checklist:
src/services/
uses repositories implementations for database calls, filesystem operations, etc.src/repositories/
is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/
)