diff --git a/example cdstub json.json b/example cdstub json.json deleted file mode 100644 index 620a03e..0000000 --- a/example cdstub json.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "created": "2025-04-11T00:28:16.657Z", - "count": 76474, - "offset": 0, - "cdstubs": [ - { - "id": "hU2FJcnlVtratcrOn9rAhPzzCMo-", - "score": 100, - "count": 8, - "title": "Songs From The Big Chair", - "artist": "Tears For Fears", - "barcode": "042282430021" - }, - { - "id": "xVi83ZdOL7GX8FO7dxF9ti2Lzbk-", - "score": 100, - "count": 8, - "title": "Songs From The Big Chair", - "artist": "Tears For Fears", - "barcode": "" - }, - { - "id": ".ycXLR2CzQVukjwAvD_qgp7U3FI-", - "score": 46, - "count": 13, - "title": "Songs From A Yellow Chair", - "artist": "Brendan Devereux", - "barcode": "5392000022416", - "disambiguation": "CD Baby id:bdevereux" - }, - { - "id": "zuTQI.tG80P_djHrJq7McHi7I_s-", - "score": 41, - "count": 10, - "title": "Songs from the big house", - "artist": "The Hushpuppies Band", - "barcode": "", - "disambiguation": "CD Baby id:hushpuppies" - }, - { - "id": "dCGMCb7HUKpxANsfs4Dyp9iWqIg-", - "score": 41, - "count": 10, - "title": "Songs From The Big Martin", - "artist": "Rob Berretta", - "barcode": "783707114200", - "disambiguation": "CD Baby id:robberretta" - }, - { - "id": "ibRD5gD6LEbhT5seZwZB7xnnOmA-", - "score": 40, - "count": 30, - "title": "Songs From Under The Big Top", - "artist": "Jojo's Circus", - "barcode": "" - }, - { - "id": "zn6WneZCL2JN_9Imv6kuGFtJbNM-", - "score": 39, - "count": 19, - "title": "Songs From the Big Hat: a Community Helper Album", - "artist": "Geof Johnson", - "barcode": "", - "disambiguation": "CD Baby id:geofjohnson" - }, - { - "id": "c8dIwn.EcofZDz5Ou0dNt2q_A_Y-", - "score": 39, - "count": 13, - "title": "Songs From The Big Tent", - "artist": "Cowboys & Indians W/ Eddie Cunningham", - "barcode": "634479274619", - "disambiguation": "CD Baby id:ecunningham4" - }, - { - "id": "C_0ayMV8.KJ6XAoiS2A.1EGqdR4-", - "score": 39, - "count": 16, - "title": "From the chair", - "artist": "Melodic", - "barcode": "634479075902", - "disambiguation": "CD Baby id:melodic" - }, - { - "id": "dyWmDcXrrOuRajKNdkK6QvOnaqQ-", - "score": 39, - "count": 24, - "title": "Songs from Jim Henson's Bear in the Big Blue House", - "artist": "Jim Henson", - "barcode": "724352785421" - }, - { - "id": "_nL7a3y9gP1xM7MVbLTCnGSwTzo-", - "score": 38, - "count": 11, - "title": "From the Second Chair", - "artist": "Evan McHugh", - "barcode": "677516570923", - "disambiguation": "CD Baby id:evanmchugh" - }, - { - "id": "cWAE4p4cIBuIwrDQMhAxk.lMpDI-", - "score": 38, - "count": 13, - "title": "On the River Road - Songs from the Big Bend", - "artist": "Joe Kuban and the Lost Chizo Band", - "barcode": "" - }, - { - "id": "EB7cRXX2X468akkxdlLlIzNy3Gk-", - "score": 36, - "count": 10, - "title": "Campfire Songs from Los Angeles", - "artist": "Big Harmonica Bob", - "barcode": "634479314377", - "disambiguation": "CD Baby id:bigbob3" - }, - { - "id": "cDX6Bkd2t.WXzepz5b31tNGHIRk-", - "score": 34, - "count": 5, - "title": "Yoga From Your Chair", - "artist": "Maureen Lewison", - "barcode": "634479494123", - "disambiguation": "CD Baby id:lewison2" - }, - { - "id": "Qe8ui_uWl_EbhYRZ80MCnOMS.sw-", - "score": 31, - "count": 14, - "title": "The Electric Chair", - "artist": "The Electric Chair", - "barcode": "634479648779", - "disambiguation": "CD Baby id:electricchair" - }, - { - "id": "H1g2radf1mLliLAHoNGFk_WNLtA-", - "score": 30, - "count": 15, - "title": "Live From The Back Of A Big, Big Boat", - "artist": "Cory Heydon", - "barcode": "634479134715", - "disambiguation": "CD Baby id:coryheydon2" - }, - { - "id": "PUDYvw.Sbu11BabJKSric_oojsk-", - "score": 30, - "count": 13, - "title": "Merry Christmas From The Bigg Man", - "artist": "Bigg Robb & Da Problem Solvas", - "barcode": "634479056499", - "disambiguation": "CD Baby id:biggrobb3" - }, - { - "id": "UtxdpN0a3Vw.BctD.yrI36meSog-", - "score": 30, - "count": 28, - "title": "Authentic Songs Of The Old West", - "artist": "Big Tex", - "barcode": "628740651025", - "disambiguation": "CD Baby id:bigtex" - }, - { - "id": "V8FgiMq2KOti1FU.Jw4ZTnpZXBc-", - "score": 29, - "count": 15, - "title": "From The Heart", - "artist": "Big Sicks LES", - "barcode": "600385158220", - "disambiguation": "CD Baby id:bigsicksles" - }, - { - "id": "PAEoG.rnXfuYI56Flo9SXZ3ZFmE-", - "score": 29, - "count": 11, - "title": "Big Guitars From Memphis", - "artist": "Big Guitars From Memphis", - "barcode": "" - }, - { - "id": "QKTE8faC9kj9AScuGn.SkD1aFns-", - "score": 29, - "count": 12, - "title": "Songs From Mars", - "artist": "The Dude From Mars", - "barcode": "643157325321", - "disambiguation": "CD Baby id:dudefrommars" - }, - { - "id": "zaVgvlXaGtSzh7OKMr9g0Y73rvQ-", - "score": 29, - "count": 10, - "title": "From the Bestiary to the Leathering Room", - "artist": "Big John Bates", - "barcode": "4260108237555" - }, - { - "id": "OM.Fg73TG4F3Uzh7W7hgmt7jsMo-", - "score": 29, - "count": 20, - "title": "Pure Ballads: The Biggest Love Songs (Disc 1)", - "artist": "", - "barcode": "" - }, - { - "id": "zzlGgrhBYLxg2fN2S1AEoDFEjTs-", - "score": 29, - "count": 16, - "title": "The Big City Bob Songs", - "artist": "Bobby Rivers", - "barcode": "634479478321", - "disambiguation": "CD Baby id:bobbyrivers12" - }, - { - "id": "nNAKk2xlu4dHNa.Xbf9FxG7KAbU-", - "score": 29, - "count": 19, - "title": "Pure Ballads The Biggest Love Songs (disc 2)", - "artist": "", - "barcode": "" - } - ] -} \ No newline at end of file diff --git a/example json.json b/example json.json deleted file mode 100644 index 6570c2e..0000000 --- a/example json.json +++ /dev/null @@ -1,1592 +0,0 @@ -{ - "created": "2025-04-10T17:40:09.895Z", - "count": 54960, - "offset": 0, - "releases": [ - { - "id": "b47fb945-e576-4f89-bd83-8b5e809fbd0b", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Witt Lowry", - "artist": { - "id": "0b4ce616-79c3-471c-9792-1b8767eca03a", - "name": "Witt Lowry", - "sort-name": "Lowry, Witt" - } - } - ], - "release-group": { - "id": "09cf8b07-f30e-47a4-b519-cf4e4a93f7c2", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2022-10-28", - "country": "XW", - "release-events": [ - { - "date": "2022-10-28", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "barcode": "859767027191", - "label-info": [ - { - "label": { - "id": "43f04ad4-1703-484f-a529-a0ba1932115b", - "name": "Witt Lowry" - } - } - ], - "track-count": 1, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 1 - } - ] - }, - { - "id": "846ee5f9-ad18-4f3a-a883-43ec58ca0805", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "artist-credit": [ - { - "name": "Kaylee Bell", - "artist": { - "id": "327a36ef-1065-4e76-96d6-b5a89c01a64d", - "name": "Kaylee Bell", - "sort-name": "Bell Kaylee", - "disambiguation": "singer from New Zealand" - } - } - ], - "release-group": { - "id": "b8ea2772-ad44-497f-b7dd-23cff0c85389", - "type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "primary-type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "title": "Nights Like This", - "primary-type": "Album" - }, - "asin": "B0CSJX9KTB", - "track-count": 11, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 11 - } - ] - }, - { - "id": "6bdbaa6e-9e62-4132-a6d6-6da0e74f4155", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Kaylee Bell", - "artist": { - "id": "327a36ef-1065-4e76-96d6-b5a89c01a64d", - "name": "Kaylee Bell", - "sort-name": "Bell Kaylee", - "disambiguation": "singer from New Zealand" - } - } - ], - "release-group": { - "id": "1158d1d0-39c3-4d1e-b075-630a5c361ae5", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2023-06-23", - "country": "US", - "release-events": [ - { - "date": "2023-06-23", - "area": { - "id": "489ce91b-6658-3307-9877-795b68554c98", - "name": "United States", - "sort-name": "United States", - "iso-3166-1-codes": [ - "US" - ] - } - } - ], - "track-count": 1, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 1 - } - ] - }, - { - "id": "fdf4afae-1393-4206-a4bf-2923560a73a3", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "script": "Latn" - }, - "artist-credit": [ - { - "name": "St. Lundi", - "artist": { - "id": "86df5005-8963-49d7-bfd5-1c798e2b20a2", - "name": "St. Lundi", - "sort-name": "St. Lundi" - } - } - ], - "release-group": { - "id": "c5c03cba-1a22-4fe0-9896-801d3d04946e", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2021-09-03", - "country": "XW", - "release-events": [ - { - "date": "2021-09-03", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "barcode": "3663729169266", - "label-info": [ - { - "label": { - "id": "9b239469-1336-4987-a130-230676a395db", - "name": "BLENDED" - } - } - ], - "track-count": 1, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 1 - } - ], - "tags": [ - { - "count": 1, - "name": "pop" - } - ] - }, - { - "id": "cd28d141-9f83-492d-a513-3281d94dd3f0", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Daniel Blume", - "artist": { - "id": "8247d7e8-454a-49dc-8e0e-6137a6e0e5b0", - "name": "Daniel Blume", - "sort-name": "Blume, Daniel" - } - } - ], - "release-group": { - "id": "0d299428-83cd-4464-b2dc-d0775f915713", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2020-01-24", - "country": "GB", - "release-events": [ - { - "date": "2020-01-24", - "area": { - "id": "8a754a16-0027-3a29-b6d7-2b40ea0481ed", - "name": "United Kingdom", - "sort-name": "United Kingdom", - "iso-3166-1-codes": [ - "GB" - ] - } - } - ], - "track-count": 1, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 1 - } - ] - }, - { - "id": "b15d4882-f871-4499-8468-e094ba9c2dfa", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Eli “Paperboy” Reed", - "artist": { - "id": "91e617ef-bf31-479c-abc5-0df20cf5365f", - "name": "Eli “Paperboy” Reed", - "sort-name": "Reed, Eli “Paperboy”" - } - } - ], - "release-group": { - "id": "58815497-25aa-43d0-a30d-4197000b4765", - "type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "primary-type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "title": "Nights Like This", - "primary-type": "Album" - }, - "date": "2014-04-25", - "country": "US", - "release-events": [ - { - "date": "2014-04-25", - "area": { - "id": "489ce91b-6658-3307-9877-795b68554c98", - "name": "United States", - "sort-name": "United States", - "iso-3166-1-codes": [ - "US" - ] - } - } - ], - "barcode": "093624938194", - "label-info": [ - { - "label": { - "id": "c595c289-47ce-4fba-b999-b87503e8cb71", - "name": "Warner Bros. Records" - } - } - ], - "track-count": 11, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 11 - } - ] - }, - { - "id": "c7bcad1c-db26-447d-b5d4-1c9561b20187", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "text-representation": { - "language": "eng" - }, - "artist-credit": [ - { - "name": "Jack Gray", - "artist": { - "id": "4a7f0d0c-b49a-40a4-b4c9-30cea62890a9", - "name": "Jack Gray", - "sort-name": "Gray, Jack" - } - } - ], - "release-group": { - "id": "7760a750-174e-4006-aa35-7b020b655fe0", - "type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "primary-type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "title": "Nights Like This", - "primary-type": "EP" - }, - "date": "2019-05-31", - "country": "XW", - "release-events": [ - { - "date": "2019-05-31", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "label-info": [ - { - "label": { - "id": "d50eb1c1-20bd-46b2-a216-a26aac9b7130", - "name": "Warner Music Australia" - } - } - ], - "track-count": 5, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 5 - } - ] - }, - { - "id": "37dd2d58-d624-382b-87d6-038e1937569f", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Stacey Q", - "artist": { - "id": "55cf7705-e0bc-4b70-8cba-b85544e2eac9", - "name": "Stacey Q", - "sort-name": "Stacey Q" - } - } - ], - "release-group": { - "id": "f4334af2-6179-3288-9f9f-92ffdf7a2a74", - "type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "primary-type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "title": "Nights Like This", - "primary-type": "Album" - }, - "date": "1989", - "country": "US", - "release-events": [ - { - "date": "1989", - "area": { - "id": "489ce91b-6658-3307-9877-795b68554c98", - "name": "United States", - "sort-name": "United States", - "iso-3166-1-codes": [ - "US" - ] - } - } - ], - "label-info": [ - { - "catalog-number": "81962-1", - "label": { - "id": "50c384a2-0b44-401b-b893-8181173339c7", - "name": "Atlantic" - } - } - ], - "track-count": 10, - "media": [ - { - "format": "12\" Vinyl", - "disc-count": 0, - "track-count": 10 - } - ] - }, - { - "id": "78681d3c-5ea6-31d0-8d68-9906ee94e812", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Stacey Q", - "artist": { - "id": "55cf7705-e0bc-4b70-8cba-b85544e2eac9", - "name": "Stacey Q", - "sort-name": "Stacey Q" - } - } - ], - "release-group": { - "id": "f4334af2-6179-3288-9f9f-92ffdf7a2a74", - "type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "primary-type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "title": "Nights Like This", - "primary-type": "Album" - }, - "date": "1989", - "country": "US", - "release-events": [ - { - "date": "1989", - "area": { - "id": "489ce91b-6658-3307-9877-795b68554c98", - "name": "United States", - "sort-name": "United States", - "iso-3166-1-codes": [ - "US" - ] - } - } - ], - "label-info": [ - { - "catalog-number": "81962-4", - "label": { - "id": "50c384a2-0b44-401b-b893-8181173339c7", - "name": "Atlantic" - } - } - ], - "track-count": 10, - "media": [ - { - "format": "Cassette", - "disc-count": 0, - "track-count": 10 - } - ] - }, - { - "id": "0356a875-3f72-4eca-87cd-60fde14aab75", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Stacey Q", - "artist": { - "id": "55cf7705-e0bc-4b70-8cba-b85544e2eac9", - "name": "Stacey Q", - "sort-name": "Stacey Q" - } - } - ], - "release-group": { - "id": "f4334af2-6179-3288-9f9f-92ffdf7a2a74", - "type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "primary-type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "title": "Nights Like This", - "primary-type": "Album" - }, - "date": "1989", - "country": "US", - "release-events": [ - { - "date": "1989", - "area": { - "id": "489ce91b-6658-3307-9877-795b68554c98", - "name": "United States", - "sort-name": "United States", - "iso-3166-1-codes": [ - "US" - ] - } - } - ], - "asin": "B000002IO4", - "label-info": [ - { - "catalog-number": "81962-2", - "label": { - "id": "50c384a2-0b44-401b-b893-8181173339c7", - "name": "Atlantic" - } - } - ], - "track-count": 10, - "media": [ - { - "format": "CD", - "disc-count": 2, - "track-count": 10 - } - ] - }, - { - "id": "c7da940a-0741-40eb-b64b-43edb869a570", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Crowder", - "artist": { - "id": "6bcf61d5-3a08-4194-8112-5e155b7afffa", - "name": "Crowder", - "sort-name": "Crowder" - } - } - ], - "release-group": { - "id": "ad9b8888-eb2c-4d03-a285-fe952f5a2cbd", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2020-05-15", - "country": "XW", - "release-events": [ - { - "date": "2020-05-15", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "barcode": "0602507107611", - "label-info": [ - { - "label": { - "id": "a16c5c7f-38ec-4cbf-aa4f-f354fcc88eb2", - "name": "Sparrow Records" - } - }, - { - "label": { - "id": "30ea2baa-6c1d-4bf9-9d29-f3553fce5b84", - "name": "sixstepsrecords" - } - } - ], - "track-count": 3, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 3 - } - ] - }, - { - "id": "8ad3df62-30b8-429a-9c96-d5654c5a94dc", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Icona Pop", - "artist": { - "id": "c5f259d0-abd8-418e-81ee-3965fd4e4e9a", - "name": "Icona Pop", - "sort-name": "Icona Pop", - "disambiguation": "Swedish dance/electropop duo" - } - } - ], - "release-group": { - "id": "0ced8519-e8f5-43ae-ace3-1141f98fb309", - "type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "primary-type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "title": "Nights Like This", - "primary-type": "EP" - }, - "date": "2012-06-29", - "country": "SE", - "release-events": [ - { - "date": "2012-06-29", - "area": { - "id": "23d10872-f5ae-3f0c-bf55-332788a16ecb", - "name": "Sweden", - "sort-name": "Sweden", - "iso-3166-1-codes": [ - "SE" - ] - } - } - ], - "barcode": "602537108039", - "label-info": [ - { - "label": { - "id": "f669a7a4-b94b-42db-a0b7-ba040e5c30d8", - "name": "Universal Music AB" - } - } - ], - "track-count": 4, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 4 - } - ] - }, - { - "id": "b7b0033c-7ef5-4b8e-b459-9232020dbd32", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Icona Pop", - "artist": { - "id": "c5f259d0-abd8-418e-81ee-3965fd4e4e9a", - "name": "Icona Pop", - "sort-name": "Icona Pop", - "disambiguation": "Swedish dance/electropop duo" - } - } - ], - "release-group": { - "id": "0ced8519-e8f5-43ae-ace3-1141f98fb309", - "type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "primary-type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "title": "Nights Like This", - "primary-type": "EP" - }, - "date": "2011-10-10", - "country": "GB", - "release-events": [ - { - "date": "2011-10-10", - "area": { - "id": "8a754a16-0027-3a29-b6d7-2b40ea0481ed", - "name": "United Kingdom", - "sort-name": "United Kingdom", - "iso-3166-1-codes": [ - "GB" - ] - } - } - ], - "label-info": [ - { - "label": { - "id": "995428e7-81b6-41dd-bd38-5a7a0ece8ad6", - "name": "Mercury Records" - } - } - ], - "track-count": 4, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 4 - } - ] - }, - { - "id": "375a841d-1ae7-498d-8628-5226fd7cf0e9", - "score": 100, - "status-id": "518ffc83-5cde-34df-8627-81bff5093d92", - "packaging-id": "f7101ce3-0384-39ce-9fde-fbbd0044d35f", - "count": 1, - "title": "Nights Like This", - "status": "Promotion", - "packaging": "Cardboard/Paper Sleeve", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Icona Pop", - "artist": { - "id": "c5f259d0-abd8-418e-81ee-3965fd4e4e9a", - "name": "Icona Pop", - "sort-name": "Icona Pop", - "disambiguation": "Swedish dance/electropop duo" - } - } - ], - "release-group": { - "id": "0ced8519-e8f5-43ae-ace3-1141f98fb309", - "type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "primary-type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "title": "Nights Like This", - "primary-type": "EP" - }, - "date": "2011", - "country": "GB", - "release-events": [ - { - "date": "2011", - "area": { - "id": "8a754a16-0027-3a29-b6d7-2b40ea0481ed", - "name": "United Kingdom", - "sort-name": "United Kingdom", - "iso-3166-1-codes": [ - "GB" - ] - } - } - ], - "label-info": [ - { - "catalog-number": "NIGHTSCJ1", - "label": { - "id": "995428e7-81b6-41dd-bd38-5a7a0ece8ad6", - "name": "Mercury Records" - } - } - ], - "track-count": 4, - "media": [ - { - "format": "CD", - "disc-count": 0, - "track-count": 4 - } - ] - }, - { - "id": "3321d677-020a-440c-ab56-af00720da88a", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Jac & Harri", - "artist": { - "id": "aa7c21fc-753e-4fae-b3be-8e6bcfee5d75", - "name": "Jac & Harri", - "sort-name": "Jac & Harri", - "disambiguation": "Welsh DJ/producer duo" - } - } - ], - "release-group": { - "id": "b1dd3f8a-a6f6-4200-b430-71adecf2ec44", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2022-01-28", - "country": "XW", - "release-events": [ - { - "date": "2022-01-28", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "barcode": "8720623709990", - "label-info": [ - { - "catalog-number": "GEMS162", - "label": { - "id": "31a135d2-710f-472f-852f-c276549b5a7f", - "name": "Gemstone Records" - } - } - ], - "track-count": 1, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 1 - } - ] - }, - { - "id": "91404f0c-121d-45b9-b035-4b6606364450", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "DJ Cinéma Quartier Latin", - "artist": { - "id": "2f2aba6e-1dbb-40a5-8eb2-918404ed72f9", - "name": "DJ Cinéma Quartier Latin", - "sort-name": "DJ Cinéma Quartier Latin", - "disambiguation": "lo‐fi house producer" - } - } - ], - "release-group": { - "id": "2165f53b-23e1-4bc0-b6e7-d423b0957fa7", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2020-09-03", - "country": "XW", - "release-events": [ - { - "date": "2020-09-03", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "label-info": [ - { - "label": { - "id": "157afde4-4bf5-4039-8ad2-5a15acc85176", - "name": "[no label]" - } - } - ], - "track-count": 1, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 1 - } - ], - "tags": [ - { - "count": 1, - "name": "house" - }, - { - "count": 1, - "name": "lo-fi" - } - ] - }, - { - "id": "cd5475aa-ea2e-4e2b-845b-b654020a0f4c", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "joinphrase": " feat. ", - "name": "Kehlani", - "artist": { - "id": "3260ce89-5eb0-4c6a-89c7-379c0dfc2ab9", - "name": "Kehlani", - "sort-name": "Kehlani" - } - }, - { - "name": "Ty Dolla $ign", - "artist": { - "id": "7bd66c18-cb33-49aa-9279-140acedbdb49", - "name": "Ty Dolla $ign", - "sort-name": "Ty Dolla Sign" - } - } - ], - "release-group": { - "id": "d5bb6793-a686-498c-8c9c-21fc93e60456", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2019-01-10", - "country": "XW", - "release-events": [ - { - "date": "2019-01-10", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "barcode": "075679855459", - "asin": "B07ML9NZTY", - "label-info": [ - { - "label": { - "id": "50c384a2-0b44-401b-b893-8181173339c7", - "name": "Atlantic" - } - }, - { - "label": { - "id": "6d7b0dff-72cc-475b-852c-76db67eb6c2b", - "name": "TSNMI" - } - } - ], - "track-count": 1, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 1 - } - ] - }, - { - "id": "fc6aedf2-aaca-434a-954e-49eaaee1c69b", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "text-representation": { - "language": "eng" - }, - "artist-credit": [ - { - "name": "Adelitas Way", - "artist": { - "id": "6ae6a016-91d7-46cc-be7d-5e8e5d320c54", - "name": "Adelitas Way", - "sort-name": "Adelitas Way" - } - } - ], - "release-group": { - "id": "e33749ef-a835-4b18-b113-450e079c09ba", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2024-03-01", - "country": "XW", - "release-events": [ - { - "date": "2024-03-01", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "track-count": 2, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 2 - } - ] - }, - { - "id": "eeb8a81f-863a-4ac6-9447-e91938f838d0", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "joinphrase": ", ", - "name": "Pierson Booth", - "artist": { - "id": "921ba243-ba64-4eba-8db7-f7ad7faa7cf9", - "name": "Pierson Booth", - "sort-name": "Booth, Pierson" - } - }, - { - "name": "Late Night Tones", - "artist": { - "id": "d2ef9890-0ca3-4310-a2a0-ba4aa54d14be", - "name": "Late Night Tones", - "sort-name": "Late Night Tones", - "disambiguation": "Sean Newell" - } - } - ], - "release-group": { - "id": "47d3a38b-5456-40d0-8caa-f35d1defb3df", - "type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "primary-type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "title": "Nights Like This", - "primary-type": "Album" - }, - "date": "2023-11-09", - "country": "XW", - "release-events": [ - { - "date": "2023-11-09", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "barcode": "7316475785407", - "asin": "B0CKFCYMFH", - "label-info": [ - { - "label": { - "id": "050d3b7d-677e-482f-b802-5dcd513da8c6", - "name": "Lofi Records" - } - } - ], - "track-count": 8, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 8 - } - ], - "tags": [ - { - "count": 1, - "name": "downtempo" - }, - { - "count": 1, - "name": "instrumental" - }, - { - "count": 1, - "name": "hip hop" - }, - { - "count": 2, - "name": "lo-fi" - }, - { - "count": 1, - "name": "boom bap" - }, - { - "count": 1, - "name": "chillwave" - }, - { - "count": 1, - "name": "instrumental hip hop" - }, - { - "count": 1, - "name": "lo-fi hip hop" - } - ] - }, - { - "id": "571b1665-e874-4e05-8f2c-b6257b7949c5", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "text-representation": { - "language": "eng" - }, - "artist-credit": [ - { - "name": "BLNDSS", - "artist": { - "id": "c725a3e2-ddf6-4e6c-9dc8-87ae4902105a", - "name": "BLNDSS", - "sort-name": "BLNDSS", - "disambiguation": "US Singer, Producer" - } - } - ], - "release-group": { - "id": "53571299-06e1-4921-b602-fc41b9fd99c9", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2021-11-26", - "country": "XW", - "release-events": [ - { - "date": "2021-11-26", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "barcode": "196400205159", - "label-info": [ - { - "label": { - "id": "9fbeb7b2-e138-48a0-8d6c-4c5588e4a6ab", - "name": "Omar Entertainment Group, LLC" - } - } - ], - "track-count": 1, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 1 - } - ] - }, - { - "id": "c42342c4-3046-4c08-bcca-c754723f46a1", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "pastels", - "artist": { - "id": "b27115f1-492f-4f76-8e0d-20f09051b0fb", - "name": "pastels", - "sort-name": "pastels", - "disambiguation": "beatmaker" - } - } - ], - "release-group": { - "id": "836af0a0-2b0a-4f4b-b7a4-330cf78b81ed", - "type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "primary-type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "title": "Nights Like This", - "primary-type": "EP" - }, - "date": "2021-12-17", - "country": "XW", - "release-events": [ - { - "date": "2021-12-17", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "barcode": "5059449056678", - "label-info": [ - { - "label": { - "id": "157afde4-4bf5-4039-8ad2-5a15acc85176", - "name": "[no label]" - } - } - ], - "track-count": 6, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 6 - } - ] - }, - { - "id": "70f6882f-17b4-4a9f-89d0-7c4553f80e6a", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Kaylee Bell", - "artist": { - "id": "327a36ef-1065-4e76-96d6-b5a89c01a64d", - "name": "Kaylee Bell", - "sort-name": "Bell Kaylee", - "disambiguation": "singer from New Zealand" - } - } - ], - "release-group": { - "id": "b8ea2772-ad44-497f-b7dd-23cff0c85389", - "type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "primary-type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", - "title": "Nights Like This", - "primary-type": "Album" - }, - "label-info": [ - { - "catalog-number": "KBO224CD", - "label": { - "id": "157afde4-4bf5-4039-8ad2-5a15acc85176", - "name": "[no label]" - } - } - ], - "track-count": 11, - "media": [ - { - "format": "CD", - "disc-count": 1, - "track-count": 11 - } - ] - }, - { - "id": "43e653d5-2e4f-4ac6-b4bc-2d2580875057", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Josh Golden", - "artist": { - "id": "70124c63-2f35-4042-9d59-811c88f7bcf1", - "name": "Josh Golden", - "sort-name": "Golden, Josh", - "disambiguation": "Missouri pop rock singer" - } - } - ], - "release-group": { - "id": "1d5935fc-9687-4a45-85e5-aeb14e5bee8d", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2021-11-03", - "country": "XW", - "release-events": [ - { - "date": "2021-11-03", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "barcode": "196429064775", - "label-info": [ - { - "label": { - "id": "71a9bef2-4e17-4a3f-a9a2-3d70a907c30b", - "name": "apg" - } - } - ], - "track-count": 1, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 1 - } - ] - }, - { - "id": "81660cda-05a5-4b9e-bb83-0c9ba1959930", - "score": 100, - "count": 1, - "title": "Nights Like This", - "artist-credit": [ - { - "joinphrase": " Vs. ", - "name": "Alfa", - "artist": { - "id": "922283dc-b837-4265-a57e-71aeeea65b6a", - "name": "Alfa", - "sort-name": "Alfa", - "disambiguation": "Brian Kidd" - } - }, - { - "name": "Paul F", - "artist": { - "id": "ec814306-cfc8-42c6-9ca4-938cc547f69d", - "name": "Paul F", - "sort-name": "F, Paul", - "disambiguation": "Hard Dance" - } - } - ], - "release-group": { - "id": "8143526f-06d6-471d-ba26-0ad8f82fbcd6", - "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", - "title": "Nights Like This", - "primary-type": "Single" - }, - "date": "2009-04-30", - "country": "GB", - "release-events": [ - { - "date": "2009-04-30", - "area": { - "id": "8a754a16-0027-3a29-b6d7-2b40ea0481ed", - "name": "United Kingdom", - "sort-name": "United Kingdom", - "iso-3166-1-codes": [ - "GB" - ] - } - } - ], - "barcode": "5055274084329", - "label-info": [ - { - "catalog-number": "PRESHT015", - "label": { - "id": "19c18cda-ddfd-4805-84ff-e1d18330ef51", - "name": "Presence Hard Trance" - } - } - ], - "track-count": 1, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 1 - } - ], - "tags": [ - { - "count": 1, - "name": "hard trance" - } - ] - }, - { - "id": "cff3b22f-4e2c-4a47-8b94-e27bf11f9d24", - "score": 100, - "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", - "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", - "count": 1, - "title": "Nights Like This", - "status": "Official", - "packaging": "None", - "text-representation": { - "language": "eng", - "script": "Latn" - }, - "artist-credit": [ - { - "name": "Loud Luxury", - "artist": { - "id": "4c445344-9df2-407e-9bf3-8a5c0b86777e", - "name": "Loud Luxury", - "sort-name": "Loud Luxury" - } - } - ], - "release-group": { - "id": "e2c743ca-f051-44f7-bc26-fdd9dc45bc30", - "type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "primary-type-id": "6d0c5bf6-7a33-3420-a519-44fc63eedebf", - "title": "Nights Like This", - "primary-type": "EP" - }, - "date": "2020-03-27", - "country": "XW", - "release-events": [ - { - "date": "2020-03-27", - "area": { - "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", - "name": "[Worldwide]", - "sort-name": "[Worldwide]", - "iso-3166-1-codes": [ - "XW" - ] - } - } - ], - "label-info": [ - { - "catalog-number": "ARMAS1721", - "label": { - "id": "b4cb2958-a509-401c-9296-89907b63674f", - "name": "Armada Music" - } - } - ], - "track-count": 4, - "media": [ - { - "format": "Digital Media", - "disc-count": 0, - "track-count": 4 - } - ] - } - ] -} \ No newline at end of file diff --git a/src/main/java/com/CDPrintable/Constants.java b/src/main/java/com/CDPrintable/Constants.java index ec15881..ad43b98 100644 --- a/src/main/java/com/CDPrintable/Constants.java +++ b/src/main/java/com/CDPrintable/Constants.java @@ -12,7 +12,7 @@ public class Constants { // MAJOR MINOR PATCH - public static final String VERSION = "1.4.3"; + public static final String VERSION = "1.5.3"; public static final boolean USER_AGENT_EMAIL_CHANGED = false; } diff --git a/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzCDStub.java b/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzCDStub.java index e3c6ea7..bbe00e1 100644 --- a/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzCDStub.java +++ b/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzCDStub.java @@ -22,6 +22,12 @@ public MusicBrainzCDStub(String id, String title, String[] artists, int trackCou this.artists = artists; this.trackCount = trackCount; } + public MusicBrainzCDStub() { + this.id = ""; + this.title = ""; + this.artists = new String[0]; + this.trackCount = -1; + } public String getArtistsAsString() { StringBuilder sb = new StringBuilder(); diff --git a/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzJSONReader.java b/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzJSONReader.java index c2e92db..4774d9d 100644 --- a/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzJSONReader.java +++ b/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzJSONReader.java @@ -17,15 +17,25 @@ public class MusicBrainzJSONReader { private final JsonObject json; - - public MusicBrainzJSONReader(String json) { - JsonElement jsonElement = JsonParser.parseString(json); - this.json = jsonElement.getAsJsonObject(); + private final String na = "n/a"; + + public MusicBrainzJSONReader(String json) throws IllegalArgumentException { + JsonObject tempJsonObject; + try { + JsonElement jsonElement = JsonParser.parseString(json); + tempJsonObject = jsonElement.getAsJsonObject(); + } catch (JsonSyntaxException | IllegalStateException e) { + tempJsonObject = new JsonObject(); + } + this.json = tempJsonObject; } @SuppressWarnings("unchecked") private T[] parseJsonArray(String key, JsonArrayProcessor processor, T[] array) { - if (!json.has(key)) {return null;} + if (!json.has(key)) { + array = (T[]) Array.newInstance(array.getClass().getComponentType(), 0); + return array; + } JsonArray jsonArray = json.getAsJsonArray(key); array = (T[]) Array.newInstance(array.getClass().getComponentType(), jsonArray.size()); @@ -42,10 +52,10 @@ private T[] parseJsonArray(String key, JsonArrayProcessor processor, T[] */ public MusicBrainzRelease[] getReleases() { return parseJsonArray("releases", jsonObject -> { - String title = jsonObject.has("title") ? jsonObject.get("title").getAsString() : null; - String date = jsonObject.has("date") ? jsonObject.get("date").getAsString() : null; - int trackCount = jsonObject.has("count") ? jsonObject.get("count").getAsInt() : -1; - String id = jsonObject.has("id") ? jsonObject.get("id").getAsString() : null; + String title = jsonHasAndIsNotNull(jsonObject, "title") ? jsonObject.get("title").getAsString() : null; + String date = jsonHasAndIsNotNull(jsonObject, "date") ? jsonObject.get("date").getAsString() : null; + int trackCount = jsonHasAndIsNotNull(jsonObject, "track-count") ? jsonObject.get("track-count").getAsInt() : -1; + String id = jsonHasAndIsNotNull(jsonObject, "id") ? jsonObject.get("id").getAsString() : null; JsonArray artistsArray = jsonObject.getAsJsonArray("artist-credit"); String[] artists = new String[artistsArray.size()]; @@ -61,10 +71,11 @@ public MusicBrainzRelease[] getReleases() { public MusicBrainzCDStub[] getCDStubs() { return parseJsonArray("cdstubs", jsonObject -> { - String title = jsonObject.has("title") ? jsonObject.get("title").getAsString() : null; - String id = jsonObject.has("id") ? jsonObject.get("id").getAsString() : null; - int trackCount = jsonObject.has("count") ? jsonObject.get("count").getAsInt() : -1; - String artist = jsonObject.has("artist") ? jsonObject.get("artist").getAsString() : null; + String title = jsonHasAndIsNotNull(jsonObject, "title") ? jsonObject.get("title").getAsString() : null; + String id = jsonHasAndIsNotNull(jsonObject, "id") ? jsonObject.get("id").getAsString() : null; + int trackCount = jsonHasAndIsNotNull(jsonObject, "count") ? jsonObject.get("count").getAsInt() : -1; + String artist = jsonHasAndIsNotNull(jsonObject, "artist") ? jsonObject.get("artist").getAsString() : null; + return new MusicBrainzCDStub(id, title, new String[] {artist}, trackCount); }, new MusicBrainzCDStub[0]); } @@ -76,6 +87,9 @@ public MusicBrainzCDStub[] getCDStubs() { * @param extractor The extractor that extracts the data from the item. */ private DefaultTableModel createTableModel(Object[] items, String[] columnNames, DataExtractor extractor) { + if (items == null || items.length == 0) { + return new DefaultTableModel(new String[0][0], columnNames); + } String[][] data = new String[items.length][columnNames.length]; for (int i = 0; i < items.length; i++) { data[i] = extractor.extractData(items[i]); @@ -88,10 +102,10 @@ public DefaultTableModel getReleasesAsTableModel(MusicBrainzRelease[] releaseArr return createTableModel(releaseArray, columnNames, item -> { MusicBrainzRelease release = (MusicBrainzRelease) item; return new String[]{ - release.getTitle(), - release.getArtistsAsString(), - String.valueOf(release.getTrackCount()), - release.getDate(), + getOrDefault(release.getTitle()), + getOrDefault(release.getArtistsAsString()), + getOrDefault(release.getTrackCount() != -1 ? String.valueOf(release.getTrackCount()) : null), + getOrDefault(release.getDate()), "" }; }); @@ -102,9 +116,9 @@ public DefaultTableModel getCDStubsAsTableModel(MusicBrainzCDStub[] cdStubArray) return createTableModel(cdStubArray, columnNames, item -> { MusicBrainzCDStub cdStub = (MusicBrainzCDStub) item; return new String[]{ - cdStub.getTitle(), - cdStub.getArtistsAsString(), - String.valueOf(cdStub.getTrackCount()), + getOrDefault(cdStub.getTitle()), + getOrDefault(cdStub.getArtistsAsString()), + getOrDefault(String.valueOf(cdStub.getTrackCount())), "" }; }); @@ -119,4 +133,17 @@ private interface DataExtractor { private interface JsonArrayProcessor { T process(JsonObject jsonObject); } -} + + private boolean jsonHasAndIsNotNull(JsonObject jsonObject, String memberName) { + return jsonObject.has(memberName) && !jsonObject.get(memberName).isJsonNull(); + } + + private String getOrDefault(String value) { + return value != null ? value : na; + } + + @Override + public String toString() { + return json.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzRelease.java b/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzRelease.java index 86dae40..128cec3 100644 --- a/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzRelease.java +++ b/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzRelease.java @@ -25,6 +25,14 @@ public MusicBrainzRelease(String title, String[] artists, String date, int track this.id = id; } + public MusicBrainzRelease() { + this.title = ""; + this.artists = new String[0]; + this.date = ""; + this.trackCount = 0; + this.id = ""; + } + public String getArtistsAsString() { StringBuilder sb = new StringBuilder(); for (String artist : artists) { diff --git a/src/test/java/MusicBrainzObjectTests.java b/src/test/java/MusicBrainzObjectTests.java new file mode 100644 index 0000000..7724c5c --- /dev/null +++ b/src/test/java/MusicBrainzObjectTests.java @@ -0,0 +1,207 @@ +import com.CDPrintable.MusicBrainzResources.MusicBrainzCDStub; +import com.CDPrintable.MusicBrainzResources.MusicBrainzJSONReader; +import com.CDPrintable.MusicBrainzResources.MusicBrainzRelease; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; + +import javax.swing.table.DefaultTableModel; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +import static org.junit.jupiter.api.Assertions.*; + +public class MusicBrainzObjectTests { + private final String releasesJson = readFile("src/test/resources/ReleaseExample.json"); + private final String cdStubsJson = readFile("src/test/resources/CDStubExample.json"); + + @Test + public void invalidJsonString() { + MusicBrainzJSONReader reader = new MusicBrainzJSONReader(""); + MusicBrainzRelease[] releases = reader.getReleases(); + + assertEquals("{}", reader.toString()); + + assertNotNull(releases); + assertEquals(0, releases.length); + } + + @ParameterizedTest + @CsvSource({ + "{\"invalidKey\": []}, releases", + "{\"releases\": []}, releases", + "{\"invalidKey\": []}, cdstubs", + "{\"cdstubs\": []}, cdstubs" + }) + void testGetItemsWithInvalidJsonStructure(String jsonString, String key) { + MusicBrainzJSONReader reader = new MusicBrainzJSONReader(jsonString); + + if (key.equals("releases")) { + MusicBrainzRelease[] releases = reader.getReleases(); + assertNotNull(releases); + assertEquals(0, releases.length); + } else if (key.equals("cdstubs")) { + MusicBrainzCDStub[] cdStubs = reader.getCDStubs(); + assertNotNull(cdStubs); + assertEquals(0, cdStubs.length); + } + } + + @ParameterizedTest + @CsvSource({ + "{\"releases\": [{\"title\": null, \"date\": null, \"count\": null, \"id\": null, \"artist-credit\": []}]}, releases", + "{\"cdstubs\": [{\"title\": null, \"id\": null, \"count\": null, \"artist\": null}]}, cdstubs" + }) + void testGetItemsWithMissingOrNullFields(String jsonString, String key) { + MusicBrainzJSONReader reader = new MusicBrainzJSONReader(jsonString); + + if (key.equals("releases")) { + MusicBrainzRelease[] releases = reader.getReleases(); + assertNotNull(releases); + assertEquals(1, releases.length); + + assertNull(releases[0].getTitle()); + assertNull(releases[0].getDate()); + assertEquals(-1, releases[0].getTrackCount()); + assertNull(releases[0].getId()); + assertEquals(0, releases[0].getArtists().length); + } else if (key.equals("cdstubs")) { + MusicBrainzCDStub[] cdStubs = reader.getCDStubs(); + assertNotNull(cdStubs); + assertEquals(1, cdStubs.length); + + assertNull(cdStubs[0].getTitle()); + assertNull(cdStubs[0].getId()); + assertEquals(-1, cdStubs[0].getTrackCount()); + assertNull(cdStubs[0].getArtists()[0]); + } + } + + @ParameterizedTest + @CsvSource({ + "releases, true, null", + "releases, false, {}", + "cdstubs, true, null", + "cdstubs, false, {}", + "releases, false, {\"releases\": null}", + "cdstubs, false, {\"cdstubs\": null}", + "releases, false, {\"invalidKey\": []}", + "cdstubs, false, {\"invalidKey\": []}" + }) + void testGetTableModelWithArrayIssues(String key, boolean isNull, String readerJson) { + MusicBrainzJSONReader reader = new MusicBrainzJSONReader(readerJson != null ? readerJson : ""); + if (key.equals("releases")) { + MusicBrainzRelease[] releases = isNull ? null : new MusicBrainzRelease[0]; + DefaultTableModel tableModel = reader.getReleasesAsTableModel(releases); + + assertNotNull(tableModel); + assertEquals(0, tableModel.getRowCount()); + } else if (key.equals("cdstubs")) { + MusicBrainzCDStub[] cdStubs = isNull ? null : new MusicBrainzCDStub[0]; + DefaultTableModel tableModel = reader.getCDStubsAsTableModel(cdStubs); + + assertNotNull(tableModel); + assertEquals(0, tableModel.getRowCount()); + } + } + + @Test + void genericGetReleasesTest() { + MusicBrainzJSONReader reader = new MusicBrainzJSONReader(releasesJson); + MusicBrainzRelease[] releases = reader.getReleases(); + + assertNotNull(releases); + assertEquals(2, releases.length); + + assertEquals("Nights Like This", releases[0].getTitle()); + assertEquals("Witt Lowry", releases[0].getArtists()[0]); + assertEquals(1, releases[0].getArtists().length); + assertEquals("2022-10-28", releases[0].getDate()); + assertEquals(1, releases[0].getTrackCount()); + assertEquals("b47fb945-e576-4f89-bd83-8b5e809fbd0b", releases[0].getId()); + + assertEquals("Nights Like This", releases[1].getTitle()); + assertEquals("Kaylee Bell", releases[1].getArtists()[0]); + assertEquals(1, releases[1].getArtists().length); + assertNull(releases[1].getDate()); + assertEquals(11, releases[1].getTrackCount()); + assertEquals("846ee5f9-ad18-4f3a-a883-43ec58ca0805", releases[1].getId()); + } + + @SuppressWarnings("SpellCheckingInspection") + @Test + void genericGetCDStubsTest() { + MusicBrainzJSONReader reader = new MusicBrainzJSONReader(cdStubsJson); + MusicBrainzCDStub[] cdStubs = reader.getCDStubs(); + + assertNotNull(cdStubs); + assertEquals(2, cdStubs.length); + + assertEquals("Songs From The Big Chair", cdStubs[0].getTitle()); + assertEquals("Tears For Fears", cdStubs[0].getArtists()[0]); + assertEquals(1, cdStubs[0].getArtists().length); + assertEquals(8, cdStubs[0].getTrackCount()); + assertEquals("hU2FJcnlVtratcrOn9rAhPzzCMo-", cdStubs[0].getId()); + + assertEquals("+", cdStubs[1].getTitle()); + assertEquals("Ed Sheeran", cdStubs[1].getArtists()[0]); + assertEquals(1, cdStubs[1].getArtists().length); + assertEquals(13, cdStubs[1].getTrackCount()); + assertEquals("KZn02eYalzdXJNbtmuz2xKDzLZU-", cdStubs[1].getId()); + } + + @Test + void genericGetReleasesAsTableModelTest() { + MusicBrainzJSONReader reader = new MusicBrainzJSONReader(releasesJson); + MusicBrainzRelease[] releases = reader.getReleases(); + DefaultTableModel tableModel = reader.getReleasesAsTableModel(releases); + + assertNotNull(tableModel); + assertEquals(2, tableModel.getRowCount()); + assertEquals(5, tableModel.getColumnCount()); + + assertEquals("Nights Like This", tableModel.getValueAt(0, 0)); + assertEquals("Witt Lowry", tableModel.getValueAt(0, 1)); + assertEquals("1", tableModel.getValueAt(0, 2)); + assertEquals("2022-10-28", tableModel.getValueAt(0, 3)); + assertEquals("", tableModel.getValueAt(0, 4)); + + assertEquals("Nights Like This", tableModel.getValueAt(1, 0)); + assertEquals("Kaylee Bell", tableModel.getValueAt(1, 1)); + assertEquals("11", tableModel.getValueAt(1, 2)); + assertEquals("n/a", tableModel.getValueAt(1, 3)); + assertEquals("", tableModel.getValueAt(1, 4)); + } + + @Test + void genericGetCDStubsAsTableModelTest() { + MusicBrainzJSONReader reader = new MusicBrainzJSONReader(cdStubsJson); + MusicBrainzCDStub[] cdStubs = reader.getCDStubs(); + DefaultTableModel tableModel = reader.getCDStubsAsTableModel(cdStubs); + + assertNotNull(tableModel); + assertEquals(2, tableModel.getRowCount()); + assertEquals(4, tableModel.getColumnCount()); + + assertEquals("Songs From The Big Chair", tableModel.getValueAt(0, 0)); + assertEquals("Tears For Fears", tableModel.getValueAt(0, 1)); + assertEquals("8", tableModel.getValueAt(0, 2)); + assertEquals("", tableModel.getValueAt(0, 3)); + + assertEquals("+", tableModel.getValueAt(1, 0)); + assertEquals("Ed Sheeran", tableModel.getValueAt(1, 1)); + assertEquals("13", tableModel.getValueAt(1, 2)); + assertEquals("", tableModel.getValueAt(1, 3)); + } + + private String readFile(String filePath) { + try { + return new String(Files.readAllBytes(Paths.get(filePath))); + } catch (IOException e) { + System.out.println("There was an IO exception when reading the examples."); + return ""; + } + } +} \ No newline at end of file diff --git a/src/test/resources/CDStubExample.json b/src/test/resources/CDStubExample.json new file mode 100644 index 0000000..01fa4fc --- /dev/null +++ b/src/test/resources/CDStubExample.json @@ -0,0 +1,23 @@ +{ + "created": "2025-04-11T00:28:16.657Z", + "count": 76474, + "offset": 0, + "cdstubs": [ + { + "id": "hU2FJcnlVtratcrOn9rAhPzzCMo-", + "score": 100, + "count": 8, + "title": "Songs From The Big Chair", + "artist": "Tears For Fears", + "barcode": "042282430021" + }, + { + "id": "KZn02eYalzdXJNbtmuz2xKDzLZU-", + "score": 100, + "count": 13, + "title": "+", + "artist": "Ed Sheeran", + "barcode": "825646634422" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/ReleaseExample.json b/src/test/resources/ReleaseExample.json new file mode 100644 index 0000000..84d4317 --- /dev/null +++ b/src/test/resources/ReleaseExample.json @@ -0,0 +1,105 @@ +{ + "created": "2025-04-10T17:40:09.895Z", + "count": 54960, + "offset": 0, + "releases": [ + { + "id": "b47fb945-e576-4f89-bd83-8b5e809fbd0b", + "score": 100, + "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", + "packaging-id": "119eba76-b343-3e02-a292-f0f00644bb9b", + "count": 1, + "title": "Nights Like This", + "status": "Official", + "packaging": "None", + "text-representation": { + "language": "eng", + "script": "Latn" + }, + "artist-credit": [ + { + "name": "Witt Lowry", + "artist": { + "id": "0b4ce616-79c3-471c-9792-1b8767eca03a", + "name": "Witt Lowry", + "sort-name": "Lowry, Witt" + } + } + ], + "release-group": { + "id": "09cf8b07-f30e-47a4-b519-cf4e4a93f7c2", + "type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", + "primary-type-id": "d6038452-8ee0-3f68-affc-2de9a1ede0b9", + "title": "Nights Like This", + "primary-type": "Single" + }, + "date": "2022-10-28", + "country": "XW", + "release-events": [ + { + "date": "2022-10-28", + "area": { + "id": "525d4e18-3d00-31b9-a58b-a146a916de8f", + "name": "[Worldwide]", + "sort-name": "[Worldwide]", + "iso-3166-1-codes": [ + "XW" + ] + } + } + ], + "barcode": "859767027191", + "label-info": [ + { + "label": { + "id": "43f04ad4-1703-484f-a529-a0ba1932115b", + "name": "Witt Lowry" + } + } + ], + "track-count": 1, + "media": [ + { + "format": "Digital Media", + "disc-count": 0, + "track-count": 1 + } + ] + }, + { + "id": "846ee5f9-ad18-4f3a-a883-43ec58ca0805", + "score": 100, + "status-id": "4e304316-386d-3409-af2e-78857eec5cfe", + "count": 1, + "title": "Nights Like This", + "status": "Official", + "artist-credit": [ + { + "name": "Kaylee Bell", + "artist": { + "id": "327a36ef-1065-4e76-96d6-b5a89c01a64d", + "name": "Kaylee Bell", + "sort-name": "Bell Kaylee", + "disambiguation": "singer from New Zealand" + } + } + ], + "release-group": { + "id": "b8ea2772-ad44-497f-b7dd-23cff0c85389", + "type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", + "primary-type-id": "f529b476-6e62-324f-b0aa-1f3e33d313fc", + "title": "Nights Like This", + "primary-type": "Album" + }, + "asin": "B0CSJX9KTB", + "track-count": 11, + "media": [ + { + "format": "Digital Media", + "disc-count": 0, + "track-count": 11 + } + ] + } + ] +} \ No newline at end of file