Where possible, link scrobbled artists to artist page
This commit is contained in:
@@ -100,6 +100,12 @@ defmodule MusicLibrary.Records do
|
|||||||
Repo.one!(q)
|
Repo.one!(q)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_all_artist_ids do
|
||||||
|
q = from ar in ArtistRecord, distinct: true, select: ar.musicbrainz_id
|
||||||
|
|
||||||
|
Repo.all(q)
|
||||||
|
end
|
||||||
|
|
||||||
def get_artist_records(musicbrainz_id) do
|
def get_artist_records(musicbrainz_id) do
|
||||||
q =
|
q =
|
||||||
from r in Record,
|
from r in Record,
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ defmodule MusicLibraryWeb.StatsLive.Index do
|
|||||||
collected_release_ids = Collection.collected_release_ids(release_ids)
|
collected_release_ids = Collection.collected_release_ids(release_ids)
|
||||||
wishlisted_release_ids = Wishlist.wishlisted_release_ids(release_ids)
|
wishlisted_release_ids = Wishlist.wishlisted_release_ids(release_ids)
|
||||||
|
|
||||||
|
artist_ids = Records.get_all_artist_ids()
|
||||||
|
|
||||||
if connected?(socket) do
|
if connected?(socket) do
|
||||||
LastFm.Feed.subscribe()
|
LastFm.Feed.subscribe()
|
||||||
end
|
end
|
||||||
@@ -44,6 +46,7 @@ defmodule MusicLibraryWeb.StatsLive.Index do
|
|||||||
latest_record: latest_record,
|
latest_record: latest_record,
|
||||||
collected_release_ids: collected_release_ids,
|
collected_release_ids: collected_release_ids,
|
||||||
wishlisted_release_ids: wishlisted_release_ids,
|
wishlisted_release_ids: wishlisted_release_ids,
|
||||||
|
artist_ids: artist_ids,
|
||||||
nav_section: :stats
|
nav_section: :stats
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
@@ -59,11 +62,14 @@ defmodule MusicLibraryWeb.StatsLive.Index do
|
|||||||
collected_release_ids = Collection.collected_release_ids(release_ids)
|
collected_release_ids = Collection.collected_release_ids(release_ids)
|
||||||
wishlisted_release_ids = Wishlist.wishlisted_release_ids(release_ids)
|
wishlisted_release_ids = Wishlist.wishlisted_release_ids(release_ids)
|
||||||
|
|
||||||
|
artist_ids = Records.get_all_artist_ids()
|
||||||
|
|
||||||
{:noreply,
|
{:noreply,
|
||||||
socket
|
socket
|
||||||
|> assign(
|
|> assign(
|
||||||
collected_release_ids: collected_release_ids,
|
collected_release_ids: collected_release_ids,
|
||||||
wishlisted_release_ids: wishlisted_release_ids
|
wishlisted_release_ids: wishlisted_release_ids,
|
||||||
|
artist_ids: artist_ids
|
||||||
)
|
)
|
||||||
|> stream(:recent_tracks, recent_tracks, reset: true)}
|
|> stream(:recent_tracks, recent_tracks, reset: true)}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -100,9 +100,19 @@
|
|||||||
<div class="flex min-w-0 justify-between space-x-4 items-center">
|
<div class="flex min-w-0 justify-between space-x-4 items-center">
|
||||||
<img class="h-12 w-12 rounded-md shadow" src={track.cover_url} alt={track.title} />
|
<img class="h-12 w-12 rounded-md shadow" src={track.cover_url} alt={track.title} />
|
||||||
<div>
|
<div>
|
||||||
<p class="font-semibold text-sm block text-zinc-500 dark:text-zinc-400">
|
<p
|
||||||
|
:if={track.artist.musicbrainz_id not in @artist_ids}
|
||||||
|
class="font-semibold text-sm block text-zinc-500 dark:text-zinc-400"
|
||||||
|
>
|
||||||
{track.artist.name}
|
{track.artist.name}
|
||||||
</p>
|
</p>
|
||||||
|
<.link
|
||||||
|
:if={track.artist.musicbrainz_id in @artist_ids}
|
||||||
|
class="font-semibold text-sm block text-zinc-700 hover:text-zinc-500 dark:text-zinc-400 dark:hover:text-zinc-300"
|
||||||
|
navigate={~p"/artists/#{track.artist.musicbrainz_id}"}
|
||||||
|
>
|
||||||
|
{track.artist.name}
|
||||||
|
</.link>
|
||||||
<p class="font-semibold text-sm md:text-base text-zinc-700 dark:text-zinc-300">
|
<p class="font-semibold text-sm md:text-base text-zinc-700 dark:text-zinc-300">
|
||||||
{track.title}
|
{track.title}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ msgid "Something went wrong!"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/components/layouts/app.html.heex:8
|
#: lib/music_library_web/components/layouts/app.html.heex:8
|
||||||
#: lib/music_library_web/live/stats_live/index.ex:39
|
#: lib/music_library_web/live/stats_live/index.ex:41
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Stats"
|
msgid "Stats"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -364,17 +364,17 @@ msgid "Scrobble activity"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/record_live/import_component.ex:80
|
#: lib/music_library_web/live/record_live/import_component.ex:80
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex:177
|
#: lib/music_library_web/live/stats_live/index.html.heex:187
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Choose which format to import"
|
msgid "Choose which format to import"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex:145
|
#: lib/music_library_web/live/stats_live/index.html.heex:155
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Collected"
|
msgid "Collected"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex:158
|
#: lib/music_library_web/live/stats_live/index.html.heex:168
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Wishlisted"
|
msgid "Wishlisted"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -446,7 +446,7 @@ msgstr ""
|
|||||||
msgid "Error refreshing cover"
|
msgid "Error refreshing cover"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex:132
|
#: lib/music_library_web/live/stats_live/index.html.heex:142
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "No MB ID"
|
msgid "No MB ID"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
Reference in New Issue
Block a user