diff --git a/example cdstub json.json b/example cdstub json.json new file mode 100644 index 0000000..620a03e --- /dev/null +++ b/example cdstub json.json @@ -0,0 +1,223 @@ +{ + "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 new file mode 100644 index 0000000..6570c2e --- /dev/null +++ b/example json.json @@ -0,0 +1,1592 @@ +{ + "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 fa86e2f..ec15881 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.3.3"; + public static final String VERSION = "1.4.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 7140bf5..e3c6ea7 100644 --- a/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzCDStub.java +++ b/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzCDStub.java @@ -11,57 +11,55 @@ package com.CDPrintable.MusicBrainzResources; public class MusicBrainzCDStub { - public String discID; - public String discTitle; - public String discArtist; - public int trackCount; - public int releaseYear; + private String id; + private String title; + private String[] artists; + private int trackCount; - public MusicBrainzCDStub(String discID, String discTitle, String discArtist, int trackCount, int releaseYear) { - this.discID = discID; - this.discTitle = discTitle; - this.discArtist = discArtist; + public MusicBrainzCDStub(String id, String title, String[] artists, int trackCount) { + this.id = id; + this.title = title; + this.artists = artists; this.trackCount = trackCount; - this.releaseYear = releaseYear; } - public String getDiscTitle() { - return discTitle; + public String getArtistsAsString() { + StringBuilder sb = new StringBuilder(); + for (String artist : artists) { + sb.append(artist).append(", "); + } + return sb.substring(0, sb.length() - 2); } - public void setDiscTitle(String discTitle) { - this.discTitle = discTitle; + public String getId() { + return id; } - public String getDiscArtist() { - return discArtist; + public void setId(String id) { + this.id = id; } - public void setDiscArtist(String discArtist) { - this.discArtist = discArtist; + public String getTitle() { + return title; } - public int getTrackCount() { - return trackCount; - } - - public void setTrackCount(int trackCount) { - this.trackCount = trackCount; + public void setTitle(String title) { + this.title = title; } - public int getReleaseYear() { - return releaseYear; + public String[] getArtists() { + return artists; } - public void setReleaseYear(int releaseYear) { - this.releaseYear = releaseYear; + public void setArtists(String[] artists) { + this.artists = artists; } - public String getDiscID() { - return discID; + public int getTrackCount() { + return trackCount; } - public void setDiscID(String discID) { - this.discID = discID; + public void setTrackCount(int trackCount) { + this.trackCount = trackCount; } } diff --git a/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzJSONReader.java b/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzJSONReader.java new file mode 100644 index 0000000..c2e92db --- /dev/null +++ b/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzJSONReader.java @@ -0,0 +1,122 @@ +/* + * CDPrintable: A program that prints labels with track listings for your CD cases. + * Copyright (C) 2025 Alexander McLean + * + * This source code is licensed under the GNU General Public License v3.0 + * found in the LICENSE file in the root directory of this source tree. + * + * This is the JSON reader for this project. It reads the output from the web request. + */ + +package com.CDPrintable.MusicBrainzResources; + +import com.google.gson.*; + +import javax.swing.table.DefaultTableModel; +import java.lang.reflect.Array; + +public class MusicBrainzJSONReader { + private final JsonObject json; + + public MusicBrainzJSONReader(String json) { + JsonElement jsonElement = JsonParser.parseString(json); + this.json = jsonElement.getAsJsonObject(); + } + + @SuppressWarnings("unchecked") + private T[] parseJsonArray(String key, JsonArrayProcessor processor, T[] array) { + if (!json.has(key)) {return null;} + JsonArray jsonArray = json.getAsJsonArray(key); + array = (T[]) Array.newInstance(array.getClass().getComponentType(), jsonArray.size()); + + for (int i = 0; i < jsonArray.size(); i++) { + JsonObject jsonObject = jsonArray.get(i).getAsJsonObject(); + array[i] = processor.process(jsonObject); + } + return array; + } + + /* + * Gets releases from the JSON. + * @return An array of the releases. + */ + 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; + + JsonArray artistsArray = jsonObject.getAsJsonArray("artist-credit"); + String[] artists = new String[artistsArray.size()]; + for (int j = 0; j < artistsArray.size(); j++) { + JsonObject artistObject = artistsArray.get(j).getAsJsonObject(); + JsonElement artistElement = artistObject.get("name"); + artists[j] = artistElement != null ? artistElement.getAsString() : null; + } + + return new MusicBrainzRelease(title, artists, date, trackCount, id); + }, new MusicBrainzRelease[0]); + } + + 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; + return new MusicBrainzCDStub(id, title, new String[] {artist}, trackCount); + }, new MusicBrainzCDStub[0]); + } + + /* + * Creates a table model from an array of items. + * @param items The array of items. Usually a MusicBrainzRelease, MusicBrainzCDStub, etc. + * @param columnNames The names of the columns. + * @param extractor The extractor that extracts the data from the item. + */ + private DefaultTableModel createTableModel(Object[] items, String[] columnNames, DataExtractor extractor) { + String[][] data = new String[items.length][columnNames.length]; + for (int i = 0; i < items.length; i++) { + data[i] = extractor.extractData(items[i]); + } + return new DefaultTableModel(data, columnNames); + } + + public DefaultTableModel getReleasesAsTableModel(MusicBrainzRelease[] releaseArray) { + String[] columnNames = {"Release Name", "Artist", "Track Count", "Date", ""}; + return createTableModel(releaseArray, columnNames, item -> { + MusicBrainzRelease release = (MusicBrainzRelease) item; + return new String[]{ + release.getTitle(), + release.getArtistsAsString(), + String.valueOf(release.getTrackCount()), + release.getDate(), + "" + }; + }); + } + + public DefaultTableModel getCDStubsAsTableModel(MusicBrainzCDStub[] cdStubArray) { + String[] columnNames = {"Disc Name", "Artist", "Track Count", ""}; + return createTableModel(cdStubArray, columnNames, item -> { + MusicBrainzCDStub cdStub = (MusicBrainzCDStub) item; + return new String[]{ + cdStub.getTitle(), + cdStub.getArtistsAsString(), + String.valueOf(cdStub.getTrackCount()), + "" + }; + }); + } + + @FunctionalInterface + private interface DataExtractor { + String[] extractData(Object item); + } + + @FunctionalInterface + private interface JsonArrayProcessor { + T process(JsonObject jsonObject); + } +} diff --git a/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzRelease.java b/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzRelease.java new file mode 100644 index 0000000..86dae40 --- /dev/null +++ b/src/main/java/com/CDPrintable/MusicBrainzResources/MusicBrainzRelease.java @@ -0,0 +1,75 @@ +/* + * CDPrintable: A program that prints labels with track listings for your CD cases. + * Copyright (C) 2025 Alexander McLean + * + * This source code is licensed under the GNU General Public License v3.0 + * found in the LICENSE file in the root directory of this source tree. + * + * This is a class that stores release data from the JSON reader. + */ + +package com.CDPrintable.MusicBrainzResources; + +public class MusicBrainzRelease { + private String title; + private String[] artists; + private String date; + private int trackCount; + private String id; + + public MusicBrainzRelease(String title, String[] artists, String date, int trackCount, String id) { + this.title = title; + this.artists = artists; + this.date = date; + this.trackCount = trackCount; + this.id = id; + } + + public String getArtistsAsString() { + StringBuilder sb = new StringBuilder(); + for (String artist : artists) { + sb.append(artist).append(", "); + } + return sb.substring(0, sb.length() - 2); + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String[] getArtists() { + return artists; + } + + public void setArtists(String[] artists) { + this.artists = artists; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public int getTrackCount() { + return trackCount; + } + + public void setTrackCount(int trackCount) { + this.trackCount = trackCount; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} diff --git a/src/main/java/com/CDPrintable/ProgramWindow.java b/src/main/java/com/CDPrintable/ProgramWindow.java index 3f0b5eb..c357d3d 100644 --- a/src/main/java/com/CDPrintable/ProgramWindow.java +++ b/src/main/java/com/CDPrintable/ProgramWindow.java @@ -10,6 +10,11 @@ package com.CDPrintable; +import com.CDPrintable.MusicBrainzResources.MusicBrainzCDStub; +import com.CDPrintable.MusicBrainzResources.MusicBrainzJSONReader; +import com.CDPrintable.MusicBrainzResources.MusicBrainzRelease; +import com.CDPrintable.MusicBrainzResources.MusicBrainzRequest; + import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; @@ -69,13 +74,13 @@ private JPanel searchPanel() { trackListPanel.add(trackListScrollPane, BorderLayout.CENTER); // Add the Track List panel to the main panel - panel.add(trackListPanel, BorderLayout.NORTH); + panel.add(trackListPanel, BorderLayout.CENTER); // CD Search Panel set up JPanel cdSearchPanel = new JPanel(); cdSearchPanel.setBorder(BorderFactory.createTitledBorder("Search")); JTextField searchField = new JTextField(15); - JComboBox searchTypeComboBox = new JComboBox<>(new String[] {"CDStub", "Artist", "Release"}); + JComboBox searchTypeComboBox = new JComboBox<>(new String[] {"CDStub", "Artist", "Release"}); JButton searchButton = new JButton("Search"); searchButton.addActionListener(e -> { if (searchTypeComboBox.getSelectedItem() == null) { @@ -83,10 +88,19 @@ private JPanel searchPanel() { } if (searchTypeComboBox.getSelectedItem().equals("CDStub")) { searchTable.setModel(getCDStubModel()); + MusicBrainzJSONReader reader = sendRequest("cdstub", searchField.getText()); + + + MusicBrainzCDStub[] cdStubs = reader.getCDStubs(); + searchTable.setModel(reader.getCDStubsAsTableModel(cdStubs)); } else if (searchTypeComboBox.getSelectedItem().equals("Artist")) { searchTable.setModel(getArtistModel()); } else if (searchTypeComboBox.getSelectedItem().equals("Release")) { searchTable.setModel(getReleaseModel()); + MusicBrainzJSONReader reader = sendRequest("release", searchField.getText()); + + MusicBrainzRelease[] releases = reader.getReleases(); + searchTable.setModel(reader.getReleasesAsTableModel(releases)); } else { JOptionPane.showMessageDialog(panel, "Please select a search type."); } @@ -102,6 +116,23 @@ private JPanel searchPanel() { return panel; } + private MusicBrainzJSONReader sendRequest(String queryType, String query) { + MusicBrainzRequest request = new MusicBrainzRequest(queryType, query); + WebRequest webRequest = new WebRequest(request, userAgent); + + String response = null; + try { + response = webRequest.sendRequest(); + } catch (Exception ex) { + JOptionPane.showMessageDialog(null, "There was a fatal error when sending the request. Please try again or submit an issue on GitHub.\nHere are some things to try:\n" + + "• Check your internet connection.\n" + + "• Remove any special characters from your query."); + } + + MusicBrainzJSONReader reader = new MusicBrainzJSONReader(response); + return reader; + } + private DefaultTableModel getCDStubModel() { String[] columnNames = {"Disc Name", "Artist", "Track Count", ""}; String[][] data = {{"", "", "", ""}}; @@ -115,7 +146,7 @@ private DefaultTableModel getArtistModel() { } private DefaultTableModel getReleaseModel() { - String[] columnNames = {"Release Name", "Artist", "Track Count", ""}; + String[] columnNames = {"Release Name", "Artist", "Track Count", "Date", ""}; String[][] data = {{"", "", "", ""}}; return new javax.swing.table.DefaultTableModel(data, columnNames); }