alvistar / immich-albums

Create immich albums from folder structure
MIT License
38 stars 7 forks source link

Outdated API...? #5

Closed BenLand100 closed 4 months ago

BenLand100 commented 6 months ago

I was hoping this still worked, being less than a month old, but it looks as if Immich has already killed it... or perhaps I'm not using the path argument correctly... Any advice appreciated...

(immich-albums-py3.11) benland100@blandtoo ~/immich-albums $ im --api-key [REDACTED] --api-host [REDACTED] --original-path /mnt/raid/media/pictures --replace-path /usr/src/app/external /mnt/raid/media/pictures
/2023-10-02\ Kentuck\ Knob/
Processing folder: /mnt/raid/media/pictures/2023-10-02 Kentuck Knob

Album 2023-10-02 Kentuck Knob does not exist
searching for: /usr/src/app/external/2023-10-02 Kentuck Knob/DSC03455.JPG
Traceback (most recent call last):
  File "pydantic/main.py", line 522, in pydantic.main.BaseModel.parse_obj
ValueError: dictionary update sequence element #0 has length 1; 2 is required

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/bin/im", line 6, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/immich-albums/src/immich_albums/im.py", line 192, in cli
    immich_albums.create_albums_from_folder(
  File "/home/benland100/immich-albums/src/immich_albums/im.py", line 158, in create_albums_from_folder
    self.create_album_from_folder(path, original_path, replace_path, dry_run, skip_existing=skip_existing)
  File "/home/benland100/immich-albums/src/immich_albums/im.py", line 115, in create_album_from_folder
    assets_ids = self.get_assets_in_folder(path, original_path, replace_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/immich-albums/src/immich_albums/im.py", line 92, in get_assets_in_folder
    asset_id = self.get_asset_by_original_path(replaced_path)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/immich-albums/src/immich_albums/im.py", line 44, in get_asset_by_original_path
    assets = api_instance.search_assets(original_path=original_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pydantic/decorator.py", line 40, in pydantic.decorator.validate_arguments.validate.wrapper_function
  File "pydantic/decorator.py", line 134, in pydantic.decorator.ValidatedFunction.call
  File "pydantic/decorator.py", line 206, in pydantic.decorator.ValidatedFunction.execute
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/openapi_client/api/asset_api.py", line 3658, in search_assets
    return self.search_assets_with_http_info(id, library_id, type, order, device_asset_id, device_id, checksum, is_archived, is_encoded, is_external, is_favorite, is_motion, is_offline, is_read_only, is_visible, with_deleted, with_stacked, with_exif, wit
h_people, created_before, created_after, updated_before, updated_after, trashed_before, trashed_after, taken_before, taken_after, original_file_name, original_path, resize_path, webp_path, encoded_video_path, city, state, country, make, model, lens_model
, page, size, **kwargs)  # noqa: E501
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^
  File "pydantic/decorator.py", line 40, in pydantic.decorator.validate_arguments.validate.wrapper_function
  File "pydantic/decorator.py", line 134, in pydantic.decorator.ValidatedFunction.call
  File "pydantic/decorator.py", line 206, in pydantic.decorator.ValidatedFunction.execute
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/openapi_client/api/asset_api.py", line 4010, in search_assets_with_http_info
    return self.api_client.call_api(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/openapi_client/api_client.py", line 409, in call_api
    return self.__call_api(resource_path, method,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/openapi_client/api_client.py", line 247, in __call_api
    return_data = self.deserialize(response_data, response_type)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/openapi_client/api_client.py", line 319, in deserialize
    return self.__deserialize(data, response_type)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/openapi_client/api_client.py", line 335, in __deserialize
    return [self.__deserialize(sub_data, sub_kls)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/openapi_client/api_client.py", line 335, in <listcomp>
    return [self.__deserialize(sub_data, sub_kls)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/openapi_client/api_client.py", line 358, in __deserialize
    return self.__deserialize_model(data, klass)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/openapi_client/api_client.py", line 758, in __deserialize_model
    return klass.from_dict(data)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/benland100/.cache/pypoetry/virtualenvs/immich-albums-4Dqx2L68-py3.11/lib/python3.11/site-packages/openapi_client/models/asset_response_dto.py", line 151, in from_dict
    return AssetResponseDto.parse_obj(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pydantic/main.py", line 525, in pydantic.main.BaseModel.parse_obj
pydantic.error_wrappers.ValidationError: 1 validation error for AssetResponseDto
__root__
  AssetResponseDto expected dict not str (type=type_error)
BenLand100 commented 6 months ago

Flying by the seat of my pants, I attempted to update immich-openapi-specs.json to the version of my server (1.91.3). Installing the openapi generating framework was a trick. Successfully ran generated/openapi_client/update.sh with the new version string. poetry update in the top level directory. Then, unfortunately, failed with another API-related issue.

alvistar commented 6 months ago

Hi, thanks for reporting. What's the error you got now?

blasterspike commented 5 months ago

I'm having the exact same error as the first comment but I don't know how to update the openapi-specs.

alvistar commented 4 months ago

Api has been updated.