-
Notifications
You must be signed in to change notification settings - Fork 171
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
Implement album sorting #192
Conversation
This adds an 'albums_sort_attr' configuration modeled off of the 'medias_sort_attr'. It defaults to the existing behavior of sorting sub-albums by directory name. It allows sort by any metadata attribute stored in the album metadata file. The existing album sort test wasn't really verifying album sorting behavior, so I just re-wrote the whole thing to include tests for the old behavior and new. This should resolve issue saimn#121
Looks good, thanks @trapperhoney ! |
Woops, sorry I missed the tmp file :\ I'd rather not include my name in the distributed source. Is the github trail not good enough? |
It can be your github pseudonym if you prefer, no problem with this. |
Thanks ! |
Thank you! |
How is this supposed to work? I tried adding an 'Order' field to index.md of each of my subdirectories and setting that as album_sort_attr. However, I just get an AttributeError when trying to build the gallery. I ended up adding this to _get_metadata() of the Album class, but that's obviously not a workable solution to have to do that for all the interesting fields:
|
@tohojo - Indeed, you're right, it works only with attributes of the Album objects ... Copying all the |
Ah, good, so it wasn't just me who was missing something! :) Yeah, having a way to specify meta fields would be good (thought that was what it was meant for). Maybe just falling back to looking in the metadata object if the attribute is not found on the Album object itself? That would avoid introducing new syntax... Not sure if there are field names that would clash in surprising ways, though? |
Yep, that's another possibility. Maybe both could be allowed to resolve potential conflicts. |
Ah yes, that's a possibility. Can take a shot at a patch tomorrow. Any preferences on the syntax? Was thinking using 'meta.fieldname' could work?
|
For what it's worth, the same (lack of metadata support) semantics apply to the sorting behavior of individual items and the items_sort_attr configuration option. |
@tohojo - Great ! No string preference, |
Created #202 :) |
Implement album sorting
This adds an 'albums_sort_attr' configuration modeled off of the
'medias_sort_attr'. It defaults to the existing behavior of sorting
sub-albums by directory name. It allows sort by any metadata attribute
stored in the album metadata file.
The existing album sort test wasn't really verifying album sorting
behavior, so I just re-wrote the whole thing to include tests for the
old behavior and new.
This should resolve issue #121