diff --git a/lib/music_brainz/release_group_search_result.ex b/lib/music_brainz/release_group_search_result.ex index df1b1c59..8ea61468 100644 --- a/lib/music_brainz/release_group_search_result.ex +++ b/lib/music_brainz/release_group_search_result.ex @@ -1,6 +1,6 @@ defmodule MusicBrainz.ReleaseGroupSearchResult do - @enforce_keys [:id, :type, :title, :artists, :release] - defstruct [:id, :type, :title, :artists, :release] + @enforce_keys [:id, :type, :title, :artists, :release_date] + defstruct [:id, :type, :title, :artists, :release_date] alias MusicBrainz.ReleaseGroup @@ -10,7 +10,7 @@ defmodule MusicBrainz.ReleaseGroupSearchResult do type: ReleaseGroup.parse_type(rg["primary-type"]), title: rg["title"], 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 diff --git a/lib/music_library/records.ex b/lib/music_library/records.ex index 33e57cf0..c7641a9d 100644 --- a/lib/music_library/records.ex +++ b/lib/music_library/records.ex @@ -22,7 +22,7 @@ defmodule MusicLibrary.Records do :release_ids, :included_release_group_ids, :cover_hash, - :release + :release_date ] end diff --git a/lib/music_library/records/record.ex b/lib/music_library/records/record.ex index 78edc0dd..1dde4c22 100644 --- a/lib/music_library/records/record.ex +++ b/lib/music_library/records/record.ex @@ -20,7 +20,7 @@ defmodule MusicLibrary.Records.Record do field :musicbrainz_id, Ecto.UUID field :musicbrainz_data, :map, default: %{} field :genres, {:array, :string} - field :release, :string + field :release_date, :string field :purchased_at, :utc_datetime field :release_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) end - def released?(%{release: nil}, _current_day), do: true + def released?(%{release_date: nil}, _current_day), do: true def released?(record, current_day) do - case Date.from_iso8601(record.release) do + case Date.from_iso8601(record.release_date) do {:ok, release_date} -> Date.compare(current_day, release_date) != :lt @@ -78,7 +78,7 @@ defmodule MusicLibrary.Records.Record do :title, :musicbrainz_id, :musicbrainz_data, - :release, + :release_date, :genres, :release_ids, :included_release_group_ids, @@ -169,7 +169,7 @@ defmodule MusicLibrary.Records.Record do "musicbrainz_data" => release_group, "title" => release_group["title"], "artists" => artists_attrs, - "release" => release_group["first-release-date"], + "release_date" => release_group["first-release-date"], "type" => parse_subtype(release_group["primary-type"]), "genres" => Enum.map(release_group["genres"], fn g -> g["name"] 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. iex> alias MusicLibrary.Records.Record - iex> Record.format_release(nil) + iex> Record.format_release_date(nil) "N/A" - iex> Record.format_release("") + iex> Record.format_release_date("") "N/A" - iex> Record.format_release("2021") + iex> Record.format_release_date("2021") "2021" - iex> Record.format_release("2021-12") + iex> Record.format_release_date("2021-12") "12/2021" - iex> Record.format_release("2021-12-23") + iex> Record.format_release_date("2021-12-23") "23/12/2021" """ - @spec format_release(String.t() | nil) :: String.t() - def format_release(nil), do: "N/A" + @spec format_release_date(String.t() | nil) :: String.t() + def format_release_date(nil), do: "N/A" - def format_release(release) do - case String.split(release, "-", trim: true) do + def format_release_date(release_date) do + case String.split(release_date, "-", trim: true) do [] -> "N/A" [year] -> year [year, month] -> "#{month}/#{year}" diff --git a/lib/music_library/records/search_index.ex b/lib/music_library/records/search_index.ex index e5011976..e14cebd3 100644 --- a/lib/music_library/records/search_index.ex +++ b/lib/music_library/records/search_index.ex @@ -20,7 +20,7 @@ defmodule MusicLibrary.Records.SearchIndex do field :title, :string field :musicbrainz_id, Ecto.UUID field :genres, {:array, :string} - field :release, :string + field :release_date, :string field :purchased_at, :utc_datetime field :cover_hash, :string field :release_ids, {:array, :string}, default: [] diff --git a/lib/music_library_web/components/add_record_component.ex b/lib/music_library_web/components/add_record_component.ex index 0544da6b..62beb5a1 100644 --- a/lib/music_library_web/components/add_record_component.ex +++ b/lib/music_library_web/components/add_record_component.ex @@ -81,7 +81,9 @@ defmodule MusicLibraryWeb.AddRecordComponent do {@release_group.title}
- {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 + )}
- {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 )}
diff --git a/lib/music_library_web/components/form_component.ex b/lib/music_library_web/components/form_component.ex index f6029caa..b393a65c 100644 --- a/lib/music_library_web/components/form_component.ex +++ b/lib/music_library_web/components/form_component.ex @@ -56,7 +56,7 @@ defmodule MusicLibraryWeb.FormComponent do label={gettext("MusicBrainz ID")} />- {Records.Record.format_release(record.release)} + {Records.Record.format_release_date(record.release_date)} ({gettext("Unreleased")}) @@ -271,7 +271,7 @@ defmodule MusicLibraryWeb.RecordComponents do {format_label(record.format)} · {type_label(record.type)}
- {Records.Record.format_release(record.release)} + {Records.Record.format_release_date(record.release_date)}
diff --git a/lib/music_library_web/live/artist_live/show.ex b/lib/music_library_web/live/artist_live/show.ex index eab806b3..65c2ce18 100644 --- a/lib/music_library_web/live/artist_live/show.ex +++ b/lib/music_library_web/live/artist_live/show.ex @@ -125,8 +125,8 @@ defmodule MusicLibraryWeb.ArtistLive.Show do {collection, wishlist} = Enum.split_with(records, fn r -> r.purchased_at end) %{ - collection: Enum.sort_by(collection, fn r -> r.release end, :desc), - wishlist: Enum.sort_by(wishlist, 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_date end, :desc) } end diff --git a/lib/music_library_web/live/collection_live/show.html.heex b/lib/music_library_web/live/collection_live/show.html.heex index 0986d8f6..7b749278 100644 --- a/lib/music_library_web/live/collection_live/show.html.heex +++ b/lib/music_library_web/live/collection_live/show.html.heex @@ -22,7 +22,7 @@ {@record.title}- {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 )}
diff --git a/lib/music_library_web/live/wishlist_live/show.html.heex b/lib/music_library_web/live/wishlist_live/show.html.heex index c49aa47b..e4352011 100644 --- a/lib/music_library_web/live/wishlist_live/show.html.heex +++ b/lib/music_library_web/live/wishlist_live/show.html.heex @@ -22,7 +22,7 @@ {@record.title}- {Records.Record.format_release(@record.release)} + {Records.Record.format_release_date(@record.release_date)} ({gettext("Unreleased")}) diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 1b274eff..ddf2e017 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -175,11 +175,6 @@ msgstr "" msgid "Record updated successfully" msgstr "" -#: lib/music_library_web/components/form_component.ex -#, elixir-autogen, elixir-format -msgid "Release" -msgstr "" - #: lib/music_library_web/components/form_component.ex #, elixir-autogen, elixir-format msgid "Save" @@ -742,3 +737,8 @@ msgstr "" #, 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 "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po new file mode 100644 index 00000000..a1525dcf --- /dev/null +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -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 %{visible} of %{total} 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 "" diff --git a/priv/repo/migrations/20250501081635_rename_records_release_to_release_date.exs b/priv/repo/migrations/20250501081635_rename_records_release_to_release_date.exs new file mode 100644 index 00000000..1e0dc1ef --- /dev/null +++ b/priv/repo/migrations/20250501081635_rename_records_release_to_release_date.exs @@ -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 diff --git a/test/music_library/barcode_scan/result_test.exs b/test/music_library/barcode_scan/result_test.exs index 50f57a2d..47efdea3 100644 --- a/test/music_library/barcode_scan/result_test.exs +++ b/test/music_library/barcode_scan/result_test.exs @@ -9,7 +9,7 @@ defmodule MusicLibrary.BarcodeScan.ResultTest do type: :album, title: "Test Release Group", artists: ["Test Artist"], - release: "2021-01-01" + release_date: "2021-01-01" } @release %ReleaseSearchResult{ diff --git a/test/music_library/records/record_test.exs b/test/music_library/records/record_test.exs index 6e94f7a7..4cc0ed99 100644 --- a/test/music_library/records/record_test.exs +++ b/test/music_library/records/record_test.exs @@ -16,26 +16,26 @@ defmodule MusicLibrary.Records.RecordTest do test "returns true if the record has a release date in the past", %{ current_date: current_date } do - record = %Record{release: "2024-01-01"} + record = %Record{release_date: "2024-01-01"} assert Record.released?(record, current_date) end test "returns false if the record has a release date in the future", %{ current_date: current_date } do - record = %Record{release: "2025-02-01"} + record = %Record{release_date: "2025-02-01"} refute Record.released?(record, current_date) end 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) end test "it returns true if the release date is not precise enough", %{ current_date: current_date } do - record = %Record{release: "2019"} + record = %Record{release_date: "2019"} assert Record.released?(record, current_date) end end @@ -54,28 +54,28 @@ defmodule MusicLibrary.Records.RecordTest do id: "749c07b5-4900-404b-bea9-bb6b16fa991e", type: :other, title: "Claustrophobic Universe", - release: "2021-04-23", + release_date: "2021-04-23", artists: "Mariusz Duda" }, %MusicBrainz.ReleaseGroupSearchResult{ id: "61077431-0057-4119-8f06-0df1098d21e5", type: :other, title: "Interior Drawings", - release: "2021-12-10", + release_date: "2021-12-10", artists: "Mariusz Duda" }, %MusicBrainz.ReleaseGroupSearchResult{ id: "c36123e3-8899-48a5-8196-9dbb72421d69", type: :other, title: "Let’s Meet Outside", - release: "2022-05-20", + release_date: "2022-05-20", artists: "Mariusz Duda" }, %MusicBrainz.ReleaseGroupSearchResult{ id: "d463f2b1-d254-4baf-a957-fb78c6e5b956", type: :other, title: "Lockdown Spaces", - release: "2020-06-26", + release_date: "2020-06-26", artists: "Mariusz Duda" } ] diff --git a/test/music_library_web/live/collection_live/index_test.exs b/test/music_library_web/live/collection_live/index_test.exs index 09020fd2..141df8f5 100644 --- a/test/music_library_web/live/collection_live/index_test.exs +++ b/test/music_library_web/live/collection_live/index_test.exs @@ -49,7 +49,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do session |> assert_has("#records-#{record.id}") |> 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: type_label(record.type)) |> assert_has("#records-#{record.id} span", @@ -134,7 +134,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do session |> assert_has("#records-#{record.id}") |> 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: type_label(record.type)) |> assert_has("#records-#{record.id} span", @@ -176,7 +176,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do session |> assert_has("#records-#{record.id}") |> 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: type_label(record.type)) |> assert_has("#records-#{record.id} span", @@ -277,7 +277,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do session |> assert_has("h1", text: result.artists) |> 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 session = @@ -288,7 +288,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do assert record.musicbrainz_id == first_release_group_search_result_id assert record.title == "Marbles" - assert record.release == "2004-05-03" + assert record.release_date == "2004-05-03" assert record.format == :cd assert record.musicbrainz_data == release_group @@ -392,7 +392,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do assert record.musicbrainz_id == release_group_id assert record.title == "Marbles" - assert record.release == "2004-05-03" + assert record.release_date == "2004-05-03" assert record.format == :cd assert record.musicbrainz_data == release_group diff --git a/test/music_library_web/live/collection_live/show_test.exs b/test/music_library_web/live/collection_live/show_test.exs index 83c14f72..2cf4172d 100644 --- a/test/music_library_web/live/collection_live/show_test.exs +++ b/test/music_library_web/live/collection_live/show_test.exs @@ -26,7 +26,7 @@ defmodule MusicLibraryWeb.CollectionLive.ShowTest do conn |> visit(~p"/collection/#{record.id}") |> 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: type_label(record.type)) |> assert_has("dd", text: Record.format_as_date(record.purchased_at)) diff --git a/test/music_library_web/live/wishlist_live/show_test.exs b/test/music_library_web/live/wishlist_live/show_test.exs index cc27d832..fbb6e0f4 100644 --- a/test/music_library_web/live/wishlist_live/show_test.exs +++ b/test/music_library_web/live/wishlist_live/show_test.exs @@ -26,7 +26,7 @@ defmodule MusicLibraryWeb.WishlistLive.ShowTest do conn |> visit(~p"/wishlist/#{record.id}") |> 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: type_label(record.type)) |> assert_has("dd", text: record.id) diff --git a/test/support/fixtures/music_library/records.ex b/test/support/fixtures/music_library/records.ex index 01215daf..8e3d7137 100644 --- a/test/support/fixtures/music_library/records.ex +++ b/test/support/fixtures/music_library/records.ex @@ -66,7 +66,7 @@ defmodule MusicLibrary.Fixtures.Records do title: Enum.random(@titles), type: :album, 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, artists: [artist_attrs(artist_name)] })