mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Move url to the initializer
This commit is contained in:
parent
11762d528b
commit
8891313b5a
1 changed files with 2 additions and 3 deletions
|
|
@ -5,7 +5,7 @@ class Immich::ImportGeodata
|
||||||
|
|
||||||
def initialize(user)
|
def initialize(user)
|
||||||
@user = user
|
@user = user
|
||||||
@immich_api_base_url = "#{user.settings['immich_url']}/api"
|
@immich_api_base_url = "#{user.settings['immich_url']}/api/search/metadata"
|
||||||
@immich_api_key = user.settings['immich_api_key']
|
@immich_api_key = user.settings['immich_api_key']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -40,7 +40,6 @@ class Immich::ImportGeodata
|
||||||
end
|
end
|
||||||
|
|
||||||
def retrieve_immich_data
|
def retrieve_immich_data
|
||||||
url = "#{immich_api_base_url}/search/metadata"
|
|
||||||
page = 1
|
page = 1
|
||||||
data = []
|
data = []
|
||||||
max_pages = 1000 # Prevent infinite loop
|
max_pages = 1000 # Prevent infinite loop
|
||||||
|
|
@ -48,7 +47,7 @@ class Immich::ImportGeodata
|
||||||
while page <= max_pages
|
while page <= max_pages
|
||||||
Rails.logger.debug "Retrieving next page: #{page}"
|
Rails.logger.debug "Retrieving next page: #{page}"
|
||||||
body = request_body(page)
|
body = request_body(page)
|
||||||
response = JSON.parse(HTTParty.post(url, headers: headers, body: body).body)
|
response = JSON.parse(HTTParty.post(immich_api_base_url, headers: headers, body: body).body)
|
||||||
|
|
||||||
items = response.dig('assets', 'items')
|
items = response.dig('assets', 'items')
|
||||||
Rails.logger.debug "#{items.size} items found"
|
Rails.logger.debug "#{items.size} items found"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue