Migrate from embedded covers to assets

This commit is contained in:
Claudio Ortolina
2025-09-01 16:10:50 +03:00
parent cbf567a502
commit dc77d337c0
19 changed files with 80 additions and 144 deletions
@@ -31,10 +31,8 @@ defmodule MusicLibraryWeb.CollectionControllerTest do
"id" => record.id,
"artists" => ["Steven Wilson"],
"title" => record.title,
"cover_url" =>
"http://localhost:4002/api/covers/#{record.id}?vsn=#{record.cover_hash}",
"thumb_url" =>
"http://localhost:4002/api/covers/#{record.id}?vsn=#{record.cover_hash}&size=480"
"cover_url" => "http://localhost:4002/api/covers/#{record.cover_hash}",
"thumb_url" => "http://localhost:4002/api/covers/#{record.cover_hash}?size=480"
}
end
end
@@ -59,10 +57,8 @@ defmodule MusicLibraryWeb.CollectionControllerTest do
"id" => record.id,
"artists" => ["Steven Wilson"],
"title" => record.title,
"cover_url" =>
"http://localhost:4002/api/covers/#{record.id}?vsn=#{record.cover_hash}",
"thumb_url" =>
"http://localhost:4002/api/covers/#{record.id}?vsn=#{record.cover_hash}&size=480"
"cover_url" => "http://localhost:4002/api/covers/#{record.cover_hash}",
"thumb_url" => "http://localhost:4002/api/covers/#{record.cover_hash}?size=480"
}
end
end
@@ -91,10 +87,8 @@ defmodule MusicLibraryWeb.CollectionControllerTest do
"id" => record.id,
"artists" => ["Steven Wilson"],
"title" => record.title,
"cover_url" =>
"http://localhost:4002/api/covers/#{record.id}?vsn=#{record.cover_hash}",
"thumb_url" =>
"http://localhost:4002/api/covers/#{record.id}?vsn=#{record.cover_hash}&size=480"
"cover_url" => "http://localhost:4002/api/covers/#{record.cover_hash}",
"thumb_url" => "http://localhost:4002/api/covers/#{record.cover_hash}?size=480"
}
]
}
@@ -4,7 +4,6 @@ defmodule MusicLibraryWeb.CoverControllerTest do
import MusicLibrary.Fixtures.Records
alias MusicLibrary.Assets
alias MusicLibrary.Records.Cover
defp create_asset(_config) do
{:ok, asset} = Assets.store(%{content: marbles_cover_data(), format: "image/jpeg"})
@@ -65,7 +64,7 @@ defmodule MusicLibraryWeb.CoverControllerTest do
conn = get(conn, ~p"/covers/#{asset.hash}?size=480")
thumb = marbles_thumb_data()
hash = Cover.hash(thumb)
hash = Assets.Asset.hash(thumb)
assert conn.status == 200
assert get_resp_header(conn, "content-type") == ["image/jpeg; charset=utf-8"]