Remove unused artist functionality
This commit is contained in:
@@ -151,19 +151,6 @@ defmodule MusicLibrary.Artists do
|
|||||||
|> BackgroundRepo.insert()
|
|> BackgroundRepo.insert()
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_image(artist_id) do
|
|
||||||
q =
|
|
||||||
from ai in ArtistInfo,
|
|
||||||
where: ai.id == ^artist_id and not is_nil(ai.image_data),
|
|
||||||
select: %{
|
|
||||||
image_data: ai.image_data,
|
|
||||||
image_data_width: ai.image_data_width,
|
|
||||||
image_data_hash: ai.image_data_hash
|
|
||||||
}
|
|
||||||
|
|
||||||
Repo.one(q)
|
|
||||||
end
|
|
||||||
|
|
||||||
def change_artist_info(artist_info, attrs \\ %{}) do
|
def change_artist_info(artist_info, attrs \\ %{}) do
|
||||||
ArtistInfo.changeset(artist_info, attrs)
|
ArtistInfo.changeset(artist_info, attrs)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
defmodule MusicLibraryWeb.ArtistController do
|
|
||||||
use MusicLibraryWeb, :controller
|
|
||||||
|
|
||||||
alias MusicLibrary.Artists
|
|
||||||
alias MusicLibrary.Assets.Transform
|
|
||||||
alias MusicLibraryWeb.AssetController
|
|
||||||
|
|
||||||
def image(conn, %{"musicbrainz_id" => artist_id}) do
|
|
||||||
case Artists.get_image(artist_id) do
|
|
||||||
nil ->
|
|
||||||
not_found(conn)
|
|
||||||
|
|
||||||
%{image_data_hash: hash} ->
|
|
||||||
payload =
|
|
||||||
%Transform{hash: hash}
|
|
||||||
|> Transform.encode!()
|
|
||||||
|
|
||||||
AssetController.show(conn, %{"transform_payload" => payload})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp not_found(conn) do
|
|
||||||
conn
|
|
||||||
|> put_status(:not_found)
|
|
||||||
|> text("Not found")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user