Rename record.release to record.release_date

Includes changes to dependent tables (i.e. the record search index) and
related functions.
This commit is contained in:
Claudio Ortolina
2025-05-01 14:04:57 +01:00
parent 8be0144cc7
commit e083950138
20 changed files with 1066 additions and 51 deletions
@@ -1,6 +1,6 @@
defmodule MusicBrainz.ReleaseGroupSearchResult do defmodule MusicBrainz.ReleaseGroupSearchResult do
@enforce_keys [:id, :type, :title, :artists, :release] @enforce_keys [:id, :type, :title, :artists, :release_date]
defstruct [:id, :type, :title, :artists, :release] defstruct [:id, :type, :title, :artists, :release_date]
alias MusicBrainz.ReleaseGroup alias MusicBrainz.ReleaseGroup
@@ -10,7 +10,7 @@ defmodule MusicBrainz.ReleaseGroupSearchResult do
type: ReleaseGroup.parse_type(rg["primary-type"]), type: ReleaseGroup.parse_type(rg["primary-type"]),
title: rg["title"], title: rg["title"],
artists: Enum.map_join(rg["artist-credit"], ", ", fn ac -> ac["artist"]["name"] end), artists: Enum.map_join(rg["artist-credit"], ", ", fn ac -> ac["artist"]["name"] end),
release: rg["first-release-date"] release_date: rg["first-release-date"]
} }
end end
+1 -1
View File
@@ -22,7 +22,7 @@ defmodule MusicLibrary.Records do
:release_ids, :release_ids,
:included_release_group_ids, :included_release_group_ids,
:cover_hash, :cover_hash,
:release :release_date
] ]
end end
+14 -14
View File
@@ -20,7 +20,7 @@ defmodule MusicLibrary.Records.Record do
field :musicbrainz_id, Ecto.UUID field :musicbrainz_id, Ecto.UUID
field :musicbrainz_data, :map, default: %{} field :musicbrainz_data, :map, default: %{}
field :genres, {:array, :string} field :genres, {:array, :string}
field :release, :string field :release_date, :string
field :purchased_at, :utc_datetime field :purchased_at, :utc_datetime
field :release_ids, {:array, :string}, default: [] field :release_ids, {:array, :string}, default: []
field :included_release_group_ids, {:array, :string}, default: [] field :included_release_group_ids, {:array, :string}, default: []
@@ -55,10 +55,10 @@ defmodule MusicLibrary.Records.Record do
Enum.count(record.release_ids) Enum.count(record.release_ids)
end end
def released?(%{release: nil}, _current_day), do: true def released?(%{release_date: nil}, _current_day), do: true
def released?(record, current_day) do def released?(record, current_day) do
case Date.from_iso8601(record.release) do case Date.from_iso8601(record.release_date) do
{:ok, release_date} -> {:ok, release_date} ->
Date.compare(current_day, release_date) != :lt Date.compare(current_day, release_date) != :lt
@@ -78,7 +78,7 @@ defmodule MusicLibrary.Records.Record do
:title, :title,
:musicbrainz_id, :musicbrainz_id,
:musicbrainz_data, :musicbrainz_data,
:release, :release_date,
:genres, :genres,
:release_ids, :release_ids,
:included_release_group_ids, :included_release_group_ids,
@@ -169,7 +169,7 @@ defmodule MusicLibrary.Records.Record do
"musicbrainz_data" => release_group, "musicbrainz_data" => release_group,
"title" => release_group["title"], "title" => release_group["title"],
"artists" => artists_attrs, "artists" => artists_attrs,
"release" => release_group["first-release-date"], "release_date" => release_group["first-release-date"],
"type" => parse_subtype(release_group["primary-type"]), "type" => parse_subtype(release_group["primary-type"]),
"genres" => Enum.map(release_group["genres"], fn g -> g["name"] end), "genres" => Enum.map(release_group["genres"], fn g -> g["name"] end),
"release_ids" => Enum.map(release_group["releases"], fn r -> r["id"] end), "release_ids" => Enum.map(release_group["releases"], fn r -> r["id"] end),
@@ -191,22 +191,22 @@ defmodule MusicLibrary.Records.Record do
and can be nil or empty string. and can be nil or empty string.
iex> alias MusicLibrary.Records.Record iex> alias MusicLibrary.Records.Record
iex> Record.format_release(nil) iex> Record.format_release_date(nil)
"N/A" "N/A"
iex> Record.format_release("") iex> Record.format_release_date("")
"N/A" "N/A"
iex> Record.format_release("2021") iex> Record.format_release_date("2021")
"2021" "2021"
iex> Record.format_release("2021-12") iex> Record.format_release_date("2021-12")
"12/2021" "12/2021"
iex> Record.format_release("2021-12-23") iex> Record.format_release_date("2021-12-23")
"23/12/2021" "23/12/2021"
""" """
@spec format_release(String.t() | nil) :: String.t() @spec format_release_date(String.t() | nil) :: String.t()
def format_release(nil), do: "N/A" def format_release_date(nil), do: "N/A"
def format_release(release) do def format_release_date(release_date) do
case String.split(release, "-", trim: true) do case String.split(release_date, "-", trim: true) do
[] -> "N/A" [] -> "N/A"
[year] -> year [year] -> year
[year, month] -> "#{month}/#{year}" [year, month] -> "#{month}/#{year}"
+1 -1
View File
@@ -20,7 +20,7 @@ defmodule MusicLibrary.Records.SearchIndex do
field :title, :string field :title, :string
field :musicbrainz_id, Ecto.UUID field :musicbrainz_id, Ecto.UUID
field :genres, {:array, :string} field :genres, {:array, :string}
field :release, :string field :release_date, :string
field :purchased_at, :utc_datetime field :purchased_at, :utc_datetime
field :cover_hash, :string field :cover_hash, :string
field :release_ids, {:array, :string}, default: [] field :release_ids, {:array, :string}, default: []
@@ -81,7 +81,9 @@ defmodule MusicLibraryWeb.AddRecordComponent do
{@release_group.title} {@release_group.title}
</h2> </h2>
<p class="mt-1 text-xs leading-5 text-zinc-500 dark:text-zinc-400"> <p class="mt-1 text-xs leading-5 text-zinc-500 dark:text-zinc-400">
{Records.Record.format_release(@release_group.release)} · {type_label(@release_group.type)} {Records.Record.format_release_date(@release_group.release_date)} · {type_label(
@release_group.type
)}
</p> </p>
</div> </div>
<div class="relative flex-none"> <div class="relative flex-none">
@@ -280,7 +280,7 @@ defmodule MusicLibraryWeb.BarcodeScannerComponent do
{@release.title} {@release.title}
</h2> </h2>
<p class="mt-1 text-xs leading-5 text-zinc-500 dark:text-zinc-400"> <p class="mt-1 text-xs leading-5 text-zinc-500 dark:text-zinc-400">
{release_format_label(@release)} · {Records.Record.format_release(@release.date)} · {RecordComponents.type_label( {release_format_label(@release)} · {Records.Record.format_release_date(@release.date)} · {RecordComponents.type_label(
@release.release_group.type @release.release_group.type
)} )}
</p> </p>
@@ -56,7 +56,7 @@ defmodule MusicLibraryWeb.FormComponent do
label={gettext("MusicBrainz ID")} label={gettext("MusicBrainz ID")}
/> />
<div class="sm:columns-2"> <div class="sm:columns-2">
<.input field={@form[:release]} type="text" label={gettext("Release")} /> <.input field={@form[:release_date]} type="text" label={gettext("Release Date")} />
<.input <.input
:if={@show_purchased_at} :if={@show_purchased_at}
field={@form[:purchased_at]} field={@form[:purchased_at]}
@@ -57,7 +57,7 @@ defmodule MusicLibraryWeb.RecordComponents do
{record.title} {record.title}
</h2> </h2>
<p class="mt-1 text-xs leading-5 text-zinc-500 dark:text-zinc-400"> <p class="mt-1 text-xs leading-5 text-zinc-500 dark:text-zinc-400">
{Records.Record.format_release(record.release)} {Records.Record.format_release_date(record.release_date)}
<span :if={@current_date && !Records.Record.released?(record, @current_date)}> <span :if={@current_date && !Records.Record.released?(record, @current_date)}>
({gettext("Unreleased")}) ({gettext("Unreleased")})
</span> </span>
@@ -271,7 +271,7 @@ defmodule MusicLibraryWeb.RecordComponents do
{format_label(record.format)} · {type_label(record.type)} {format_label(record.format)} · {type_label(record.type)}
</p> </p>
<p class="pointer-events-none block text-sm font-medium text-zinc-500"> <p class="pointer-events-none block text-sm font-medium text-zinc-500">
{Records.Record.format_release(record.release)} {Records.Record.format_release_date(record.release_date)}
</p> </p>
</li> </li>
</ul> </ul>
@@ -125,8 +125,8 @@ defmodule MusicLibraryWeb.ArtistLive.Show do
{collection, wishlist} = Enum.split_with(records, fn r -> r.purchased_at end) {collection, wishlist} = Enum.split_with(records, fn r -> r.purchased_at end)
%{ %{
collection: Enum.sort_by(collection, fn r -> r.release end, :desc), collection: Enum.sort_by(collection, fn r -> r.release_date end, :desc),
wishlist: Enum.sort_by(wishlist, fn r -> r.release end, :desc) wishlist: Enum.sort_by(wishlist, fn r -> r.release_date end, :desc)
} }
end end
@@ -22,7 +22,7 @@
{@record.title} {@record.title}
</h2> </h2>
<p class="mt-2 text-sm leading-5 text-zinc-500 dark:text-zinc-400"> <p class="mt-2 text-sm leading-5 text-zinc-500 dark:text-zinc-400">
{Records.Record.format_release(@record.release)} · {format_label(@record.format)} · {type_label( {Records.Record.format_release_date(@record.release_date)} · {format_label(@record.format)} · {type_label(
@record.type @record.type
)} )}
</p> </p>
@@ -22,7 +22,7 @@
{@record.title} {@record.title}
</h2> </h2>
<p class="mt-2 text-sm leading-5 text-zinc-500 dark:text-zinc-400"> <p class="mt-2 text-sm leading-5 text-zinc-500 dark:text-zinc-400">
{Records.Record.format_release(@record.release)} {Records.Record.format_release_date(@record.release_date)}
<span :if={@current_date && !Records.Record.released?(@record, @current_date)}> <span :if={@current_date && !Records.Record.released?(@record, @current_date)}>
({gettext("Unreleased")}) ({gettext("Unreleased")})
</span> </span>
+5 -5
View File
@@ -175,11 +175,6 @@ msgstr ""
msgid "Record updated successfully" msgid "Record updated successfully"
msgstr "" msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Release"
msgstr ""
#: lib/music_library_web/components/form_component.ex #: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Save" msgid "Save"
@@ -742,3 +737,8 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Top %{n} Genres" msgid "Top %{n} Genres"
msgstr "" msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Release Date"
msgstr ""
+744
View File
@@ -0,0 +1,744 @@
## "msgid"s in this file come from POT (.pot) files.
###
### Do not add, change, or remove "msgid"s manually here as
### they're tied to the ones in the corresponding POT file
### (with the same domain).
###
### Use "mix gettext.extract --merge" or "mix gettext.merge"
### to merge POT files into PO files.
msgid ""
msgstr ""
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "Actions"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Are you sure?"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Choose a value"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#: lib/music_library_web/live/artist_live/show.html.heex
#: lib/music_library_web/live/collection_live/index.ex
#: lib/music_library_web/live/collection_live/show.ex
#, elixir-autogen, elixir-format
msgid "Collection"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Cover art"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Delete"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Edit"
msgstr ""
#: lib/music_library_web/live/collection_live/index.ex
#, elixir-autogen, elixir-format
msgid "Error importing record"
msgstr ""
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "Error!"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Format"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Formats"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Genres"
msgstr ""
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "Hang in there while we get back on track"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Inserted at"
msgstr ""
#: lib/music_library_web/controllers/session_controller.ex
#, elixir-autogen, elixir-format
msgid "Invalid password"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Latest purchase"
msgstr ""
#: lib/music_library_web/controllers/session_controller.ex
#: lib/music_library_web/controllers/session_html/new.html.heex
#, elixir-autogen, elixir-format
msgid "Login"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#, elixir-autogen, elixir-format
msgid "Logout"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "MusicBrainz ID"
msgstr ""
#: lib/music_library_web/components/pagination_component.ex
#, elixir-autogen, elixir-format
msgid "Next"
msgstr ""
#: lib/music_library_web/components/add_record_component.ex
#, elixir-autogen, elixir-format
msgid "No results"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Open options"
msgstr ""
#: lib/music_library_web/controllers/session_html/new.html.heex
#, elixir-autogen, elixir-format
msgid "Password"
msgstr ""
#: lib/music_library_web/components/pagination_component.ex
#, elixir-autogen, elixir-format
msgid "Previous"
msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Purchase"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Purchased at"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Purchased on"
msgstr ""
#: lib/music_library_web/live/collection_live/index.ex
#, elixir-autogen, elixir-format
msgid "Record imported successfully"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Record updated successfully"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Save"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Saving..."
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Search"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Show"
msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex
#: lib/music_library_web/live/wishlist_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Showing <b>%{visible}</b> of <b>%{total}</b> records"
msgstr ""
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "Something went wrong!"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#: lib/music_library_web/live/stats_live/index.ex
#, elixir-autogen, elixir-format
msgid "Stats"
msgstr ""
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "Success!"
msgstr ""
#: lib/music_library_web/live/collection_live/index.ex
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/index.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "The application has been updated, please reload."
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Total collection"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Total wishlist"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Type"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Types"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Updated at"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "View on MusicBrainz"
msgstr ""
#: lib/music_library_web/controllers/session_html/new.html.heex
#, elixir-autogen, elixir-format
msgid "Welcome to your Music Library"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#: lib/music_library_web/live/artist_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/index.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Wishlist"
msgstr ""
#: lib/music_library_web/auth.ex
#, elixir-autogen, elixir-format
msgid "You must be logged in to access this page"
msgstr ""
#: lib/music_library_web/components/core_components.ex
#, elixir-autogen, elixir-format
msgid "close"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Copy MusicBrainz ID to clipboard"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "MusicBrainz data"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Scrobble activity"
msgstr ""
#: lib/music_library_web/components/add_record_component.ex
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Choose which format to import"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Collected"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Wishlisted"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Includes"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Error refreshing MusicBrainz data"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "MusicBrainz data refreshed successfully"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Refresh LastFm Feed"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Cover refreshed successfully"
msgstr ""
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Error refreshing Cover"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#, elixir-autogen, elixir-format
msgid "Error refreshing cover"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "No MB ID"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#: lib/music_library_web/live/collection_live/show.ex
#, elixir-autogen, elixir-format
msgid "Details"
msgstr ""
#: lib/music_library_web/components/layouts/root.html.heex
#, elixir-autogen, elixir-format
msgid "Made by"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "View details"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Biography"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Loading biography"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Loading play count"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Error populating genres"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Genres populated successfully"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Populate genres"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Refresh MB data"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Refresh cover"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Records"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Error loading biography"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Error loading play count"
msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "A->Z"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#, elixir-autogen, elixir-format
msgid "Errors"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "On Tour"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "1 record"
msgid_plural "%{count} records"
msgstr[0] ""
msgstr[1] ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "1 scrobble"
msgid_plural "%{count} scrobbles"
msgstr[0] ""
msgstr[1] ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Copy record ID to clipboard"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "ID"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Unreleased"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Album"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Backup"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Blu-ray"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "CD"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Comp"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "DVD"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "EP"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Live"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Multi"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Other"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Single"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#, elixir-autogen, elixir-format
msgid "Vinyl"
msgstr ""
#: lib/music_library_web/components/record_components.ex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Purchased"
msgstr ""
#: lib/music_library_web/live/wishlist_live/index.ex
#: lib/music_library_web/live/wishlist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Record added to the collection"
msgstr ""
#: lib/music_library_web/live/collection_live/show.html.heex
#: lib/music_library_web/live/wishlist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Published releases"
msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Scan"
msgstr ""
#: lib/music_library_web/live/collection_live/index.ex
#, elixir-autogen, elixir-format
msgid "Scan barcodes · Collection"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Scan one or more barcodes"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Open camera"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Failed to search release for barcode %{number}"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Records imported successfully"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "New"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Error loading similar artists"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Loading similar artists"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Similar artists"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "PNG, JPG, WEBP up to 8MB"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Upload a file"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "or drag and drop"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#, elixir-autogen, elixir-format
msgid "Live Dashboard"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Barcode not found"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Some records could not be imported: %{summary}"
msgstr ""
#: lib/music_library_web/live/collection_live/index.html.heex
#: lib/music_library_web/live/wishlist_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Add"
msgstr ""
#: lib/music_library_web/live/collection_live/index.ex
#, elixir-autogen, elixir-format
msgid "Add new Record · Collection"
msgstr ""
#: lib/music_library_web/live/wishlist_live/index.ex
#, elixir-autogen, elixir-format
msgid "Add new Record · Wishlist"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Add releases"
msgstr ""
#: lib/music_library_web/components/barcode_scanner_component.ex
#, elixir-autogen, elixir-format
msgid "Adding..."
msgstr ""
#: lib/music_library_web/components/add_record_component.ex
#, elixir-autogen, elixir-format
msgid "Search for a record"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Albums"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Tracks"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Add more"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#, elixir-autogen, elixir-format
msgid "Add more · Artist"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#: lib/music_library_web/live/stats_live/index.ex
#: lib/music_library_web/live/wishlist_live/index.ex
#, elixir-autogen, elixir-format
msgid "Error wishlisting record"
msgstr ""
#: lib/music_library_web/live/artist_live/show.ex
#: lib/music_library_web/live/stats_live/index.ex
#: lib/music_library_web/live/wishlist_live/index.ex
#, elixir-autogen, elixir-format
msgid "Record wishlisted successfully"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "No scrobbles"
msgstr ""
#: lib/music_library_web/live/artist_live/show.html.heex
#, elixir-autogen, elixir-format
msgid "Meta"
msgstr ""
#: lib/music_library_web/live/collection_live/show.ex
#, elixir-autogen, elixir-format
msgid "Record updated in the background"
msgstr ""
#: lib/music_library_web/components/layouts/app.html.heex
#, elixir-autogen, elixir-format
msgid "Oban"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Top %{n} Artists"
msgstr ""
#: lib/music_library_web/live/stats_live/index.html.heex
#, elixir-autogen, elixir-format
msgid "Top %{n} Genres"
msgstr ""
#: lib/music_library_web/components/form_component.ex
#, elixir-autogen, elixir-format
msgid "Release Date"
msgstr ""
@@ -0,0 +1,269 @@
defmodule MusicLibrary.Repo.Migrations.RenameRecordsReleaseToReleaseDate do
use Ecto.Migration
def up do
rename table(:records), :release, to: :release_date
flush()
execute "DROP TRIGGER IF EXISTS records_after_update"
execute "DROP TRIGGER IF EXISTS records_after_insert"
execute "DROP TABLE records_search_index"
flush()
execute """
CREATE VIRTUAL TABLE records_search_index USING fts5(
id UNINDEXED,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids UNINDEXED,
included_release_group_ids UNINDEXED,
cover_hash UNINDEXED,
purchased_at UNINDEXED,
release_date
);
"""
flush()
execute """
CREATE TRIGGER records_after_insert
AFTER INSERT ON records
BEGIN
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
FROM records
WHERE NEW.id = records.id;
END;
"""
execute """
CREATE TRIGGER records_after_update
AFTER UPDATE ON records
BEGIN
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
FROM records
WHERE NEW.id = records.id;
END;
"""
flush()
execute """
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release_date
FROM records;
"""
end
def down do
rename table(:records), :release_date, to: :release
flush()
execute "DROP TRIGGER IF EXISTS records_after_update"
execute "DROP TRIGGER IF EXISTS records_after_insert"
execute "DROP TABLE records_search_index"
flush()
execute """
CREATE VIRTUAL TABLE records_search_index USING fts5(
id UNINDEXED,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids UNINDEXED,
included_release_group_ids UNINDEXED,
cover_hash UNINDEXED,
purchased_at UNINDEXED,
release
);
"""
flush()
execute """
CREATE TRIGGER records_after_insert
AFTER INSERT ON records
BEGIN
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
FROM records
WHERE NEW.id = records.id;
END;
"""
execute """
CREATE TRIGGER records_after_update
AFTER UPDATE ON records
BEGIN
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
FROM records
WHERE NEW.id = records.id;
END;
"""
flush()
execute """
INSERT INTO records_search_index(
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
) SELECT
id,
type,
format,
title,
artists,
genres,
musicbrainz_id,
release_ids,
included_release_group_ids,
cover_hash,
purchased_at,
release
FROM records;
"""
end
end
@@ -9,7 +9,7 @@ defmodule MusicLibrary.BarcodeScan.ResultTest do
type: :album, type: :album,
title: "Test Release Group", title: "Test Release Group",
artists: ["Test Artist"], artists: ["Test Artist"],
release: "2021-01-01" release_date: "2021-01-01"
} }
@release %ReleaseSearchResult{ @release %ReleaseSearchResult{
+8 -8
View File
@@ -16,26 +16,26 @@ defmodule MusicLibrary.Records.RecordTest do
test "returns true if the record has a release date in the past", %{ test "returns true if the record has a release date in the past", %{
current_date: current_date current_date: current_date
} do } do
record = %Record{release: "2024-01-01"} record = %Record{release_date: "2024-01-01"}
assert Record.released?(record, current_date) assert Record.released?(record, current_date)
end end
test "returns false if the record has a release date in the future", %{ test "returns false if the record has a release date in the future", %{
current_date: current_date current_date: current_date
} do } do
record = %Record{release: "2025-02-01"} record = %Record{release_date: "2025-02-01"}
refute Record.released?(record, current_date) refute Record.released?(record, current_date)
end end
test "returns true if the record is released today", %{current_date: current_date} do test "returns true if the record is released today", %{current_date: current_date} do
record = %Record{release: "2025-01-01"} record = %Record{release_date: "2025-01-01"}
assert Record.released?(record, current_date) assert Record.released?(record, current_date)
end end
test "it returns true if the release date is not precise enough", %{ test "it returns true if the release date is not precise enough", %{
current_date: current_date current_date: current_date
} do } do
record = %Record{release: "2019"} record = %Record{release_date: "2019"}
assert Record.released?(record, current_date) assert Record.released?(record, current_date)
end end
end end
@@ -54,28 +54,28 @@ defmodule MusicLibrary.Records.RecordTest do
id: "749c07b5-4900-404b-bea9-bb6b16fa991e", id: "749c07b5-4900-404b-bea9-bb6b16fa991e",
type: :other, type: :other,
title: "Claustrophobic Universe", title: "Claustrophobic Universe",
release: "2021-04-23", release_date: "2021-04-23",
artists: "Mariusz Duda" artists: "Mariusz Duda"
}, },
%MusicBrainz.ReleaseGroupSearchResult{ %MusicBrainz.ReleaseGroupSearchResult{
id: "61077431-0057-4119-8f06-0df1098d21e5", id: "61077431-0057-4119-8f06-0df1098d21e5",
type: :other, type: :other,
title: "Interior Drawings", title: "Interior Drawings",
release: "2021-12-10", release_date: "2021-12-10",
artists: "Mariusz Duda" artists: "Mariusz Duda"
}, },
%MusicBrainz.ReleaseGroupSearchResult{ %MusicBrainz.ReleaseGroupSearchResult{
id: "c36123e3-8899-48a5-8196-9dbb72421d69", id: "c36123e3-8899-48a5-8196-9dbb72421d69",
type: :other, type: :other,
title: "Lets Meet Outside", title: "Lets Meet Outside",
release: "2022-05-20", release_date: "2022-05-20",
artists: "Mariusz Duda" artists: "Mariusz Duda"
}, },
%MusicBrainz.ReleaseGroupSearchResult{ %MusicBrainz.ReleaseGroupSearchResult{
id: "d463f2b1-d254-4baf-a957-fb78c6e5b956", id: "d463f2b1-d254-4baf-a957-fb78c6e5b956",
type: :other, type: :other,
title: "Lockdown Spaces", title: "Lockdown Spaces",
release: "2020-06-26", release_date: "2020-06-26",
artists: "Mariusz Duda" artists: "Mariusz Duda"
} }
] ]
@@ -49,7 +49,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
session session
|> assert_has("#records-#{record.id}") |> assert_has("#records-#{record.id}")
|> assert_has("#records-#{record.id} h2", text: escape(record.title)) |> assert_has("#records-#{record.id} h2", text: escape(record.title))
|> assert_has("#records-#{record.id} p", text: record.release) |> assert_has("#records-#{record.id} p", text: record.release_date)
|> assert_has("#records-#{record.id} p", text: format_label(record.format)) |> assert_has("#records-#{record.id} p", text: format_label(record.format))
|> assert_has("#records-#{record.id} p", text: type_label(record.type)) |> assert_has("#records-#{record.id} p", text: type_label(record.type))
|> assert_has("#records-#{record.id} span", |> assert_has("#records-#{record.id} span",
@@ -134,7 +134,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
session session
|> assert_has("#records-#{record.id}") |> assert_has("#records-#{record.id}")
|> assert_has("#records-#{record.id} h2", text: escape(record.title)) |> assert_has("#records-#{record.id} h2", text: escape(record.title))
|> assert_has("#records-#{record.id} p", text: record.release) |> assert_has("#records-#{record.id} p", text: record.release_date)
|> assert_has("#records-#{record.id} p", text: format_label(record.format)) |> assert_has("#records-#{record.id} p", text: format_label(record.format))
|> assert_has("#records-#{record.id} p", text: type_label(record.type)) |> assert_has("#records-#{record.id} p", text: type_label(record.type))
|> assert_has("#records-#{record.id} span", |> assert_has("#records-#{record.id} span",
@@ -176,7 +176,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
session session
|> assert_has("#records-#{record.id}") |> assert_has("#records-#{record.id}")
|> assert_has("#records-#{record.id} h2", text: escape(record.title)) |> assert_has("#records-#{record.id} h2", text: escape(record.title))
|> assert_has("#records-#{record.id} p", text: record.release) |> assert_has("#records-#{record.id} p", text: record.release_date)
|> assert_has("#records-#{record.id} p", text: format_label(record.format)) |> assert_has("#records-#{record.id} p", text: format_label(record.format))
|> assert_has("#records-#{record.id} p", text: type_label(record.type)) |> assert_has("#records-#{record.id} p", text: type_label(record.type))
|> assert_has("#records-#{record.id} span", |> assert_has("#records-#{record.id} span",
@@ -277,7 +277,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
session session
|> assert_has("h1", text: result.artists) |> assert_has("h1", text: result.artists)
|> assert_has("h2", text: result.title) |> assert_has("h2", text: result.title)
|> assert_has("p", text: Record.format_release(result.release)) |> assert_has("p", text: Record.format_release_date(result.release_date))
end end
session = session =
@@ -288,7 +288,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
assert record.musicbrainz_id == first_release_group_search_result_id assert record.musicbrainz_id == first_release_group_search_result_id
assert record.title == "Marbles" assert record.title == "Marbles"
assert record.release == "2004-05-03" assert record.release_date == "2004-05-03"
assert record.format == :cd assert record.format == :cd
assert record.musicbrainz_data == release_group assert record.musicbrainz_data == release_group
@@ -392,7 +392,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
assert record.musicbrainz_id == release_group_id assert record.musicbrainz_id == release_group_id
assert record.title == "Marbles" assert record.title == "Marbles"
assert record.release == "2004-05-03" assert record.release_date == "2004-05-03"
assert record.format == :cd assert record.format == :cd
assert record.musicbrainz_data == release_group assert record.musicbrainz_data == release_group
@@ -26,7 +26,7 @@ defmodule MusicLibraryWeb.CollectionLive.ShowTest do
conn conn
|> visit(~p"/collection/#{record.id}") |> visit(~p"/collection/#{record.id}")
|> assert_has("h2", text: escape(record.title)) |> assert_has("h2", text: escape(record.title))
|> assert_has("p", text: record.release) |> assert_has("p", text: record.release_date)
|> assert_has("p", text: format_label(record.format)) |> assert_has("p", text: format_label(record.format))
|> assert_has("p", text: type_label(record.type)) |> assert_has("p", text: type_label(record.type))
|> assert_has("dd", text: Record.format_as_date(record.purchased_at)) |> assert_has("dd", text: Record.format_as_date(record.purchased_at))
@@ -26,7 +26,7 @@ defmodule MusicLibraryWeb.WishlistLive.ShowTest do
conn conn
|> visit(~p"/wishlist/#{record.id}") |> visit(~p"/wishlist/#{record.id}")
|> assert_has("h2", text: escape(record.title)) |> assert_has("h2", text: escape(record.title))
|> assert_has("p", text: record.release) |> assert_has("p", text: record.release_date)
|> assert_has("p", text: format_label(record.format)) |> assert_has("p", text: format_label(record.format))
|> assert_has("p", text: type_label(record.type)) |> assert_has("p", text: type_label(record.type))
|> assert_has("dd", text: record.id) |> assert_has("dd", text: record.id)
@@ -66,7 +66,7 @@ defmodule MusicLibrary.Fixtures.Records do
title: Enum.random(@titles), title: Enum.random(@titles),
type: :album, type: :album,
format: Record.formats() |> Enum.random(), format: Record.formats() |> Enum.random(),
release: Enum.random(1969..2024) |> Integer.to_string(), release_date: Enum.random(1969..2024) |> Integer.to_string(),
purchased_at: current_time, purchased_at: current_time,
artists: [artist_attrs(artist_name)] artists: [artist_attrs(artist_name)]
}) })