Remove on tour tracking functionality (source unreliable)
This commit is contained in:
@@ -10,7 +10,6 @@ defmodule LastFm.Artist do
|
|||||||
bio: String.t(),
|
bio: String.t(),
|
||||||
image: String.t(),
|
image: String.t(),
|
||||||
play_count: non_neg_integer(),
|
play_count: non_neg_integer(),
|
||||||
on_tour: boolean(),
|
|
||||||
base_url: String.t(),
|
base_url: String.t(),
|
||||||
image_data_hash: String.t() | nil
|
image_data_hash: String.t() | nil
|
||||||
}
|
}
|
||||||
@@ -23,7 +22,6 @@ defmodule LastFm.Artist do
|
|||||||
field :bio, :string
|
field :bio, :string
|
||||||
field :image, :string
|
field :image, :string
|
||||||
field :play_count, :integer, default: 0
|
field :play_count, :integer, default: 0
|
||||||
field :on_tour, :boolean, default: false
|
|
||||||
field :base_url, :string
|
field :base_url, :string
|
||||||
field :image_data_hash, :string
|
field :image_data_hash, :string
|
||||||
end
|
end
|
||||||
@@ -37,7 +35,6 @@ defmodule LastFm.Artist do
|
|||||||
bio: api_response["bio"]["content"] || "",
|
bio: api_response["bio"]["content"] || "",
|
||||||
image: get_image(api_response),
|
image: get_image(api_response),
|
||||||
play_count: get_play_count(api_response),
|
play_count: get_play_count(api_response),
|
||||||
on_tour: api_response["ontour"] == "1",
|
|
||||||
base_url: api_response["url"]
|
base_url: api_response["url"]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -52,17 +49,11 @@ defmodule LastFm.Artist do
|
|||||||
:bio,
|
:bio,
|
||||||
:image,
|
:image,
|
||||||
:play_count,
|
:play_count,
|
||||||
:on_tour,
|
|
||||||
:base_url
|
:base_url
|
||||||
])
|
])
|
||||||
|> validate_required([:name])
|
|> validate_required([:name])
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec events_url(t()) :: String.t()
|
|
||||||
def events_url(artist) do
|
|
||||||
artist.base_url <> "/+events"
|
|
||||||
end
|
|
||||||
|
|
||||||
defp get_image(api_response) do
|
defp get_image(api_response) do
|
||||||
api_response["image"]
|
api_response["image"]
|
||||||
|> Enum.find(%{"#text" => nil}, fn i -> i["size"] == "medium" end)
|
|> Enum.find(%{"#text" => nil}, fn i -> i["size"] == "medium" end)
|
||||||
|
|||||||
@@ -18,21 +18,6 @@ defmodule MusicLibraryWeb.ArtistLive.Show do
|
|||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
attr :lastfm_artist_info, :map, required: true
|
|
||||||
|
|
||||||
defp on_tour_link(assigns) do
|
|
||||||
~H"""
|
|
||||||
<a
|
|
||||||
:if={@lastfm_artist_info.on_tour}
|
|
||||||
class="flex items-center"
|
|
||||||
href={LastFm.Artist.events_url(@lastfm_artist_info)}
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
<.badge variant="soft" class="mr-2">{gettext("On Tour")}</.badge>
|
|
||||||
</a>
|
|
||||||
"""
|
|
||||||
end
|
|
||||||
|
|
||||||
attr :play_count, :integer, required: true
|
attr :play_count, :integer, required: true
|
||||||
|
|
||||||
defp play_count(assigns) do
|
defp play_count(assigns) do
|
||||||
@@ -241,7 +226,6 @@ defmodule MusicLibraryWeb.ArtistLive.Show do
|
|||||||
{gettext("Error loading play count")}
|
{gettext("Error loading play count")}
|
||||||
</div>
|
</div>
|
||||||
</:failed>
|
</:failed>
|
||||||
<.on_tour_link lastfm_artist_info={lastfm_artist_info} />
|
|
||||||
<.play_count play_count={lastfm_artist_info.play_count} />
|
<.play_count play_count={lastfm_artist_info.play_count} />
|
||||||
</.async_result>
|
</.async_result>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -346,11 +346,6 @@ msgstr ""
|
|||||||
msgid "A->Z"
|
msgid "A->Z"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/artist_live/show.ex
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "On Tour"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/music_library_web/components/record_components.ex
|
#: lib/music_library_web/components/record_components.ex
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "1 record"
|
msgid "1 record"
|
||||||
|
|||||||
@@ -346,11 +346,6 @@ msgstr ""
|
|||||||
msgid "A->Z"
|
msgid "A->Z"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/artist_live/show.ex
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "On Tour"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/music_library_web/components/record_components.ex
|
#: lib/music_library_web/components/record_components.ex
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "1 record"
|
msgid "1 record"
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ defmodule LastFm.ArtistTest do
|
|||||||
image:
|
image:
|
||||||
"https://lastfm.freetls.fastly.net/i/u/64s/2a96cbd8b46e442fc41c2b86b821562f.png",
|
"https://lastfm.freetls.fastly.net/i/u/64s/2a96cbd8b46e442fc41c2b86b821562f.png",
|
||||||
play_count: 123,
|
play_count: 123,
|
||||||
on_tour: false,
|
|
||||||
base_url: "https://www.last.fm/music/Steven+Wilson"
|
base_url: "https://www.last.fm/music/Steven+Wilson"
|
||||||
} ==
|
} ==
|
||||||
LastFm.Artist.from_api_response(api_response)
|
LastFm.Artist.from_api_response(api_response)
|
||||||
|
|||||||
@@ -40,7 +40,6 @@
|
|||||||
],
|
],
|
||||||
"mbid": "3a51b862-0144-40f6-aa17-6aaeefea29d9",
|
"mbid": "3a51b862-0144-40f6-aa17-6aaeefea29d9",
|
||||||
"name": "Steven Wilson",
|
"name": "Steven Wilson",
|
||||||
"ontour": "0",
|
|
||||||
"similar": {
|
"similar": {
|
||||||
"artist": [
|
"artist": [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user