diff --git a/gen-editors-picks.py b/gen-editors-picks.py new file mode 100644 index 0000000..eb3a8e4 --- /dev/null +++ b/gen-editors-picks.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 + +import urllib.request +import json +import sys + +ALBUMS = [ + 324660713, + 15427733, + 464178301, + 75115890, + 410197513, + 418729278, + 504004321, + 510893864, + 325723583, + 336178142, + 106369871, + 423471869, +] + +TOKEN = "eyJraWQiOiJ2OU1GbFhqWSIsImFsZyI6IkVTMjU2In0.eyJ0eXBlIjoibzJfYWNjZXNzIiwic2NvcGUiOiIiLCJnVmVyIjowLCJzVmVyIjowLCJjaWQiOjEzNTU3LCJhdCI6IklOVEVSTkFMIiwiZXhwIjoxNzc1MTI4ODUzLCJpc3MiOiJodHRwczovL2F1dGgudGlkYWwuY29tL3YxIn0.qRoN8BRLM3R5WAXM3kS2hkWyaGk5tWF0FaHWJmkrWNvI48hKyS9lhVOTSnP1XkFEfdXv6aTzGUNUewyp-O_d3w" + +HEADERS = { + "accept": "*/*", + "authorization": f"Bearer {TOKEN}", +} + +def fetch_album(album_id): + url = f"https://api.tidal.com/v1/albums/{album_id}?countryCode=US" + req = urllib.request.Request(url, headers=HEADERS) + try: + with urllib.request.urlopen(req) as resp: + return json.loads(resp.read().decode()) + except Exception as e: + print(f"Error fetching {album_id}: {e}", file=sys.stderr) + return None + +def transform_album(api_data): + return { + "type": "album", + "id": api_data.get("id"), + "title": api_data.get("title"), + "artist": { + "id": api_data.get("artist", {}).get("id"), + "name": api_data.get("artist", {}).get("name"), + }, + "releaseDate": api_data.get("releaseDate"), + "cover": api_data.get("cover"), + "explicit": api_data.get("explicit"), + "audioQuality": api_data.get("audioQuality"), + "mediaMetadata": api_data.get("mediaMetadata"), + } + +picks = [] +for album_id in ALBUMS: + data = fetch_album(album_id) + if data: + picks.append(transform_album(data)) + +with open("public/editors-picks.json", "w") as f: + json.dump(picks, f, indent=4) + +print(f"Written {len(picks)} albums to public/editors-picks.json") diff --git a/public/editors-picks.json b/public/editors-picks.json index 6ce3464..8ab398b 100644 --- a/public/editors-picks.json +++ b/public/editors-picks.json @@ -1,134 +1,223 @@ [ - { - "type": "album", - "id": 510893864, - "title": "BULLY", - "artist": { "id": 25022, "name": "Kanye West" }, - "releaseDate": "2026-03-28", - "cover": "cf2f2c9c-ff67-44f6-83aa-a7622f8c6b64", - "explicit": true, - "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS", "HIRES_LOSSLESS"] } - }, { "type": "album", "id": 324660713, "title": "JOECHILLWORLD", - "artist": { "id": 40978758, "name": "Devon Hendryx" }, + "artist": { + "id": 40978758, + "name": "Devon Hendryx" + }, "releaseDate": "2010-07-10", "cover": "25d45544-3e82-4184-b8c2-2c2c6f0f152a", "explicit": true, "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS", "HIRES_LOSSLESS"] } + "mediaMetadata": { + "tags": [ + "LOSSLESS", + "HIRES_LOSSLESS" + ] + } }, { "type": "album", "id": 15427733, "title": "Mysterious Phonk: The Chronicles of SpaceGhostPurrp", - "artist": { "id": 4611745, "name": "Spaceghostpurrp" }, + "artist": { + "id": 4611745, + "name": "Spaceghostpurrp" + }, "releaseDate": "2012-06-12", "cover": "c78b7543-1cd8-4921-9155-e81d421353a0", "explicit": true, "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS"] } + "mediaMetadata": { + "tags": [ + "LOSSLESS" + ] + } }, { "type": "album", "id": 464178301, "title": "Never Forget", - "artist": { "id": 5516508, "name": "Chris Travis" }, + "artist": { + "id": 5516508, + "name": "Chris Travis" + }, "releaseDate": "2014-05-14", "cover": "4ab11f0d-0768-4cce-8de5-1894134d5994", "explicit": true, "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS"] } + "mediaMetadata": { + "tags": [ + "LOSSLESS" + ] + } }, { "type": "album", "id": 75115890, "title": "Blood Shore Season 2", - "artist": { "id": 6332342, "name": "Xavier Wulf" }, + "artist": { + "id": 6332342, + "name": "Xavier Wulf" + }, "releaseDate": "2014-10-30", "cover": "517303e5-d541-4704-b552-026427e05fcb", "explicit": true, "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS"] } + "mediaMetadata": { + "tags": [ + "LOSSLESS" + ] + } }, { "type": "album", "id": 410197513, "title": "THE PEAK", - "artist": { "id": 33481052, "name": "smokedope2016" }, + "artist": { + "id": 33481052, + "name": "smokedope2016" + }, "releaseDate": "2025-01-17", "cover": "ea18084d-36ec-4cea-98a7-fe4684246986", "explicit": true, "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS"] } + "mediaMetadata": { + "tags": [ + "LOSSLESS" + ] + } }, { "type": "album", "id": 418729278, "title": "I LAY DOWN MY LIFE FOR YOU: DIRECTOR'S CUT", - "artist": { "id": 7958797, "name": "JPEGMAFIA" }, + "artist": { + "id": 7958797, + "name": "JPEGMAFIA" + }, "releaseDate": "2025-02-03", "cover": "9c84302b-2584-4c0a-9db7-e648542f459f", "explicit": true, "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS", "HIRES_LOSSLESS"] } + "mediaMetadata": { + "tags": [ + "LOSSLESS", + "HIRES_LOSSLESS" + ] + } }, { "type": "album", "id": 504004321, "title": "Half Blood (BloodLuxe)", - "artist": { "id": 50799233, "name": "slayr" }, + "artist": { + "id": 50799233, + "name": "slayr" + }, "releaseDate": "2025-11-05", "cover": "2767cc63-7e92-4a48-aa4b-806a3ea7ec1c", "explicit": true, "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS", "HIRES_LOSSLESS"] } + "mediaMetadata": { + "tags": [ + "LOSSLESS", + "HIRES_LOSSLESS" + ] + } + }, + { + "type": "album", + "id": 510893864, + "title": "BULLY", + "artist": { + "id": 25022, + "name": "Kanye West" + }, + "releaseDate": "2026-03-28", + "cover": "cf2f2c9c-ff67-44f6-83aa-a7622f8c6b64", + "explicit": true, + "audioQuality": "LOSSLESS", + "mediaMetadata": { + "tags": [ + "LOSSLESS", + "HIRES_LOSSLESS" + ] + } }, { "type": "album", "id": 325723583, "title": "Replica", - "artist": { "id": 3715530, "name": "Oneohtrix Point Never" }, + "artist": { + "id": 3715530, + "name": "Oneohtrix Point Never" + }, "releaseDate": "2011-11-05", "cover": "95ceeae9-cac7-42dc-ae37-7c93c223f809", "explicit": false, "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS"] } + "mediaMetadata": { + "tags": [ + "LOSSLESS" + ] + } }, { "type": "album", "id": 336178142, "title": "Pirate This Album", - "artist": { "id": 8622751, "name": "Shamana" }, + "artist": { + "id": 8622751, + "name": "Shamana" + }, "releaseDate": "2023-12-25", "cover": "a8a647be-0331-4779-9a6e-31645a9abdab", "explicit": true, "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS", "HIRES_LOSSLESS"] } + "mediaMetadata": { + "tags": [ + "LOSSLESS", + "HIRES_LOSSLESS" + ] + } }, { "type": "album", "id": 106369871, "title": "Organic Thoughts from the Synthetic Mind", - "artist": { "id": 6436013, "name": "Shinjuku Mad" }, + "artist": { + "id": 6436013, + "name": "Shinjuku Mad" + }, "releaseDate": "2009-07-01", "cover": "3acc888e-35da-40a8-a4b7-7ffd00576cc9", "explicit": true, "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS"] } + "mediaMetadata": { + "tags": [ + "LOSSLESS" + ] + } }, { "type": "album", "id": 423471869, "title": "pain", - "artist": { "id": 44257324, "name": "bleood" }, + "artist": { + "id": 44257324, + "name": "bleood" + }, "releaseDate": "2025-03-11", "cover": "711b23ba-c473-44e6-a2f0-010fefa9c5b8", "explicit": true, "audioQuality": "LOSSLESS", - "mediaMetadata": { "tags": ["LOSSLESS"] } + "mediaMetadata": { + "tags": [ + "LOSSLESS" + ] + } } -] +] \ No newline at end of file