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