Skip to content

Commit f9ae099

Browse files
committed
Fix formatting
What: Used `mix format` to update the formatting for media_resolver.ex Why: To fix formatting inconsistencies and make the linter happy.
1 parent 3466923 commit f9ae099

File tree

1 file changed

+36
-34
lines changed

1 file changed

+36
-34
lines changed

lib/ret/media_resolver.ex

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -337,42 +337,44 @@ defmodule Ret.MediaResolver do
337337
end
338338

339339
defp resolve_non_video(
340-
%MediaResolverQuery{url: %URI{host: "api.icosa.gallery", path: "/v1/assets/" <> asset_id} = uri},
340+
%MediaResolverQuery{
341+
url: %URI{host: "api.icosa.gallery", path: "/v1/assets/" <> asset_id} = uri
342+
},
341343
"icosa.gallery"
342-
) do
343-
# Increment stat for the request
344-
Statix.increment("ret.media_resolver.icosa.requests")
345-
346-
# Make the API call to get the asset data
347-
payload =
348-
"https://api.icosa.gallery/v1/assets/#{asset_id}"
349-
|> retry_get_until_success() # Assuming this function sends the request and handles retries
350-
|> Map.get(:body)
351-
|> Poison.decode!()
352-
353-
# Create the meta information based on the payload
354-
meta =
355-
%{
356-
expected_content_type: "model/gltf",
357-
name: payload["displayName"],
358-
author: payload["authorName"],
359-
license: payload["license"]
360-
}
361-
362-
# Extract the GLTF2 format URL from the payload
363-
uri =
364-
payload["formats"]
365-
|> Enum.find(&(&1["formatType"] == "GLTF2"))
366-
|> Kernel.get_in(["root", "url"])
367-
|> URI.parse()
368-
369-
# Increment stat for successful resolution
370-
Statix.increment("ret.media_resolver.icosa.ok")
371-
372-
# Return the URI and meta data for further processing
373-
{:commit, resolved(uri, meta)}
374-
end
344+
) do
345+
# Increment stat for the request
346+
Statix.increment("ret.media_resolver.icosa.requests")
347+
348+
# Make the API call to get the asset data
349+
payload =
350+
"https://api.icosa.gallery/v1/assets/#{asset_id}"
351+
# Assuming this function sends the request and handles retries
352+
|> retry_get_until_success()
353+
|> Map.get(:body)
354+
|> Poison.decode!()
355+
356+
# Create the meta information based on the payload
357+
meta =
358+
%{
359+
expected_content_type: "model/gltf",
360+
name: payload["displayName"],
361+
author: payload["authorName"],
362+
license: payload["license"]
363+
}
375364

365+
# Extract the GLTF2 format URL from the payload
366+
uri =
367+
payload["formats"]
368+
|> Enum.find(&(&1["formatType"] == "GLTF2"))
369+
|> Kernel.get_in(["root", "url"])
370+
|> URI.parse()
371+
372+
# Increment stat for successful resolution
373+
Statix.increment("ret.media_resolver.icosa.ok")
374+
375+
# Return the URI and meta data for further processing
376+
{:commit, resolved(uri, meta)}
377+
end
376378

377379
defp resolve_non_video(
378380
%MediaResolverQuery{url: %URI{path: "/models/" <> model_id}} = query,

0 commit comments

Comments
 (0)