Skip to content
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

Add a query option to sort the query results before displaying/adding to album #1787

Open
RhetTbull opened this issue Jan 24, 2025 · 1 comment
Labels
cli Pertains to the command line interface feature request New feature or request

Comments

@RhetTbull
Copy link
Owner

Adding a sort key (or allowing multiple sort keys) would allow osxphotos to easily do what this app does.

--sort-key "photo.size" --sort-key "photo.score_info.overall"

How to sort by album sort order?

@RhetTbull
Copy link
Owner Author

If user queries a specific album name, photos should be sortable to match the sort order of the album. Currently the only way to get sort order is to get the list of photos in an album (AlbumInfo.photos) and find where in the list the UUID for the given photo is.

PhotoInfo._dbalbums_album contains the desired info:
key is album UUID, value is list of tuples of (photo UUID, sort order) contained in that album
e.g. {'0C514A98-7B77-4E4F-801B-364B7B65EAFA': [('1EB2B765-0765-43BA-A90C-0D0580E6172C', 1024)]}

The sort order is a number but only meaningful in a relative sense, it does not indicate absolute placement in the album.

Timewarp feature #1784 will need this too in order to increment time in the correct order. For photos selected in Timewarp, photos should be sorted first by album name then by sort order within the album.

Could solve this by adding a new property, PhotoInfo.album_sort which returns a list of of tuples of album name (full path) and sort order and these could be used as keys in the sort.

e.g.

[('AlbumA', 1), ('Folder1/AlbumB', 4)]

Then have --sort-key be smart enough to accept a tuple of keys for sorting:

--sort-key "photo.album_sort"

@RhetTbull RhetTbull added feature request New feature or request cli Pertains to the command line interface labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Pertains to the command line interface feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant