diff --git a/lib/mix/tasks/music_brainz/refresh_fixtures.ex b/lib/mix/tasks/music_brainz/refresh_fixtures.ex new file mode 100644 index 00000000..bfb4c9d1 --- /dev/null +++ b/lib/mix/tasks/music_brainz/refresh_fixtures.ex @@ -0,0 +1,59 @@ +defmodule Mix.Tasks.MusicBrainz.RefreshFixtures do + use Mix.Task + + @shortdoc "Fetch and recreate test fixtures that depend on network resources." + @moduledoc """ + Fetch and recreate test fixtures that depend on network resources. + """ + + require Logger + + @fixtures_folder Path.join([File.cwd!(), "test/support/fixtures"]) + + @fixture_files %{ + "release_group.json" => + "https://musicbrainz.org/ws/2/release-group/20790e26-98e4-3ad3-a67f-b674758b942d?fmt=json&inc=artists+genres+releases+release-group-rels", + "release.json" => + "https://musicbrainz.org/ws/2/release/0e290154-5375-4f4f-a658-4a92bf02faa5?fmt=json&inc=release-groups" + } + + @impl Mix.Task + def run(_args) do + Application.ensure_all_started(:finch) + Finch.start_link(name: __MODULE__) + + Enum.each(@fixture_files, fn {filename, url} -> + case get(url) do + {:ok, body} -> + File.write!(Path.join(@fixtures_folder, filename), body) + + {:error, msg} -> + Logger.error(msg) + end + end) + end + + defp get(url) do + req = + Finch.build(:get, url, [ + {"User-Agent", "MusicLibrary/0.1.0 ( cloud8421@gmail.com )"} + ]) + + Logger.debug("Fetching data from #{url}") + + case Finch.request(req, __MODULE__) do + {:ok, response} when response.status == 200 -> + {:ok, response.body} + + {:ok, response} when response.status in 301..308 -> + location = :proplists.get_value("location", response.headers) + Logger.debug("Following redirect to #{location}") + get(location) + + other -> + msg = "Failed to fetch data from #{url}, reason: #{inspect(other)}" + Logger.error(msg) + {:error, msg} + end + end +end diff --git a/test/support/fixtures/release.json b/test/support/fixtures/release.json new file mode 100644 index 00000000..66e39217 --- /dev/null +++ b/test/support/fixtures/release.json @@ -0,0 +1 @@ +{"title":"Marbles","quality":"normal","country":"XE","release-group":{"first-release-date":"2004-05-03","secondary-types":[],"title":"Marbles","id":"20790e26-98e4-3ad3-a67f-b674758b942d","primary-type-id":"f529b476-6e62-324f-b0aa-1f3e33d313fc","disambiguation":"","secondary-type-ids":[],"primary-type":"Album"},"cover-art-archive":{"count":0,"back":false,"front":false,"darkened":false,"artwork":false},"asin":null,"packaging":"Jewel Case","id":"0e290154-5375-4f4f-a658-4a92bf02faa5","barcode":"","status-id":"4e304316-386d-3409-af2e-78857eec5cfe","release-events":[{"date":"2004-05-03","area":{"id":"89a675c2-3e37-3518-b83c-418bad59a85a","name":"Europe","type-id":null,"sort-name":"Europe","iso-3166-1-codes":["XE"],"type":null,"disambiguation":""}}],"disambiguation":"non‐deluxe double CD with o‐card","status":"Official","date":"2004-05-03","text-representation":{"script":"Latn","language":"eng"},"packaging-id":"ec27701a-4a22-37f4-bfac-6616e0f9750a"} \ No newline at end of file diff --git a/test/support/fixtures/release_group.json b/test/support/fixtures/release_group.json new file mode 100644 index 00000000..bfa9c5f6 --- /dev/null +++ b/test/support/fixtures/release_group.json @@ -0,0 +1 @@ +{"title":"Marbles","relations":[{"end":null,"target-type":"release_group","type-id":"fcf680a9-6871-4519-8c4b-8c6549575b35","attributes":[],"direction":"backward","begin":null,"release_group":{"secondary-types":[],"primary-type-id":null,"id":"ea42b213-0502-391b-bb51-e2ef6315b300","secondary-type-ids":[],"disambiguation":"","first-release-date":"2005-06","title":"A Handful of Marbles","releases":[],"primary-type":null,"artist-credit":[{"name":"Marillion","joinphrase":"","artist":{"name":"Marillion","type-id":null,"sort-name":"Marillion","type":null,"disambiguation":"British progressive rock band","id":"1932f5b6-0b7b-4050-b1df-833ca89e5f44"}}]},"target-credit":"","type":"single from","source-credit":"","attribute-values":{},"attribute-ids":{},"ended":false},{"attribute-values":{},"source-credit":"","type":"single from","target-credit":"","attribute-ids":{},"ended":false,"target-type":"release_group","end":null,"release_group":{"artist-credit":[{"name":"Marillion","joinphrase":"","artist":{"type-id":null,"sort-name":"Marillion","name":"Marillion","id":"1932f5b6-0b7b-4050-b1df-833ca89e5f44","type":null,"disambiguation":"British progressive rock band"}}],"primary-type":null,"releases":[],"title":"Don’t Hurt Yourself","first-release-date":"2004-07-12","disambiguation":"","secondary-type-ids":[],"id":"46d750b1-e53b-32b6-8f32-5cf78b23667b","primary-type-id":null,"secondary-types":[]},"attributes":[],"type-id":"fcf680a9-6871-4519-8c4b-8c6549575b35","begin":null,"direction":"backward"},{"release_group":{"title":"You’re Gone","artist-credit":[{"artist":{"id":"1932f5b6-0b7b-4050-b1df-833ca89e5f44","type":null,"disambiguation":"British progressive rock band","type-id":null,"sort-name":"Marillion","name":"Marillion"},"name":"Marillion","joinphrase":""}],"primary-type":null,"releases":[],"id":"2aec590d-e18e-3043-bec4-eef3dfd1eefd","primary-type-id":null,"secondary-types":[],"first-release-date":"2004-04-19","disambiguation":"","secondary-type-ids":[]},"attributes":[],"type-id":"fcf680a9-6871-4519-8c4b-8c6549575b35","direction":"backward","begin":null,"target-type":"release_group","end":null,"attribute-ids":{},"ended":false,"source-credit":"","attribute-values":{},"type":"single from","target-credit":""}],"secondary-types":[],"genres":[{"id":"ceeaa283-5d7b-4202-8d1d-e25d116b2a18","count":1,"name":"alternative rock","disambiguation":""},{"count":1,"id":"b7ef058e-6d83-4ca4-8123-9724bff4648b","disambiguation":"","name":"art rock"},{"count":1,"id":"150eb95a-7739-4fde-a5fe-b62ca576a928","name":"baroque pop","disambiguation":""},{"name":"pop rock","disambiguation":"","count":1,"id":"797e2e85-5ffd-495c-a757-8b4079052f0e"},{"count":2,"id":"ae9b8279-3959-48d8-8a88-741a7f6d4a48","disambiguation":"","name":"progressive rock"},{"count":1,"id":"2aeb5340-c474-4677-b9a6-35ddac9b6a58","name":"psychedelic pop","disambiguation":""},{"id":"0e3fc579-2d24-4f20-9dae-736e1ec78798","count":2,"name":"rock","disambiguation":""}],"first-release-date":"2004-05-03","artist-credit":[{"artist":{"name":"Marillion","type-id":"e431f5f6-b5d2-343d-8b36-72607fffb74b","sort-name":"Marillion","disambiguation":"British progressive rock band","type":"Group","genres":[{"name":"progressive rock","disambiguation":"","count":10,"id":"ae9b8279-3959-48d8-8a88-741a7f6d4a48"}],"id":"1932f5b6-0b7b-4050-b1df-833ca89e5f44"},"name":"Marillion","joinphrase":""}],"primary-type":"Album","releases":[{"barcode":"","packaging":"Jewel Case","release-events":[{"area":{"name":"Europe","type-id":null,"sort-name":"Europe","disambiguation":"","type":null,"id":"89a675c2-3e37-3518-b83c-418bad59a85a","iso-3166-1-codes":["XE"]},"date":"2004-05-03"}],"id":"0e290154-5375-4f4f-a658-4a92bf02faa5","text-representation":{"language":"eng","script":"Latn"},"disambiguation":"non‐deluxe double CD with o‐card","country":"XE","title":"Marbles","status-id":"4e304316-386d-3409-af2e-78857eec5cfe","status":"Official","quality":"normal","genres":[],"packaging-id":"ec27701a-4a22-37f4-bfac-6616e0f9750a","date":"2004-05-03"},{"id":"3f1cc80f-4507-48a9-899c-c1bda83280c2","text-representation":{"script":"Latn","language":"eng"},"disambiguation":"limited deluxe campaign edition","barcode":"","packaging":"Other","release-events":[{"date":"2004-05-03","area":{"type":null,"disambiguation":"","id":"8a754a16-0027-3a29-b6d7-2b40ea0481ed","iso-3166-1-codes":["GB"],"name":"United Kingdom","type-id":null,"sort-name":"United Kingdom"}}],"quality":"normal","genres":[],"packaging-id":"815b7785-8284-3926-8f04-e48bc6c4d102","date":"2004-05-03","country":"GB","title":"Marbles","status-id":"4e304316-386d-3409-af2e-78857eec5cfe","status":"Official"},{"status-id":"4e304316-386d-3409-af2e-78857eec5cfe","title":"Marbles","country":"GB","status":"Official","quality":"normal","date":"2004-05-03","packaging-id":"ec27701a-4a22-37f4-bfac-6616e0f9750a","genres":[],"packaging":"Jewel Case","barcode":"5037300650128","release-events":[{"date":"2004-05-03","area":{"type-id":null,"sort-name":"United Kingdom","name":"United Kingdom","iso-3166-1-codes":["GB"],"id":"8a754a16-0027-3a29-b6d7-2b40ea0481ed","disambiguation":"","type":null}}],"id":"d3f9b9e2-73f5-4b47-a2a7-2c2199aad608","disambiguation":"","text-representation":{"language":"eng","script":"Latn"}},{"date":"2004","packaging-id":"ec27701a-4a22-37f4-bfac-6616e0f9750a","genres":[],"quality":"normal","status":"Bootleg","status-id":"1156806e-d06a-38bd-83f0-cf2284a808b9","title":"Marbles","country":"RU","disambiguation":"","text-representation":{"script":"Latn","language":"eng"},"id":"2c4ecd84-7a84-4f42-a600-2f00ed8978c9","release-events":[{"date":"2004","area":{"id":"1f1fc3a4-9500-39b8-9f10-f0a465557eef","iso-3166-1-codes":["RU"],"disambiguation":"","type":null,"sort-name":"Russia","type-id":null,"name":"Russia"}}],"packaging":"Jewel Case","barcode":""},{"genres":[],"packaging-id":null,"date":"2004","quality":"normal","status":"Official","country":"US","title":"Marbles","status-id":"4e304316-386d-3409-af2e-78857eec5cfe","text-representation":{"language":"eng","script":"Latn"},"disambiguation":"","id":"ab151aa6-7538-4e93-be60-eded52b5b7b7","release-events":[{"date":"2004","area":{"type":null,"disambiguation":"","iso-3166-1-codes":["US"],"id":"489ce91b-6658-3307-9877-795b68554c98","name":"United States","type-id":null,"sort-name":"United States"}}],"barcode":"803341127920","packaging":null},{"status-id":"4e304316-386d-3409-af2e-78857eec5cfe","country":"GB","title":"Marbles","status":"Official","quality":"normal","date":"2011-04-25","genres":[],"packaging-id":"f7101ce3-0384-39ce-9fde-fbbd0044d35f","packaging":"Cardboard/Paper Sleeve","barcode":"636551597210","release-events":[{"area":{"type-id":null,"sort-name":"United Kingdom","name":"United Kingdom","iso-3166-1-codes":["GB"],"id":"8a754a16-0027-3a29-b6d7-2b40ea0481ed","type":null,"disambiguation":""},"date":"2011-04-25"}],"id":"b94bbd1f-ae5d-4e7b-98ff-28bfe135f20c","disambiguation":"","text-representation":{"script":"Latn","language":"eng"}},{"barcode":"636551597227","packaging":"Digibook","release-events":[{"area":{"type-id":null,"sort-name":"United Kingdom","name":"United Kingdom","id":"8a754a16-0027-3a29-b6d7-2b40ea0481ed","iso-3166-1-codes":["GB"],"type":null,"disambiguation":""},"date":"2011-04-25"}],"id":"4b9fe13b-4837-4c02-9368-e97ba6f5a086","text-representation":{"language":"eng","script":"Latn"},"disambiguation":"","title":"Marbles","country":"GB","status-id":"4e304316-386d-3409-af2e-78857eec5cfe","status":"Official","quality":"normal","packaging-id":"9f2e13bc-f84f-428a-8342-fd86ece7fc4d","genres":[],"date":"2011-04-25"},{"genres":[],"packaging-id":"815b7785-8284-3926-8f04-e48bc6c4d102","date":"2017","quality":"normal","status":"Official","country":"XE","title":"Marbles","status-id":"4e304316-386d-3409-af2e-78857eec5cfe","text-representation":{"script":"Latn","language":"eng"},"disambiguation":"","id":"a4b02377-0b5e-448e-9cd6-5500c0378523","release-events":[{"area":{"name":"Europe","type-id":null,"sort-name":"Europe","disambiguation":"","type":null,"id":"89a675c2-3e37-3518-b83c-418bad59a85a","iso-3166-1-codes":["XE"]},"date":"2017"}],"barcode":"636551808613","packaging":"Other"},{"quality":"normal","date":"","genres":[],"packaging-id":"119eba76-b343-3e02-a292-f0f00644bb9b","status-id":"4e304316-386d-3409-af2e-78857eec5cfe","country":"XW","title":"Marbles","status":"Official","id":"f3937bc5-b99f-443a-9609-a404201f21ca","disambiguation":"","text-representation":{"script":"Latn","language":"eng"},"packaging":"None","barcode":"859724565117","release-events":[{"date":"","area":{"disambiguation":"","type":null,"id":"525d4e18-3d00-31b9-a58b-a146a916de8f","iso-3166-1-codes":["XW"],"name":"[Worldwide]","type-id":null,"sort-name":"[Worldwide]"}}]}],"primary-type-id":"f529b476-6e62-324f-b0aa-1f3e33d313fc","id":"20790e26-98e4-3ad3-a67f-b674758b942d","secondary-type-ids":[],"disambiguation":""} \ No newline at end of file diff --git a/test/support/fixtures/release_groups_fixtures.ex b/test/support/fixtures/release_groups_fixtures.ex index 99d85fe0..358125d1 100644 --- a/test/support/fixtures/release_groups_fixtures.ex +++ b/test/support/fixtures/release_groups_fixtures.ex @@ -1,4 +1,6 @@ defmodule MusicLibrary.ReleaseGroupsFixtures do + @fixtures_folder Path.join([File.cwd!(), "test/support/fixtures"]) + def release_group_search_results do [ %{ @@ -23,345 +25,9 @@ defmodule MusicLibrary.ReleaseGroupsFixtures do end def release_group do - %{ - "artist-credit" => [ - %{ - "artist" => %{ - "disambiguation" => "British progressive rock band", - "genres" => [ - %{ - "count" => 10, - "disambiguation" => "", - "id" => "ae9b8279-3959-48d8-8a88-741a7f6d4a48", - "name" => "progressive rock" - } - ], - "id" => "1932f5b6-0b7b-4050-b1df-833ca89e5f44", - "name" => "Marillion", - "sort-name" => "Marillion", - "type" => "Group", - "type-id" => "e431f5f6-b5d2-343d-8b36-72607fffb74b" - }, - "joinphrase" => "", - "name" => "Marillion" - } - ], - "disambiguation" => "", - "first-release-date" => "2004-05-03", - "genres" => [ - %{ - "count" => 1, - "disambiguation" => "", - "id" => "ceeaa283-5d7b-4202-8d1d-e25d116b2a18", - "name" => "alternative rock" - }, - %{ - "count" => 1, - "disambiguation" => "", - "id" => "b7ef058e-6d83-4ca4-8123-9724bff4648b", - "name" => "art rock" - }, - %{ - "count" => 1, - "disambiguation" => "", - "id" => "150eb95a-7739-4fde-a5fe-b62ca576a928", - "name" => "baroque pop" - }, - %{ - "count" => 1, - "disambiguation" => "", - "id" => "797e2e85-5ffd-495c-a757-8b4079052f0e", - "name" => "pop rock" - }, - %{ - "count" => 2, - "disambiguation" => "", - "id" => "ae9b8279-3959-48d8-8a88-741a7f6d4a48", - "name" => "progressive rock" - }, - %{ - "count" => 1, - "disambiguation" => "", - "id" => "2aeb5340-c474-4677-b9a6-35ddac9b6a58", - "name" => "psychedelic pop" - }, - %{ - "count" => 2, - "disambiguation" => "", - "id" => "0e3fc579-2d24-4f20-9dae-736e1ec78798", - "name" => "rock" - } - ], - "id" => "20790e26-98e4-3ad3-a67f-b674758b942d", - "primary-type" => "Album", - "primary-type-id" => "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "releases" => [ - %{ - "barcode" => "", - "country" => "XE", - "date" => "2004-05-03", - "disambiguation" => "non‐deluxe double CD with o‐card", - "genres" => [], - "id" => "0e290154-5375-4f4f-a658-4a92bf02faa5", - "packaging" => "Jewel Case", - "packaging-id" => "ec27701a-4a22-37f4-bfac-6616e0f9750a", - "quality" => "normal", - "release-events" => [ - %{ - "area" => %{ - "disambiguation" => "", - "id" => "89a675c2-3e37-3518-b83c-418bad59a85a", - "iso-3166-1-codes" => ["XE"], - "name" => "Europe", - "sort-name" => "Europe", - "type" => nil, - "type-id" => nil - }, - "date" => "2004-05-03" - } - ], - "status" => "Official", - "status-id" => "4e304316-386d-3409-af2e-78857eec5cfe", - "text-representation" => %{"language" => "eng", "script" => "Latn"}, - "title" => "Marbles" - }, - %{ - "barcode" => "", - "country" => "GB", - "date" => "2004-05-03", - "disambiguation" => "limited deluxe campaign edition", - "genres" => [], - "id" => "3f1cc80f-4507-48a9-899c-c1bda83280c2", - "packaging" => "Other", - "packaging-id" => "815b7785-8284-3926-8f04-e48bc6c4d102", - "quality" => "normal", - "release-events" => [ - %{ - "area" => %{ - "disambiguation" => "", - "id" => "8a754a16-0027-3a29-b6d7-2b40ea0481ed", - "iso-3166-1-codes" => ["GB"], - "name" => "United Kingdom", - "sort-name" => "United Kingdom", - "type" => nil, - "type-id" => nil - }, - "date" => "2004-05-03" - } - ], - "status" => "Official", - "status-id" => "4e304316-386d-3409-af2e-78857eec5cfe", - "text-representation" => %{"language" => "eng", "script" => "Latn"}, - "title" => "Marbles" - }, - %{ - "barcode" => "5037300650128", - "country" => "GB", - "date" => "2004-05-03", - "disambiguation" => "", - "genres" => [], - "id" => "d3f9b9e2-73f5-4b47-a2a7-2c2199aad608", - "packaging" => "Jewel Case", - "packaging-id" => "ec27701a-4a22-37f4-bfac-6616e0f9750a", - "quality" => "normal", - "release-events" => [ - %{ - "area" => %{ - "disambiguation" => "", - "id" => "8a754a16-0027-3a29-b6d7-2b40ea0481ed", - "iso-3166-1-codes" => ["GB"], - "name" => "United Kingdom", - "sort-name" => "United Kingdom", - "type" => nil, - "type-id" => nil - }, - "date" => "2004-05-03" - } - ], - "status" => "Official", - "status-id" => "4e304316-386d-3409-af2e-78857eec5cfe", - "text-representation" => %{"language" => "eng", "script" => "Latn"}, - "title" => "Marbles" - }, - %{ - "barcode" => "", - "country" => "RU", - "date" => "2004", - "disambiguation" => "", - "genres" => [], - "id" => "2c4ecd84-7a84-4f42-a600-2f00ed8978c9", - "packaging" => "Jewel Case", - "packaging-id" => "ec27701a-4a22-37f4-bfac-6616e0f9750a", - "quality" => "normal", - "release-events" => [ - %{ - "area" => %{ - "disambiguation" => "", - "id" => "1f1fc3a4-9500-39b8-9f10-f0a465557eef", - "iso-3166-1-codes" => ["RU"], - "name" => "Russia", - "sort-name" => "Russia", - "type" => nil, - "type-id" => nil - }, - "date" => "2004" - } - ], - "status" => "Bootleg", - "status-id" => "1156806e-d06a-38bd-83f0-cf2284a808b9", - "text-representation" => %{"language" => "eng", "script" => "Latn"}, - "title" => "Marbles" - }, - %{ - "barcode" => "803341127920", - "country" => "US", - "date" => "2004", - "disambiguation" => "", - "genres" => [], - "id" => "ab151aa6-7538-4e93-be60-eded52b5b7b7", - "packaging" => nil, - "packaging-id" => nil, - "quality" => "normal", - "release-events" => [ - %{ - "area" => %{ - "disambiguation" => "", - "id" => "489ce91b-6658-3307-9877-795b68554c98", - "iso-3166-1-codes" => ["US"], - "name" => "United States", - "sort-name" => "United States", - "type" => nil, - "type-id" => nil - }, - "date" => "2004" - } - ], - "status" => "Official", - "status-id" => "4e304316-386d-3409-af2e-78857eec5cfe", - "text-representation" => %{"language" => "eng", "script" => "Latn"}, - "title" => "Marbles" - }, - %{ - "barcode" => "636551597210", - "country" => "GB", - "date" => "2011-04-25", - "disambiguation" => "", - "genres" => [], - "id" => "b94bbd1f-ae5d-4e7b-98ff-28bfe135f20c", - "packaging" => "Cardboard/Paper Sleeve", - "packaging-id" => "f7101ce3-0384-39ce-9fde-fbbd0044d35f", - "quality" => "normal", - "release-events" => [ - %{ - "area" => %{ - "disambiguation" => "", - "id" => "8a754a16-0027-3a29-b6d7-2b40ea0481ed", - "iso-3166-1-codes" => ["GB"], - "name" => "United Kingdom", - "sort-name" => "United Kingdom", - "type" => nil, - "type-id" => nil - }, - "date" => "2011-04-25" - } - ], - "status" => "Official", - "status-id" => "4e304316-386d-3409-af2e-78857eec5cfe", - "text-representation" => %{"language" => "eng", "script" => "Latn"}, - "title" => "Marbles" - }, - %{ - "barcode" => "636551597227", - "country" => "GB", - "date" => "2011-04-25", - "disambiguation" => "", - "genres" => [], - "id" => "4b9fe13b-4837-4c02-9368-e97ba6f5a086", - "packaging" => "Digibook", - "packaging-id" => "9f2e13bc-f84f-428a-8342-fd86ece7fc4d", - "quality" => "normal", - "release-events" => [ - %{ - "area" => %{ - "disambiguation" => "", - "id" => "8a754a16-0027-3a29-b6d7-2b40ea0481ed", - "iso-3166-1-codes" => ["GB"], - "name" => "United Kingdom", - "sort-name" => "United Kingdom", - "type" => nil, - "type-id" => nil - }, - "date" => "2011-04-25" - } - ], - "status" => "Official", - "status-id" => "4e304316-386d-3409-af2e-78857eec5cfe", - "text-representation" => %{"language" => "eng", "script" => "Latn"}, - "title" => "Marbles" - }, - %{ - "barcode" => "636551808613", - "country" => "XE", - "date" => "2017", - "disambiguation" => "", - "genres" => [], - "id" => "a4b02377-0b5e-448e-9cd6-5500c0378523", - "packaging" => "Other", - "packaging-id" => "815b7785-8284-3926-8f04-e48bc6c4d102", - "quality" => "normal", - "release-events" => [ - %{ - "area" => %{ - "disambiguation" => "", - "id" => "89a675c2-3e37-3518-b83c-418bad59a85a", - "iso-3166-1-codes" => ["XE"], - "name" => "Europe", - "sort-name" => "Europe", - "type" => nil, - "type-id" => nil - }, - "date" => "2017" - } - ], - "status" => "Official", - "status-id" => "4e304316-386d-3409-af2e-78857eec5cfe", - "text-representation" => %{"language" => "eng", "script" => "Latn"}, - "title" => "Marbles" - }, - %{ - "barcode" => "859724565117", - "country" => "XW", - "date" => "", - "disambiguation" => "", - "genres" => [], - "id" => "f3937bc5-b99f-443a-9609-a404201f21ca", - "packaging" => "None", - "packaging-id" => "119eba76-b343-3e02-a292-f0f00644bb9b", - "quality" => "normal", - "release-events" => [ - %{ - "area" => %{ - "disambiguation" => "", - "id" => "525d4e18-3d00-31b9-a58b-a146a916de8f", - "iso-3166-1-codes" => ["XW"], - "name" => "[Worldwide]", - "sort-name" => "[Worldwide]", - "type" => nil, - "type-id" => nil - }, - "date" => "" - } - ], - "status" => "Official", - "status-id" => "4e304316-386d-3409-af2e-78857eec5cfe", - "text-representation" => %{"language" => "eng", "script" => "Latn"}, - "title" => "Marbles" - } - ], - "secondary-type-ids" => [], - "secondary-types" => [], - "title" => "Marbles" - } + Path.join([@fixtures_folder, "release_group.json"]) + |> File.read!() + |> Jason.decode!() end def release_id do @@ -369,51 +35,8 @@ defmodule MusicLibrary.ReleaseGroupsFixtures do end def release do - %{ - "asin" => nil, - "barcode" => "", - "country" => "XE", - "cover-art-archive" => %{ - "artwork" => false, - "back" => false, - "count" => 0, - "darkened" => false, - "front" => false - }, - "date" => "2004-05-03", - "disambiguation" => "non‐deluxe double CD with o‐card", - "id" => "0e290154-5375-4f4f-a658-4a92bf02faa5", - "packaging" => "Jewel Case", - "packaging-id" => "ec27701a-4a22-37f4-bfac-6616e0f9750a", - "quality" => "normal", - "release-events" => [ - %{ - "area" => %{ - "disambiguation" => "", - "id" => "89a675c2-3e37-3518-b83c-418bad59a85a", - "iso-3166-1-codes" => ["XE"], - "name" => "Europe", - "sort-name" => "Europe", - "type" => nil, - "type-id" => nil - }, - "date" => "2004-05-03" - } - ], - "release-group" => %{ - "disambiguation" => "", - "first-release-date" => "2004-05-03", - "id" => "20790e26-98e4-3ad3-a67f-b674758b942d", - "primary-type" => "Album", - "primary-type-id" => "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "secondary-type-ids" => [], - "secondary-types" => [], - "title" => "Marbles" - }, - "status" => "Official", - "status-id" => "4e304316-386d-3409-af2e-78857eec5cfe", - "text-representation" => %{"language" => "eng", "script" => "Latn"}, - "title" => "Marbles" - } + Path.join([@fixtures_folder, "release.json"]) + |> File.read!() + |> Jason.decode!() end end