Display medium title if available
This commit is contained in:
@@ -8,8 +8,8 @@ defmodule MusicBrainz.Release do
|
|||||||
end
|
end
|
||||||
|
|
||||||
defmodule Medium do
|
defmodule Medium do
|
||||||
@enforce_keys [:format, :number, :track_count, :tracks]
|
@enforce_keys [:title, :format, :number, :track_count, :tracks]
|
||||||
defstruct [:format, :number, :track_count, :tracks]
|
defstruct [:title, :format, :number, :track_count, :tracks]
|
||||||
end
|
end
|
||||||
|
|
||||||
defmodule Track do
|
defmodule Track do
|
||||||
@@ -38,6 +38,7 @@ defmodule MusicBrainz.Release do
|
|||||||
defp parse_media(media) do
|
defp parse_media(media) do
|
||||||
Enum.map(media, fn m ->
|
Enum.map(media, fn m ->
|
||||||
%Medium{
|
%Medium{
|
||||||
|
title: m["title"],
|
||||||
format: m["format"],
|
format: m["format"],
|
||||||
number: m["position"],
|
number: m["position"],
|
||||||
track_count: m["track-count"],
|
track_count: m["track-count"],
|
||||||
|
|||||||
@@ -179,4 +179,12 @@ defmodule MusicLibraryWeb.CollectionLive.Show do
|
|||||||
|> MusicBrainz.Release.medium_duration()
|
|> MusicBrainz.Release.medium_duration()
|
||||||
|> format_duration()
|
|> format_duration()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp medium_title(medium) do
|
||||||
|
if medium.title !== "" do
|
||||||
|
medium.title
|
||||||
|
else
|
||||||
|
gettext("Disc %{no}", %{no: medium.number})
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -305,7 +305,7 @@
|
|||||||
:if={MusicBrainz.Release.media_count(release_with_tracks) > 1}
|
:if={MusicBrainz.Release.media_count(release_with_tracks) > 1}
|
||||||
class="text-sm font-semibold"
|
class="text-sm font-semibold"
|
||||||
>
|
>
|
||||||
{gettext("Disc %{no}", %{no: medium.number})}
|
{medium_title(medium)}
|
||||||
</h4>
|
</h4>
|
||||||
<ul class="w-full table table-auto">
|
<ul class="w-full table table-auto">
|
||||||
<li
|
<li
|
||||||
|
|||||||
@@ -775,7 +775,7 @@ msgstr ""
|
|||||||
msgid "Show Tracks"
|
msgid "Show Tracks"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/collection_live/show.html.heex
|
#: lib/music_library_web/live/collection_live/show.ex
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Disc %{no}"
|
msgid "Disc %{no}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
@@ -775,7 +775,7 @@ msgstr ""
|
|||||||
msgid "Show Tracks"
|
msgid "Show Tracks"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/live/collection_live/show.html.heex
|
#: lib/music_library_web/live/collection_live/show.ex
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Disc %{no}"
|
msgid "Disc %{no}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|||||||
Reference in New Issue
Block a user