mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Merge pull request #243 from Freika/fix/immich-import-validity-bug
Fix/immich import validity bug
This commit is contained in:
commit
cf9699a932
5 changed files with 15 additions and 13 deletions
|
|
@ -1 +1 @@
|
|||
0.13.5
|
||||
0.13.6
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ orbs:
|
|||
jobs:
|
||||
test:
|
||||
docker:
|
||||
- image: cimg/ruby:3.3
|
||||
- image: cimg/ruby:3.3.4
|
||||
environment:
|
||||
RAILS_ENV: test
|
||||
- image: cimg/postgres:13.3
|
||||
|
|
|
|||
|
|
@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [0.13.6] — 2024-09-13
|
||||
|
||||
### Fixed
|
||||
|
||||
- Flatten geodata retrieved from Immich before processing it to prevent errors
|
||||
|
||||
|
||||
## [0.13.5] — 2024-09-08
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -465,4 +465,4 @@ RUBY VERSION
|
|||
ruby 3.3.4p94
|
||||
|
||||
BUNDLED WITH
|
||||
2.5.9
|
||||
2.5.18
|
||||
|
|
|
|||
|
|
@ -44,15 +44,8 @@ class Immich::ImportGeodata
|
|||
end
|
||||
end
|
||||
|
||||
def valid?(asset)
|
||||
asset.dig('exifInfo', 'latitude') &&
|
||||
asset.dig('exifInfo', 'longitude') &&
|
||||
asset.dig('exifInfo', 'dateTimeOriginal')
|
||||
end
|
||||
|
||||
def parse_immich_data(immich_data)
|
||||
geodata = immich_data.map do |asset|
|
||||
log_no_data and next if asset_invalid?(asset)
|
||||
geodata = immich_data.flatten.map do |asset|
|
||||
next unless valid?(asset)
|
||||
|
||||
extract_geodata(asset)
|
||||
|
|
@ -61,8 +54,10 @@ class Immich::ImportGeodata
|
|||
geodata.compact.sort_by { |data| data[:timestamp] }
|
||||
end
|
||||
|
||||
def asset_invalid?(bucket)
|
||||
bucket.is_a?(Hash) && bucket['statusCode'] == 404
|
||||
def valid?(asset)
|
||||
asset.dig('exifInfo', 'latitude') &&
|
||||
asset.dig('exifInfo', 'longitude') &&
|
||||
asset.dig('exifInfo', 'dateTimeOriginal')
|
||||
end
|
||||
|
||||
def extract_geodata(asset)
|
||||
|
|
|
|||
Loading…
Reference in a new issue