diff --git a/music/composer.json b/music/composer.json
index d7c6bb7..6a06f25 100644
--- a/music/composer.json
+++ b/music/composer.json
@@ -1,5 +1,6 @@
{
"require": {
- "vlucas/phpdotenv": "^5.6"
+ "vlucas/phpdotenv": "^5.6",
+ "aslamhus/spotify-client": "^1.2"
}
}
diff --git a/music/composer.lock b/music/composer.lock
index 7835c2d..4669720 100644
--- a/music/composer.lock
+++ b/music/composer.lock
@@ -4,8 +4,50 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "108be68e4e2b97fed51d36a10eed0849",
+ "content-hash": "1d873aeac830113b36cf190390c9b4f4",
"packages": [
+ {
+ "name": "aslamhus/spotify-client",
+ "version": "v1.2.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/aslamhus/Spotify.git",
+ "reference": "f4d3af22a1b383fa46437f298dfd91fb2ffe42ad"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/aslamhus/Spotify/zipball/f4d3af22a1b383fa46437f298dfd91fb2ffe42ad",
+ "reference": "f4d3af22a1b383fa46437f298dfd91fb2ffe42ad",
+ "shasum": ""
+ },
+ "require": {
+ "guzzlehttp/guzzle": "^7.8",
+ "guzzlehttp/psr7": "^2.6"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.6",
+ "vlucas/phpdotenv": "^5.6"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Aslamhus\\SpotifyClient\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "authors": [
+ {
+ "name": "aslamhus",
+ "email": "aslam.percy.husain@gmail.com"
+ }
+ ],
+ "description": "A PHP library for the spotify API",
+ "support": {
+ "issues": "https://github.com/aslamhus/Spotify/issues",
+ "source": "https://github.com/aslamhus/Spotify/tree/v1.2.8"
+ },
+ "time": "2024-01-17T02:35:45+00:00"
+ },
{
"name": "graham-campbell/result-type",
"version": "v1.1.3",
@@ -68,6 +110,331 @@
],
"time": "2024-07-20T21:45:45+00:00"
},
+ {
+ "name": "guzzlehttp/guzzle",
+ "version": "7.9.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/guzzle.git",
+ "reference": "d281ed313b989f213357e3be1a179f02196ac99b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b",
+ "reference": "d281ed313b989f213357e3be1a179f02196ac99b",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "guzzlehttp/promises": "^1.5.3 || ^2.0.3",
+ "guzzlehttp/psr7": "^2.7.0",
+ "php": "^7.2.5 || ^8.0",
+ "psr/http-client": "^1.0",
+ "symfony/deprecation-contracts": "^2.2 || ^3.0"
+ },
+ "provide": {
+ "psr/http-client-implementation": "1.0"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.8.2",
+ "ext-curl": "*",
+ "guzzle/client-integration-tests": "3.0.2",
+ "php-http/message-factory": "^1.1",
+ "phpunit/phpunit": "^8.5.39 || ^9.6.20",
+ "psr/log": "^1.1 || ^2.0 || ^3.0"
+ },
+ "suggest": {
+ "ext-curl": "Required for CURL handler support",
+ "ext-intl": "Required for Internationalized Domain Name (IDN) support",
+ "psr/log": "Required for using the Log middleware"
+ },
+ "type": "library",
+ "extra": {
+ "bamarni-bin": {
+ "bin-links": true,
+ "forward-command": false
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/functions_include.php"
+ ],
+ "psr-4": {
+ "GuzzleHttp\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Graham Campbell",
+ "email": "hello@gjcampbell.co.uk",
+ "homepage": "https://github.com/GrahamCampbell"
+ },
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ },
+ {
+ "name": "Jeremy Lindblom",
+ "email": "jeremeamia@gmail.com",
+ "homepage": "https://github.com/jeremeamia"
+ },
+ {
+ "name": "George Mponos",
+ "email": "gmponos@gmail.com",
+ "homepage": "https://github.com/gmponos"
+ },
+ {
+ "name": "Tobias Nyholm",
+ "email": "tobias.nyholm@gmail.com",
+ "homepage": "https://github.com/Nyholm"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com",
+ "homepage": "https://github.com/sagikazarmark"
+ },
+ {
+ "name": "Tobias Schultze",
+ "email": "webmaster@tubo-world.de",
+ "homepage": "https://github.com/Tobion"
+ }
+ ],
+ "description": "Guzzle is a PHP HTTP client library",
+ "keywords": [
+ "client",
+ "curl",
+ "framework",
+ "http",
+ "http client",
+ "psr-18",
+ "psr-7",
+ "rest",
+ "web service"
+ ],
+ "support": {
+ "issues": "https://github.com/guzzle/guzzle/issues",
+ "source": "https://github.com/guzzle/guzzle/tree/7.9.2"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/GrahamCampbell",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/Nyholm",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-07-24T11:22:20+00:00"
+ },
+ {
+ "name": "guzzlehttp/promises",
+ "version": "2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/promises.git",
+ "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
+ "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2.5 || ^8.0"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.8.2",
+ "phpunit/phpunit": "^8.5.39 || ^9.6.20"
+ },
+ "type": "library",
+ "extra": {
+ "bamarni-bin": {
+ "bin-links": true,
+ "forward-command": false
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Promise\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Graham Campbell",
+ "email": "hello@gjcampbell.co.uk",
+ "homepage": "https://github.com/GrahamCampbell"
+ },
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ },
+ {
+ "name": "Tobias Nyholm",
+ "email": "tobias.nyholm@gmail.com",
+ "homepage": "https://github.com/Nyholm"
+ },
+ {
+ "name": "Tobias Schultze",
+ "email": "webmaster@tubo-world.de",
+ "homepage": "https://github.com/Tobion"
+ }
+ ],
+ "description": "Guzzle promises library",
+ "keywords": [
+ "promise"
+ ],
+ "support": {
+ "issues": "https://github.com/guzzle/promises/issues",
+ "source": "https://github.com/guzzle/promises/tree/2.0.4"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/GrahamCampbell",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/Nyholm",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-10-17T10:06:22+00:00"
+ },
+ {
+ "name": "guzzlehttp/psr7",
+ "version": "2.7.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/psr7.git",
+ "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
+ "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2.5 || ^8.0",
+ "psr/http-factory": "^1.0",
+ "psr/http-message": "^1.1 || ^2.0",
+ "ralouphie/getallheaders": "^3.0"
+ },
+ "provide": {
+ "psr/http-factory-implementation": "1.0",
+ "psr/http-message-implementation": "1.0"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.8.2",
+ "http-interop/http-factory-tests": "0.9.0",
+ "phpunit/phpunit": "^8.5.39 || ^9.6.20"
+ },
+ "suggest": {
+ "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
+ },
+ "type": "library",
+ "extra": {
+ "bamarni-bin": {
+ "bin-links": true,
+ "forward-command": false
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Psr7\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Graham Campbell",
+ "email": "hello@gjcampbell.co.uk",
+ "homepage": "https://github.com/GrahamCampbell"
+ },
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ },
+ {
+ "name": "George Mponos",
+ "email": "gmponos@gmail.com",
+ "homepage": "https://github.com/gmponos"
+ },
+ {
+ "name": "Tobias Nyholm",
+ "email": "tobias.nyholm@gmail.com",
+ "homepage": "https://github.com/Nyholm"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com",
+ "homepage": "https://github.com/sagikazarmark"
+ },
+ {
+ "name": "Tobias Schultze",
+ "email": "webmaster@tubo-world.de",
+ "homepage": "https://github.com/Tobion"
+ },
+ {
+ "name": "Márk Sági-Kazár",
+ "email": "mark.sagikazar@gmail.com",
+ "homepage": "https://sagikazarmark.hu"
+ }
+ ],
+ "description": "PSR-7 message implementation that also provides common utility methods",
+ "keywords": [
+ "http",
+ "message",
+ "psr-7",
+ "request",
+ "response",
+ "stream",
+ "uri",
+ "url"
+ ],
+ "support": {
+ "issues": "https://github.com/guzzle/psr7/issues",
+ "source": "https://github.com/guzzle/psr7/tree/2.7.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/GrahamCampbell",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/Nyholm",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-07-18T11:15:46+00:00"
+ },
{
"name": "phpoption/phpoption",
"version": "1.9.3",
@@ -143,6 +510,277 @@
],
"time": "2024-07-20T21:41:07+00:00"
},
+ {
+ "name": "psr/http-client",
+ "version": "1.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-client.git",
+ "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
+ "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0 || ^8.0",
+ "psr/http-message": "^1.0 || ^2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Client\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP clients",
+ "homepage": "https://github.com/php-fig/http-client",
+ "keywords": [
+ "http",
+ "http-client",
+ "psr",
+ "psr-18"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-client"
+ },
+ "time": "2023-09-23T14:17:50+00:00"
+ },
+ {
+ "name": "psr/http-factory",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-factory.git",
+ "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
+ "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1",
+ "psr/http-message": "^1.0 || ^2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
+ "keywords": [
+ "factory",
+ "http",
+ "message",
+ "psr",
+ "psr-17",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-factory"
+ },
+ "time": "2024-04-15T12:06:14+00:00"
+ },
+ {
+ "name": "psr/http-message",
+ "version": "2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-message.git",
+ "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
+ "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2 || ^8.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP messages",
+ "homepage": "https://github.com/php-fig/http-message",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-message/tree/2.0"
+ },
+ "time": "2023-04-04T09:54:51+00:00"
+ },
+ {
+ "name": "ralouphie/getallheaders",
+ "version": "3.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/ralouphie/getallheaders.git",
+ "reference": "120b605dfeb996808c31b6477290a714d356e822"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
+ "reference": "120b605dfeb996808c31b6477290a714d356e822",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6"
+ },
+ "require-dev": {
+ "php-coveralls/php-coveralls": "^2.1",
+ "phpunit/phpunit": "^5 || ^6.5"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/getallheaders.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Ralph Khattar",
+ "email": "ralph.khattar@gmail.com"
+ }
+ ],
+ "description": "A polyfill for getallheaders.",
+ "support": {
+ "issues": "https://github.com/ralouphie/getallheaders/issues",
+ "source": "https://github.com/ralouphie/getallheaders/tree/develop"
+ },
+ "time": "2019-03-08T08:55:37+00:00"
+ },
+ {
+ "name": "symfony/deprecation-contracts",
+ "version": "v3.5.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/deprecation-contracts.git",
+ "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
+ "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "type": "library",
+ "extra": {
+ "thanks": {
+ "url": "https://github.com/symfony/contracts",
+ "name": "symfony/contracts"
+ },
+ "branch-alias": {
+ "dev-main": "3.5-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "function.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "A generic function and convention to trigger deprecation notices",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-09-25T14:20:29+00:00"
+ },
{
"name": "symfony/polyfill-ctype",
"version": "v1.31.0",
diff --git a/music/core.php b/music/core.php
new file mode 100644
index 0000000..2e7f596
--- /dev/null
+++ b/music/core.php
@@ -0,0 +1,39 @@
+ 'Abyss', 'artist' => 'Pastel Ghost', 'link' => 'https://open.spotify.com/album/2FQieUp8BxPN7OR8fE76TE'),
+ array('name' => 'Golden Age - The 4th Album', 'artist' => 'NCT 127', 'link' => 'https://open.spotify.com/album/5mUo2e4QpUA7NJl2t51uFu'),
+ array('name' => 'To Pimp a Butterfly', 'artist' => 'Kendrick Lamar', 'link' => 'https://open.spotify.com/album/7ycBtnsMtyVbbwTfJwRjSP'),
+ array('name' => 'Off the Wall', 'artist' => 'Michael Jackson', 'link' => 'https://open.spotify.com/album/2ZytN2cY4Zjrr9ukb2rqTP'),
+ array('name' => 'Vol. 3: The Subliminal Verses', 'artist' => 'Slipknot', 'link' => 'https://open.spotify.com/album/4ZDBQSIDIZRUBOG2OHcN3T'),
+ array('name' => 'Этажи', 'artist' => 'Molchat Doma', 'link' => 'https://open.spotify.com/album/1FHREwXgTQvqiG8q5KlRzc'),
+ array('name' => 'Hot Pink', 'artist' => 'Doja Cat', 'link' => 'https://open.spotify.com/album/1MmVkhiwTH0BkNOU3nw5d3'),
+ array('name' => 'Currents', 'artist' => 'Tame Impala', 'link' => 'https://open.spotify.com/album/79dL7FLiJFOO0EoehUHQBv'),
+ array('name' => 'INSIDE', 'artist' => 'Bo Burnham', 'link' => 'https://open.spotify.com/album/35qVMfUfBN6q2xzm9rZn5a'),
+ array('name' => 'Teenage Dream', 'artist' => 'Katy Perry', 'link' => 'https://open.spotify.com/album/2eQMC9nJE3f3hCNKlYYHL1'),
+ ];
+ shuffle($albums);
+
+ $content = '';
+ foreach ($albums as $album) {
+ $content = $content . '
+
+ | ' . $album['name'] . ' |
+ ' . $album['artist'] . ' |
+
';
+ }
+
+ $html = '
+
+
+ | Name |
+ Artist |
+
+ ' . $content . '
+
+ ';
+
+ return $html;
+}
+?>
diff --git a/music/css/styles.css b/music/css/styles.css
index e69de29..8b13789 100644
--- a/music/css/styles.css
+++ b/music/css/styles.css
@@ -0,0 +1 @@
+
diff --git a/music/explore.php b/music/explore.php
new file mode 100644
index 0000000..9b4aa03
--- /dev/null
+++ b/music/explore.php
@@ -0,0 +1,109 @@
+safeLoad();
+$html = '';
+
+$client_id = $_ENV['SPOTIFY_CLIENT_ID'];
+$client_secret = $_ENV['SPOTIFY_CLIENT_SECRET'];
+$access_token = get_access_token($client_id, $client_secret);
+
+// TODO: Dynamically retrieve top 10 albums from Spotify API
+// TODO: Implement server-side caching for faster load times.
+$albums = [
+ '2FQieUp8BxPN7OR8fE76TE',
+ '5mUo2e4QpUA7NJl2t51uFu',
+ '7ycBtnsMtyVbbwTfJwRjSP',
+ '2ZytN2cY4Zjrr9ukb2rqTP',
+ '4ZDBQSIDIZRUBOG2OHcN3T',
+ '1FHREwXgTQvqiG8q5KlRzc',
+ '1MmVkhiwTH0BkNOU3nw5d3',
+ '79dL7FLiJFOO0EoehUHQBv',
+ '35qVMfUfBN6q2xzm9rZn5a',
+ '2eQMC9nJE3f3hCNKlYYHL1'
+];
+
+$content = '';
+foreach ($albums as $album_id) {
+ $data = get_album($access_token, $album_id);
+ $content = $content . '
+  |
+ ' . $data['name'] . ' |
+ ' . $data['artists'][0]['name'] . ' |
+ Spotify |
+
';
+}
+
+$html = '
+
+
+| Art |
+Name |
+Artist |
+Spotify |
+
' . $content . '
';
+
+function get_access_token($client_id, $client_secret)
+{
+ $url = 'https://accounts.spotify.com/api/token';
+
+ $data = array(
+ 'grant_type' => 'client_credentials',
+ 'client_id' => $client_id,
+ 'client_secret' => $client_secret
+ );
+
+ $post_data = http_build_query($data);
+
+ $ch = curl_init($url);
+
+ curl_setopt_array($ch, array(
+ CURLOPT_POST => true,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_HTTPHEADER => array(
+ 'Content-Type: application/x-www-form-urlencoded'
+ ),
+ CURLOPT_POSTFIELDS => $post_data
+ ));
+
+ $response = curl_exec($ch);
+
+ if (curl_errno($ch)) {
+ echo curl_error($ch);
+ } else {
+ $data = json_decode($response, true);
+ curl_close($ch);
+ return $data['access_token'];
+ }
+
+ curl_close($ch);
+}
+
+function get_album($access_token, $album_id)
+{
+ $url = 'https://api.spotify.com/v1/albums/' . $album_id;
+
+ $ch = curl_init($url);
+
+ curl_setopt_array($ch, array(
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_HTTPHEADER => array(
+ "Authorization: Bearer $access_token"
+ )
+ ));
+
+ $response = curl_exec($ch);
+
+ if (curl_errno($ch)) {
+ echo curl_error($ch);
+ } else {
+ $data = json_decode($response, true);
+ return $data;
+ }
+
+ curl_close($ch);
+}
+
+echo $html;
+?>
diff --git a/music/index.php b/music/index.php
index 86817aa..34f75c5 100644
--- a/music/index.php
+++ b/music/index.php
@@ -1,119 +1,24 @@
safeLoad();
-
-$client_id = $_ENV['SPOTIFY_CLIENT_ID'];
-$client_secret = $_ENV['SPOTIFY_CLIENT_SECRET'];
-$access_token = get_access_token($client_id, $client_secret);
-
-// TODO: Dynamically retrieve top 10 albums from Spotify API
-$albums = [
- '2FQieUp8BxPN7OR8fE76TE',
- '5mUo2e4QpUA7NJl2t51uFu',
- '7ycBtnsMtyVbbwTfJwRjSP',
- '2ZytN2cY4Zjrr9ukb2rqTP',
- '4ZDBQSIDIZRUBOG2OHcN3T',
- '1FHREwXgTQvqiG8q5KlRzc',
- '1MmVkhiwTH0BkNOU3nw5d3',
- '79dL7FLiJFOO0EoehUHQBv',
- '35qVMfUfBN6q2xzm9rZn5a',
- '2eQMC9nJE3f3hCNKlYYHL1'
-];
+session_start();
+include ('core.php');
+exec('php explore.php &');
?>
-
- Spotify Auth
-
+ Favorite Albums
+
+
-
- My Favorite Albums
-
-
- | Art |
- Name |
- Artist |
- Spotify |
-
-';
- echo ' | ';
- echo '' . $data['name'] . ' | ';
- echo '' . $data['artists'][0]['name'] . ' | ';
- echo 'Spotify | ';
- echo '';
-}
-?>
-
+ My Favorite Albums
+
+
+
+
+
-
-
- 'client_credentials',
- 'client_id' => $client_id, // Replace with your actual client ID
- 'client_secret' => $client_secret // Replace with your actual client secret
- );
-
- $post_data = http_build_query($data); // Build the URL-encoded string
-
- $ch = curl_init($url);
-
- curl_setopt_array($ch, array(
- CURLOPT_POST => true,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_HTTPHEADER => array(
- 'Content-Type: application/x-www-form-urlencoded'
- ),
- CURLOPT_POSTFIELDS => $post_data
- ));
-
- $response = curl_exec($ch);
-
- if (curl_errno($ch)) {
- echo curl_error($ch);
- } else {
- $data = json_decode($response, true); // Decode into an associative array
- curl_close($ch);
- return $data['access_token'];
- }
-
- curl_close($ch);
-}
-
-function get_album($access_token, $album_id)
-{
- $url = 'https://api.spotify.com/v1/albums/' . $album_id;
-
- $ch = curl_init($url);
-
- curl_setopt_array($ch, array(
- CURLOPT_RETURNTRANSFER => true, // Return the response as a string
- CURLOPT_HTTPHEADER => array(
- "Authorization: Bearer $access_token" // Your Bearer token here
- )
- ));
-
- $response = curl_exec($ch);
-
- if (curl_errno($ch)) {
- echo curl_error($ch);
- } else {
- $data = json_decode($response, true); // Decode into an associative array
- return $data;
- }
-
- curl_close($ch);
-}
-?>
diff --git a/music/js/switch.js b/music/js/switch.js
new file mode 100644
index 0000000..8607ee0
--- /dev/null
+++ b/music/js/switch.js
@@ -0,0 +1,10 @@
+async function modeSwitch() {
+ const content = document.getElementById("content");
+ var response = await fetch('explore.php');
+
+ if (response.status === 200) {
+ let data = async () => { return await response.text() };
+ let text = await data();
+ content.innerHTML = text;
+ }
+}
diff --git a/music/process.php b/music/process.php
new file mode 100644
index 0000000..10e2c0d
--- /dev/null
+++ b/music/process.php
@@ -0,0 +1,3 @@
+
diff --git a/music/test.php b/music/test.php
new file mode 100644
index 0000000..bf43174
--- /dev/null
+++ b/music/test.php
@@ -0,0 +1,3 @@
+Test';
+?>