Salvoxia / immich-folder-album-creator

Automatically create and populate albums in Immich from a folder structure in external libraries
https://hub.docker.com/r/salvoxia/immich-folder-album-creator
159 stars 9 forks source link

Change order to 'asc' in createAlbum #36

Closed ferbar closed 4 weeks ago

ferbar commented 4 weeks ago

Hi, thanks a lot for your work!

I want to suggest to create albums optionaly with order: 'asc'

at the moment it seems that this can only be achived by https://immich.app/docs/api/update-album-info

# Creates an album with the provided name and returns the ID of the
# created album
def createAlbum(albumName):
    apiEndpoint = 'albums'
    if version['major'] == 1 and version['minor'] <= 105:
        apiEndpoint = 'album'
    data = {
        'albumName': albumName,
        'description': albumName,
    }
    r = requests.post(root_url+apiEndpoint, json=data, **requests_kwargs)
    assert r.status_code in [200, 201]

    albumId = r.json()['id']

    if SOMEOPTION and version['major'] >= 1 and version['minor'] >= 99:
        data = {
            'order': 'asc',
        }
        r = requests.patch(root_url+apiEndpoint+f'/{albumId}', json=data, **requests_kwargs)
        assert r.status_code in [200, 201]
    return albumId
Salvoxia commented 4 weeks ago

Hm, I wasn't aware of that parameter. Your use case is to have all albums created displaying oldest images first as opposed to the default?

ferbar commented 4 weeks ago

exactly!

What I want is the slide show in the right order. this works with order: 'asc'

btw: Google photos displays the oldest images first in albums, too. just checked that

thanks!

Salvoxia commented 4 weeks ago

Thanks for clarifying! Would you be interested in creating a PR request against the dev branch for that? You would be listed as a contributor then. (If so: Switches for different API versions have been removed in dev and 1.106.0 is the new minimum version required). Otherwise I'll add it.

ferbar commented 4 weeks ago

created the PR, I hope this is fine

https://github.com/Salvoxia/immich-folder-album-creator/pull/37

Salvoxia commented 4 weeks ago

Released in 0.9.0.