diff --git a/.cache-thebrandon45 b/.cache-thebrandon45 index 5e62790..8a0c033 100644 --- a/.cache-thebrandon45 +++ b/.cache-thebrandon45 @@ -1 +1 @@ -{"access_token": "BQDT_WherHrUXbbhIgBKI7Fo7emhUb-CW2hhY2eGzJjIS01ryBT2r71AxXKkVQcX1aa7-98pw_0yMOvIjWO8w6WwJuZVTRM4y0_-NvZLuTTCCF7fr7pme0EYQ8VdHdJtxESZO81ZGatYvpt7MQ59TsTQSE9aGhIKfnTprUtWJR43XfYJn6QWcT2bfNTIkQ", "token_type": "Bearer", "expires_in": 3600, "scope": "user-modify-playback-state user-read-playback-state", "expires_at": 1671062858, "refresh_token": "AQAQRkRkmOxwR34lsJu_mpG4wxEFiNuJ1FIdmHYN5j0dClEEqMRqPPFX8jM3cQTQkRpeXXyi3xPQ8YImc7Fc-PH1CKTvyARy9VkMKXIes4-l6ijO9fVMyCNwbI0IGvpfrqE"} \ No newline at end of file +{"access_token": "BQDGLDKMfiNe4CK2l9-RdoedRx2QfGqoYkmW21bEXH43BW2731XrUtwkQnomX472HG0U04FahklGSfPSFHJLl4052Bxdypf6I1LWmlEh9Y_pGYVWxK279xyUMrg6MUksj3QcxFfn44PCajOvkgCrSQU3gdaBxbUWvNStiaYZ6DgcE2ou9fJ-HYhm3EeCkA", "token_type": "Bearer", "expires_in": 3600, "scope": "user-modify-playback-state user-read-playback-state", "expires_at": 1671086161, "refresh_token": "AQAQRkRkmOxwR34lsJu_mpG4wxEFiNuJ1FIdmHYN5j0dClEEqMRqPPFX8jM3cQTQkRpeXXyi3xPQ8YImc7Fc-PH1CKTvyARy9VkMKXIes4-l6ijO9fVMyCNwbI0IGvpfrqE"} \ No newline at end of file diff --git a/credentials.json b/credentials.json index e16ee35..c3a8ea4 100644 --- a/credentials.json +++ b/credentials.json @@ -1 +1 @@ -{"username": "thebrandon45", "credentials": "QVFESGtlN01Mb3VURGRWT1YyQy0xRHh4LXFfSmczdkdzbTNvbVRIbVNVSDVXMVg3ZjZWMmxOTWdxYnpTdG93RmpwR2tjYkhKYVBsc3h3RTVDWVVoVXh6Q2NuTlR0dHVRYXlhai1WbUQ0WnlDTEdtbDg0cVVCQUxXMEVfcno2bWpDOHdieUdneXM4N0tnQQ==", "type": "AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS"} \ No newline at end of file +{"username": "thebrandon45", "credentials": "QVFEalQxYVlobUdHczYwd21NNERDcWgxMVhtUFBlU1dicWN6VW9PR0JraDNLa0NrUDU4YlFVSzNQUDRka2NTLUo3aHVtQlFrMHJYWGlnai1pc0RQNjY4a1dDSDFZYmR6NnB6ZGhRaFd0bkNaSjVpMVZLeXlWWlE2dEJiOW5zR3RwMy1IQlkxdEJ2RjhMQQ==", "type": "AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS"} \ No newline at end of file diff --git a/icons/pause-circle.png b/icons/pause-circle.png new file mode 100644 index 0000000..3de7b92 Binary files /dev/null and b/icons/pause-circle.png differ diff --git a/icons/play-circle.png b/icons/play-circle.png new file mode 100644 index 0000000..160eeb3 Binary files /dev/null and b/icons/play-circle.png differ diff --git a/icons/skip-next.png b/icons/skip-next.png new file mode 100644 index 0000000..9b6d4c5 Binary files /dev/null and b/icons/skip-next.png differ diff --git a/icons/skip-previous.png b/icons/skip-previous.png new file mode 100644 index 0000000..edd8850 Binary files /dev/null and b/icons/skip-previous.png differ diff --git a/json_file1.txt b/json_file1.txt deleted file mode 100644 index 6ce0988..0000000 --- a/json_file1.txt +++ /dev/null @@ -1,109 +0,0 @@ -{ - "actions": { - "disallows": { - "resuming": true, - "skipping_prev": true - } - }, - "context": null, - "currently_playing_type": "track", - "device": { - "id": "3e20a2964c1151e118255b819e12e57836e32c1b", - "is_active": true, - "is_private_session": false, - "is_restricted": false, - "name": "SILVERHAND", - "type": "Computer", - "volume_percent": 20 - }, - "is_playing": true, - "item": { - "album": { - "album_type": "album", - "artists": [ - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/2tIP7SsRs7vjIcLrU85W8J" - }, - "href": "https://api.spotify.com/v1/artists/2tIP7SsRs7vjIcLrU85W8J", - "id": "2tIP7SsRs7vjIcLrU85W8J", - "name": "The Kid LAROI", - "type": "artist", - "uri": "spotify:artist:2tIP7SsRs7vjIcLrU85W8J" - } - ], - "available_markets": [ - "AD", - "ZM", - "ZW" - ], - "external_urls": { - "spotify": "https://open.spotify.com/album/3YjfdLdpQcVI72uKhooZst" - }, - "href": "https://api.spotify.com/v1/albums/3YjfdLdpQcVI72uKhooZst", - "id": "3YjfdLdpQcVI72uKhooZst", - "images": [ - { - "height": 640, - "url": "https://i.scdn.co/image/ab67616d0000b273df16d539f508603bfb1efe02", - "width": 640 - }, - { - "height": 300, - "url": "https://i.scdn.co/image/ab67616d00001e02df16d539f508603bfb1efe02", - "width": 300 - }, - { - "height": 64, - "url": "https://i.scdn.co/image/ab67616d00004851df16d539f508603bfb1efe02", - "width": 64 - } - ], - "name": "F*CK LOVE (SAVAGE)", - "release_date": "2020-11-06", - "release_date_precision": "day", - "total_tracks": 22, - "type": "album", - "uri": "spotify:album:3YjfdLdpQcVI72uKhooZst" - }, - "artists": [ - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/2tIP7SsRs7vjIcLrU85W8J" - }, - "href": "https://api.spotify.com/v1/artists/2tIP7SsRs7vjIcLrU85W8J", - "id": "2tIP7SsRs7vjIcLrU85W8J", - "name": "The Kid LAROI", - "type": "artist", - "uri": "spotify:artist:2tIP7SsRs7vjIcLrU85W8J" - } - ], - "available_markets": [ - "AD", - "ZM", - "ZW" - ], - "disc_number": 1, - "duration_ms": 151704, - "explicit": true, - "external_ids": { - "isrc": "USSM12006583" - }, - "external_urls": { - "spotify": "https://open.spotify.com/track/3QCU8BT0zDS9LPVfEhRFEE" - }, - "href": "https://api.spotify.com/v1/tracks/3QCU8BT0zDS9LPVfEhRFEE", - "id": "3QCU8BT0zDS9LPVfEhRFEE", - "is_local": false, - "name": "ALWAYS DO", - "popularity": 71, - "preview_url": "https://p.scdn.co/mp3-preview/d5f01637c9840500d1434131f804a4cc184bd1e4?cid=69b82a34d0fb40be80b020eae8e80f25", - "track_number": 4, - "type": "track", - "uri": "spotify:track:3QCU8BT0zDS9LPVfEhRFEE" - }, - "progress_ms": 25688, - "repeat_state": "off", - "shuffle_state": true, - "timestamp": 1670714537726 -} \ No newline at end of file diff --git a/json_file2.txt b/json_file2.txt deleted file mode 100644 index 4e0e559..0000000 --- a/json_file2.txt +++ /dev/null @@ -1,184 +0,0 @@ -{ - "artists": { - "href": "https://api.spotify.com/v1/search?query=artist%3Amachine+gun+kelly&type=artist&offset=0&limit=10", - "items": [ - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/6TIYQ3jFPwQSRmorSezPxX" - }, - "followers": { - "href": null, - "total": 4894771 - }, - "genres": [ - "ohio hip hop", - "pop", - "pop rap" - ], - "href": "https://api.spotify.com/v1/artists/6TIYQ3jFPwQSRmorSezPxX", - "id": "6TIYQ3jFPwQSRmorSezPxX", - "images": [ - { - "height": 640, - "url": "https://i.scdn.co/image/ab6761610000e5eb1fd54eb6e30d0bc8f633621e", - "width": 640 - }, - { - "height": 320, - "url": "https://i.scdn.co/image/ab676161000051741fd54eb6e30d0bc8f633621e", - "width": 320 - }, - { - "height": 160, - "url": "https://i.scdn.co/image/ab6761610000f1781fd54eb6e30d0bc8f633621e", - "width": 160 - } - ], - "name": "Machine Gun Kelly", - "popularity": 80, - "type": "artist", - "uri": "spotify:artist:6TIYQ3jFPwQSRmorSezPxX" - }, - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/1lP7f2evgtQcghRmqkPb3j" - }, - "followers": { - "href": null, - "total": 686 - }, - "genres": [], - "href": "https://api.spotify.com/v1/artists/1lP7f2evgtQcghRmqkPb3j", - "id": "1lP7f2evgtQcghRmqkPb3j", - "images": [ - { - "height": 640, - "url": "https://i.scdn.co/image/ab67616d0000b2734f88aa4c73f3017a3e21d9d4", - "width": 640 - }, - { - "height": 300, - "url": "https://i.scdn.co/image/ab67616d00001e024f88aa4c73f3017a3e21d9d4", - "width": 300 - }, - { - "height": 64, - "url": "https://i.scdn.co/image/ab67616d000048514f88aa4c73f3017a3e21d9d4", - "width": 64 - } - ], - "name": "Machine Gun Kelly", - "popularity": 1, - "type": "artist", - "uri": "spotify:artist:1lP7f2evgtQcghRmqkPb3j" - }, - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/4VPvSWeZ4gpl80xJBJ4Dsh" - }, - "followers": { - "href": null, - "total": 2473 - }, - "genres": [ - "swedish hard rock" - ], - "href": "https://api.spotify.com/v1/artists/4VPvSWeZ4gpl80xJBJ4Dsh", - "id": "4VPvSWeZ4gpl80xJBJ4Dsh", - "images": [ - { - "height": 640, - "url": "https://i.scdn.co/image/ab67616d0000b273bed51eb447e0d2c2fcd5d80f", - "width": 640 - }, - { - "height": 300, - "url": "https://i.scdn.co/image/ab67616d00001e02bed51eb447e0d2c2fcd5d80f", - "width": 300 - }, - { - "height": 64, - "url": "https://i.scdn.co/image/ab67616d00004851bed51eb447e0d2c2fcd5d80f", - "width": 64 - } - ], - "name": "MachineGun Kelly", - "popularity": 19, - "type": "artist", - "uri": "spotify:artist:4VPvSWeZ4gpl80xJBJ4Dsh" - }, - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/05m0YksOWOcA4yJ32hqNui" - }, - "followers": { - "href": null, - "total": 340 - }, - "genres": [], - "href": "https://api.spotify.com/v1/artists/05m0YksOWOcA4yJ32hqNui", - "id": "05m0YksOWOcA4yJ32hqNui", - "images": [ - { - "height": 640, - "url": "https://i.scdn.co/image/ab67616d0000b2736fa54a23a30401c989fd5fa7", - "width": 640 - }, - { - "height": 300, - "url": "https://i.scdn.co/image/ab67616d00001e026fa54a23a30401c989fd5fa7", - "width": 300 - }, - { - "height": 64, - "url": "https://i.scdn.co/image/ab67616d000048516fa54a23a30401c989fd5fa7", - "width": 64 - } - ], - "name": "Machine Gun Kelly", - "popularity": 0, - "type": "artist", - "uri": "spotify:artist:05m0YksOWOcA4yJ32hqNui" - }, - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/3I5tJ05CH0HiK1PCw3vqOS" - }, - "followers": { - "href": null, - "total": 847 - }, - "genres": [], - "href": "https://api.spotify.com/v1/artists/3I5tJ05CH0HiK1PCw3vqOS", - "id": "3I5tJ05CH0HiK1PCw3vqOS", - "images": [], - "name": "Machine Gun Kelly & Ray Jr.", - "popularity": 4, - "type": "artist", - "uri": "spotify:artist:3I5tJ05CH0HiK1PCw3vqOS" - }, - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/1DKkR55mGDMlx2bASVW4iq" - }, - "followers": { - "href": null, - "total": 26 - }, - "genres": [], - "href": "https://api.spotify.com/v1/artists/1DKkR55mGDMlx2bASVW4iq", - "id": "1DKkR55mGDMlx2bASVW4iq", - "images": [], - "name": "Machine Gunn Kelly", - "popularity": 0, - "type": "artist", - "uri": "spotify:artist:1DKkR55mGDMlx2bASVW4iq" - } - ], - "limit": 10, - "next": null, - "offset": 0, - "previous": null, - "total": 6 - } -} \ No newline at end of file diff --git a/json_file3.txt b/json_file3.txt deleted file mode 100644 index b7487d9..0000000 --- a/json_file3.txt +++ /dev/null @@ -1,404 +0,0 @@ -{ - "albums": { - "href": "https://api.spotify.com/v1/search?query=machine+gun+kelly&type=album&market=US&offset=0&limit=2", - "items": [ - { - "album_type": "album", - "artists": [ - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/6TIYQ3jFPwQSRmorSezPxX" - }, - "href": "https://api.spotify.com/v1/artists/6TIYQ3jFPwQSRmorSezPxX", - "id": "6TIYQ3jFPwQSRmorSezPxX", - "name": "Machine Gun Kelly", - "type": "artist", - "uri": "spotify:artist:6TIYQ3jFPwQSRmorSezPxX" - } - ], - "external_urls": { - "spotify": "https://open.spotify.com/album/3sKZHtQoq3tPtkXbT8PJAc" - }, - "href": "https://api.spotify.com/v1/albums/3sKZHtQoq3tPtkXbT8PJAc", - "id": "3sKZHtQoq3tPtkXbT8PJAc", - "images": [ - { - "height": 640, - "url": "https://i.scdn.co/image/ab67616d0000b273b4683d9ac3c5f14a71523c84", - "width": 640 - }, - { - "height": 300, - "url": "https://i.scdn.co/image/ab67616d00001e02b4683d9ac3c5f14a71523c84", - "width": 300 - }, - { - "height": 64, - "url": "https://i.scdn.co/image/ab67616d00004851b4683d9ac3c5f14a71523c84", - "width": 64 - } - ], - "name": "mainstream sellout", - "release_date": "2022-03-25", - "release_date_precision": "day", - "total_tracks": 16, - "type": "album", - "uri": "spotify:album:3sKZHtQoq3tPtkXbT8PJAc" - }, - { - "album_type": "album", - "artists": [ - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/6TIYQ3jFPwQSRmorSezPxX" - }, - "href": "https://api.spotify.com/v1/artists/6TIYQ3jFPwQSRmorSezPxX", - "id": "6TIYQ3jFPwQSRmorSezPxX", - "name": "Machine Gun Kelly", - "type": "artist", - "uri": "spotify:artist:6TIYQ3jFPwQSRmorSezPxX" - } - ], - "external_urls": { - "spotify": "https://open.spotify.com/album/57lgFncHBYu5E3igZnuCJK" - }, - "href": "https://api.spotify.com/v1/albums/57lgFncHBYu5E3igZnuCJK", - "id": "57lgFncHBYu5E3igZnuCJK", - "images": [ - { - "height": 640, - "url": "https://i.scdn.co/image/ab67616d0000b273d4d4929a3a86fe2f9fadbd42", - "width": 640 - }, - { - "height": 300, - "url": "https://i.scdn.co/image/ab67616d00001e02d4d4929a3a86fe2f9fadbd42", - "width": 300 - }, - { - "height": 64, - "url": "https://i.scdn.co/image/ab67616d00004851d4d4929a3a86fe2f9fadbd42", - "width": 64 - } - ], - "name": "Tickets To My Downfall", - "release_date": "2020-09-25", - "release_date_precision": "day", - "total_tracks": 15, - "type": "album", - "uri": "spotify:album:57lgFncHBYu5E3igZnuCJK" - } - ], - "limit": 2, - "next": "https://api.spotify.com/v1/search?query=machine+gun+kelly&type=album&market=US&offset=2&limit=2", - "offset": 0, - "previous": null, - "total": 532 - }, - "artists": { - "href": "https://api.spotify.com/v1/search?query=machine+gun+kelly&type=artist&market=US&offset=0&limit=2", - "items": [ - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/6TIYQ3jFPwQSRmorSezPxX" - }, - "followers": { - "href": null, - "total": 4894771 - }, - "genres": [ - "ohio hip hop", - "pop", - "pop rap" - ], - "href": "https://api.spotify.com/v1/artists/6TIYQ3jFPwQSRmorSezPxX", - "id": "6TIYQ3jFPwQSRmorSezPxX", - "images": [ - { - "height": 640, - "url": "https://i.scdn.co/image/ab6761610000e5eb1fd54eb6e30d0bc8f633621e", - "width": 640 - }, - { - "height": 320, - "url": "https://i.scdn.co/image/ab676161000051741fd54eb6e30d0bc8f633621e", - "width": 320 - }, - { - "height": 160, - "url": "https://i.scdn.co/image/ab6761610000f1781fd54eb6e30d0bc8f633621e", - "width": 160 - } - ], - "name": "Machine Gun Kelly", - "popularity": 80, - "type": "artist", - "uri": "spotify:artist:6TIYQ3jFPwQSRmorSezPxX" - }, - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/4VPvSWeZ4gpl80xJBJ4Dsh" - }, - "followers": { - "href": null, - "total": 2473 - }, - "genres": [ - "swedish hard rock" - ], - "href": "https://api.spotify.com/v1/artists/4VPvSWeZ4gpl80xJBJ4Dsh", - "id": "4VPvSWeZ4gpl80xJBJ4Dsh", - "images": [ - { - "height": 640, - "url": "https://i.scdn.co/image/ab67616d0000b273bed51eb447e0d2c2fcd5d80f", - "width": 640 - }, - { - "height": 300, - "url": "https://i.scdn.co/image/ab67616d00001e02bed51eb447e0d2c2fcd5d80f", - "width": 300 - }, - { - "height": 64, - "url": "https://i.scdn.co/image/ab67616d00004851bed51eb447e0d2c2fcd5d80f", - "width": 64 - } - ], - "name": "MachineGun Kelly", - "popularity": 19, - "type": "artist", - "uri": "spotify:artist:4VPvSWeZ4gpl80xJBJ4Dsh" - } - ], - "limit": 2, - "next": "https://api.spotify.com/v1/search?query=machine+gun+kelly&type=artist&market=US&offset=2&limit=2", - "offset": 0, - "previous": null, - "total": 25 - }, - "playlists": { - "href": "https://api.spotify.com/v1/search?query=machine+gun+kelly&type=playlist&market=US&offset=0&limit=2", - "items": [ - { - "collaborative": false, - "description": "", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/51UkIAIWZwzn0pav4LTixC" - }, - "href": "https://api.spotify.com/v1/playlists/51UkIAIWZwzn0pav4LTixC", - "id": "51UkIAIWZwzn0pav4LTixC", - "images": [ - { - "height": null, - "url": "https://i.scdn.co/image/ab67706c0000bebb4cba5729c734756bc3171e8f", - "width": null - } - ], - "name": "Machine Gun Kelly: Best Of", - "owner": { - "display_name": "MGK", - "external_urls": { - "spotify": "https://open.spotify.com/user/machinegunkellyak" - }, - "href": "https://api.spotify.com/v1/users/machinegunkellyak", - "id": "machinegunkellyak", - "type": "user", - "uri": "spotify:user:machinegunkellyak" - }, - "primary_color": null, - "public": null, - "snapshot_id": "MzAzLDJiNjNhMjBlMjA2OTA1NDJhNTMwMTk5ZDFjMmVhMTc0ZDA5ZmJmZWM=", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/51UkIAIWZwzn0pav4LTixC/tracks", - "total": 125 - }, - "type": "playlist", - "uri": "spotify:playlist:51UkIAIWZwzn0pav4LTixC" - }, - { - "collaborative": false, - "description": "This is Machine Gun Kelly. The essential tracks, all in one playlist.", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/37i9dQZF1DZ06evO44TgnC" - }, - "href": "https://api.spotify.com/v1/playlists/37i9dQZF1DZ06evO44TgnC", - "id": "37i9dQZF1DZ06evO44TgnC", - "images": [ - { - "height": null, - "url": "https://thisis-images.scdn.co/37i9dQZF1DZ06evO44TgnC-large.jpg", - "width": null - } - ], - "name": "This Is Machine Gun Kelly", - "owner": { - "display_name": "Spotify", - "external_urls": { - "spotify": "https://open.spotify.com/user/spotify" - }, - "href": "https://api.spotify.com/v1/users/spotify", - "id": "spotify", - "type": "user", - "uri": "spotify:user:spotify" - }, - "primary_color": null, - "public": null, - "snapshot_id": "Mjc4NDQ5MDIsMDAwMDAwMDAxYWFhZTljYTZlM2U5NzYzZjVkMDBmMjg3M2JlYzQ4MQ==", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/37i9dQZF1DZ06evO44TgnC/tracks", - "total": 48 - }, - "type": "playlist", - "uri": "spotify:playlist:37i9dQZF1DZ06evO44TgnC" - } - ], - "limit": 2, - "next": "https://api.spotify.com/v1/search?query=machine+gun+kelly&type=playlist&market=US&offset=2&limit=2", - "offset": 0, - "previous": null, - "total": 3793 - }, - "tracks": { - "href": "https://api.spotify.com/v1/search?query=machine+gun+kelly&type=track&market=US&offset=0&limit=2", - "items": [ - { - "album": { - "album_type": "album", - "artists": [ - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/6TIYQ3jFPwQSRmorSezPxX" - }, - "href": "https://api.spotify.com/v1/artists/6TIYQ3jFPwQSRmorSezPxX", - "id": "6TIYQ3jFPwQSRmorSezPxX", - "name": "Machine Gun Kelly", - "type": "artist", - "uri": "spotify:artist:6TIYQ3jFPwQSRmorSezPxX" - } - ], - "external_urls": { - "spotify": "https://open.spotify.com/album/57lgFncHBYu5E3igZnuCJK" - }, - "href": "https://api.spotify.com/v1/albums/57lgFncHBYu5E3igZnuCJK", - "id": "57lgFncHBYu5E3igZnuCJK", - "images": [ - { - "height": 640, - "url": "https://i.scdn.co/image/ab67616d0000b273d4d4929a3a86fe2f9fadbd42", - "width": 640 - }, - { - "height": 300, - "url": "https://i.scdn.co/image/ab67616d00001e02d4d4929a3a86fe2f9fadbd42", - "width": 300 - }, - { - "height": 64, - "url": "https://i.scdn.co/image/ab67616d00004851d4d4929a3a86fe2f9fadbd42", - "width": 64 - } - ], - "name": "Tickets To My Downfall", - "release_date": "2020-09-25", - "release_date_precision": "day", - "total_tracks": 15, - "type": "album", - "uri": "spotify:album:57lgFncHBYu5E3igZnuCJK" - }, - "artists": [ - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/6TIYQ3jFPwQSRmorSezPxX" - }, - "href": "https://api.spotify.com/v1/artists/6TIYQ3jFPwQSRmorSezPxX", - "id": "6TIYQ3jFPwQSRmorSezPxX", - "name": "Machine Gun Kelly", - "type": "artist", - "uri": "spotify:artist:6TIYQ3jFPwQSRmorSezPxX" - }, - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/2cFrymmkijnjDg9SS92EPM" - }, - "href": "https://api.spotify.com/v1/artists/2cFrymmkijnjDg9SS92EPM", - "id": "2cFrymmkijnjDg9SS92EPM", - "name": "blackbear", - "type": "artist", - "uri": "spotify:artist:2cFrymmkijnjDg9SS92EPM" - } - ], - "disc_number": 1, - "duration_ms": 139460, - "explicit": true, - "external_ids": { - "isrc": "USUM72014730" - }, - "external_urls": { - "spotify": "https://open.spotify.com/track/7kDUspsoYfLkWnZR7qwHZl" - }, - "href": "https://api.spotify.com/v1/tracks/7kDUspsoYfLkWnZR7qwHZl", - "id": "7kDUspsoYfLkWnZR7qwHZl", - "is_local": false, - "is_playable": true, - "name": "my ex's best friend (with blackbear)", - "popularity": 78, - "preview_url": null, - "track_number": 11, - "type": "track", - "uri": "spotify:track:7kDUspsoYfLkWnZR7qwHZl" - }, - { - "album": { - "album_type": "album", - "artists": [ - { - "external_urls": { - "spotify": "https://open.spotify.com/artist/6TIYQ3jFPwQSRmorSezPxX" - }, - "href": "https://api.spotify.com/v1/artists/6TIYQ3jFPwQSRmorSezPxX", - "id": "6TIYQ3jFPwQSRmorSezPxX", - "name": "Machine Gun Kelly", - "type": "artist", - "uri": "spotify:artist:6TIYQ3jFPwQSRmorSezPxX" - } - ], - "external_urls": { - "spotify": "https://open.spotify.com/album/5NzdnPboXcqvuvyEH1wSEJ" - }, - "href": "https://api.spotify.com/v1/albums/5NzdnPboXcqvuvyEH1wSEJ", - "id": "5NzdnPboXcqvuvyEH1wSEJ", - "images": [ - { - "height": 640, - "url": "https://i.scdn.co/image/ab67616d0000b273a57d3a2736f815d3cf358e37", - "width": 640 - }, - { - "height": 300, - "url": "https://i.scdn.co/image/ab67616d00001e02a57d3a2736f815d3cf358e37", - "width": 300 - }, - { - "height": 64, - "url": "https://i.scdn.co/image/ab67616d00004851a57d3a2736f815d3cf358e37", - "width": 64 - } - ], - "name": "Lace Up (Deluxe)", - "release_date": "2012-01-01", - "release_date_precision": "day", - "total_tracks": 16, - "type": "album", - "uri": "spotify:album:5NzdnPboXcqvuvyEH1wSEJ" - }, - "artists": [ - } - ], - "limit": 2, - "next": "https://api.spotify.com/v1/search?query=machine+gun+kelly&type=track&market=US&offset=2&limit=2", - "offset": 0, - "previous": null, - "total": 2563 - } -} \ No newline at end of file diff --git a/json_file4.txt b/json_file4.txt deleted file mode 100644 index db66f3f..0000000 --- a/json_file4.txt +++ /dev/null @@ -1,402 +0,0 @@ -{ - "playlists": { - "href": "https://api.spotify.com/v1/search?query=playlist%3Arap&type=playlist&offset=0&limit=10", - "items": [ - { - "collaborative": false, - "description": "", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/6jkyRflychhI50Lcv9TCfr" - }, - "href": "https://api.spotify.com/v1/playlists/6jkyRflychhI50Lcv9TCfr", - "id": "6jkyRflychhI50Lcv9TCfr", - "images": [ - { - "height": 640, - "url": "https://mosaic.scdn.co/640/ab67616d0000b273419cedff7b313b962a93932eab67616d0000b273bba7cfaf7c59ff0898acba1fab67616d0000b273ce159a3ba2096e13fa9d4b4cab67616d0000b273e31a279d267f3b3d8912e6f1", - "width": 640 - }, - { - "height": 300, - "url": "https://mosaic.scdn.co/300/ab67616d0000b273419cedff7b313b962a93932eab67616d0000b273bba7cfaf7c59ff0898acba1fab67616d0000b273ce159a3ba2096e13fa9d4b4cab67616d0000b273e31a279d267f3b3d8912e6f1", - "width": 300 - }, - { - "height": 60, - "url": "https://mosaic.scdn.co/60/ab67616d0000b273419cedff7b313b962a93932eab67616d0000b273bba7cfaf7c59ff0898acba1fab67616d0000b273ce159a3ba2096e13fa9d4b4cab67616d0000b273e31a279d267f3b3d8912e6f1", - "width": 60 - } - ], - "name": "Playlist Rap us Chill \ud83c\uddfa\ud83c\uddf8", - "owner": { - "display_name": "Pierre-Louis Drouelle", - "external_urls": { - "spotify": "https://open.spotify.com/user/21x6ai6t5q6udgg3hx45fxmay" - }, - "href": "https://api.spotify.com/v1/users/21x6ai6t5q6udgg3hx45fxmay", - "id": "21x6ai6t5q6udgg3hx45fxmay", - "type": "user", - "uri": "spotify:user:21x6ai6t5q6udgg3hx45fxmay" - }, - "primary_color": null, - "public": null, - "snapshot_id": "MzgsYWQwMzNmZTdmNjVkZjYxZDRmOWQ0ZTgwOGFiMWE3OTY4ZGFjYTdhOQ==", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/6jkyRflychhI50Lcv9TCfr/tracks", - "total": 37 - }, - "type": "playlist", - "uri": "spotify:playlist:6jkyRflychhI50Lcv9TCfr" - }, - { - "collaborative": false, - "description": "Les classiques et les nouveaut\u00e9s du Rap FR ! Photo : Orelsan Contact, insta : @lerapenfrance", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/2kZm59MItcYXMO0RMtTTjd" - }, - "href": "https://api.spotify.com/v1/playlists/2kZm59MItcYXMO0RMtTTjd", - "id": "2kZm59MItcYXMO0RMtTTjd", - "images": [ - { - "height": null, - "url": "https://i.scdn.co/image/ab67706c0000bebbca81a1f3a58ab3893bced31d", - "width": null - } - ], - "name": "Playlist Rap Francais 2022", - "owner": { - "display_name": "LeRapEnFrance", - "external_urls": { - "spotify": "https://open.spotify.com/user/math.vecchioni-fr" - }, - "href": "https://api.spotify.com/v1/users/math.vecchioni-fr", - "id": "math.vecchioni-fr", - "type": "user", - "uri": "spotify:user:math.vecchioni-fr" - }, - "primary_color": null, - "public": null, - "snapshot_id": "NjU5NSw0NGMwOGQwOTIyMDYyZWNjYmUwOGVkYzRlNjllZTdiOTkwMDQxM2Vl", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/2kZm59MItcYXMO0RMtTTjd/tracks", - "total": 85 - }, - "type": "playlist", - "uri": "spotify:playlist:2kZm59MItcYXMO0RMtTTjd" - }, - { - "collaborative": false, - "description": "", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/7HFibvUcJL4V1ixYYsGK8J" - }, - "href": "https://api.spotify.com/v1/playlists/7HFibvUcJL4V1ixYYsGK8J", - "id": "7HFibvUcJL4V1ixYYsGK8J", - "images": [ - { - "height": 640, - "url": "https://mosaic.scdn.co/640/ab67616d0000b27336f15d38804d5bdd29b9fc7aab67616d0000b27341b41e6f7924e530a9b00f9cab67616d0000b273ce159a3ba2096e13fa9d4b4cab67616d0000b273f54b99bf27cda88f4a7403ce", - "width": 640 - }, - { - "height": 300, - "url": "https://mosaic.scdn.co/300/ab67616d0000b27336f15d38804d5bdd29b9fc7aab67616d0000b27341b41e6f7924e530a9b00f9cab67616d0000b273ce159a3ba2096e13fa9d4b4cab67616d0000b273f54b99bf27cda88f4a7403ce", - "width": 300 - }, - { - "height": 60, - "url": "https://mosaic.scdn.co/60/ab67616d0000b27336f15d38804d5bdd29b9fc7aab67616d0000b27341b41e6f7924e530a9b00f9cab67616d0000b273ce159a3ba2096e13fa9d4b4cab67616d0000b273f54b99bf27cda88f4a7403ce", - "width": 60 - } - ], - "name": "", - "owner": { - "display_name": "Jakedorworth", - "external_urls": { - "spotify": "https://open.spotify.com/user/toxicsnouis" - }, - "href": "https://api.spotify.com/v1/users/toxicsnouis", - "id": "toxicsnouis", - "type": "user", - "uri": "spotify:user:toxicsnouis" - }, - "primary_color": null, - "public": null, - "snapshot_id": "NjExLDI2OTFjNjYxMmJiOWYzZGQ1NzRhMDJjNDE4MDliOWRiYmM2YjlmODY=", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/7HFibvUcJL4V1ixYYsGK8J/tracks", - "total": 487 - }, - "type": "playlist", - "uri": "spotify:playlist:7HFibvUcJL4V1ixYYsGK8J" - }, - { - "collaborative": false, - "description": "", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/3aUN9KuF9Ce87BXdL86MVI" - }, - "href": "https://api.spotify.com/v1/playlists/3aUN9KuF9Ce87BXdL86MVI", - "id": "3aUN9KuF9Ce87BXdL86MVI", - "images": [ - { - "height": null, - "url": "https://i.scdn.co/image/ab67706c0000bebb72951219c5e1ef0daad297d4", - "width": null - } - ], - "name": "Playlist rap triste ", - "owner": { - "display_name": "bastien lefel", - "external_urls": { - "spotify": "https://open.spotify.com/user/8bu7sbzpe1qn67adebtn65lgn" - }, - "href": "https://api.spotify.com/v1/users/8bu7sbzpe1qn67adebtn65lgn", - "id": "8bu7sbzpe1qn67adebtn65lgn", - "type": "user", - "uri": "spotify:user:8bu7sbzpe1qn67adebtn65lgn" - }, - "primary_color": null, - "public": null, - "snapshot_id": "Mjg4LGI3YmMyMWRlMzI2ZjJiZDA1MTYyMzVlNTE3NjdlNGE2YTQ3YzFhMWY=", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/3aUN9KuF9Ce87BXdL86MVI/tracks", - "total": 243 - }, - "type": "playlist", - "uri": "spotify:playlist:3aUN9KuF9Ce87BXdL86MVI" - }, - { - "collaborative": false, - "description": "You can also find us with: top country rap songs - cowboy rap music - country rap songs - best country rap songs - country rap music - top country rap songs 2022 - cowboy rap song - rap country - country rap 2022 - best country rap songs 2022 - country rap songs 2022 - country rap - rap country 2022", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/25GMAkhuPpZvT2UqNp1G04" - }, - "href": "https://api.spotify.com/v1/playlists/25GMAkhuPpZvT2UqNp1G04", - "id": "25GMAkhuPpZvT2UqNp1G04", - "images": [ - { - "height": null, - "url": "https://i.scdn.co/image/ab67706c0000bebb341e17482a0f26650e4645a9", - "width": null - } - ], - "name": "Country Rap 2022 - Best Country Rap Songs 2022 Playlist (Cowboy Rap Music Hits)", - "owner": { - "display_name": "Redlist Playlists", - "external_urls": { - "spotify": "https://open.spotify.com/user/7bntwjdswpqhrnqr0gssydbd0" - }, - "href": "https://api.spotify.com/v1/users/7bntwjdswpqhrnqr0gssydbd0", - "id": "7bntwjdswpqhrnqr0gssydbd0", - "type": "user", - "uri": "spotify:user:7bntwjdswpqhrnqr0gssydbd0" - }, - "primary_color": null, - "public": null, - "snapshot_id": "MjA5NSwyNmYyZjZmNjViNGIyZTJhYzdlMDA0OWMzZWNmMDUzZDM1ZTg5MTQ0", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/25GMAkhuPpZvT2UqNp1G04/tracks", - "total": 40 - }, - "type": "playlist", - "uri": "spotify:playlist:25GMAkhuPpZvT2UqNp1G04" - }, - { - "collaborative": false, - "description": "HOTTEST HIP HOP BANGERS \ud83d\udd25 BEST INDIE RAP - BEST RAP PLAYLIST 2022 - HIP HOP 2022", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/6cqAN7tZC8eUY3862EYnUK" - }, - "href": "https://api.spotify.com/v1/playlists/6cqAN7tZC8eUY3862EYnUK", - "id": "6cqAN7tZC8eUY3862EYnUK", - "images": [ - { - "height": null, - "url": "https://i.scdn.co/image/ab67706c0000bebb90dd7bab8ab72f66406f6574", - "width": null - } - ], - "name": "Best Rap Playlist 2022 \ud83d\udd25 Hip Hop 2022 \ud83d\udd25 Best Rap Hits 2022 / Hip Hop Hits 2022 / Rap Playlist", - "owner": { - "display_name": "LABYRINTH RECORDS", - "external_urls": { - "spotify": "https://open.spotify.com/user/7wbrcexsh97eqgo8wyk3be4zi" - }, - "href": "https://api.spotify.com/v1/users/7wbrcexsh97eqgo8wyk3be4zi", - "id": "7wbrcexsh97eqgo8wyk3be4zi", - "type": "user", - "uri": "spotify:user:7wbrcexsh97eqgo8wyk3be4zi" - }, - "primary_color": null, - "public": null, - "snapshot_id": "NzM2NCw5NTI1MWE0YTZhYmIxOTVjY2I1Y2U4MGEzODJiYjYxNDcxOTAzZWU5", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/6cqAN7tZC8eUY3862EYnUK/tracks", - "total": 310 - }, - "type": "playlist", - "uri": "spotify:playlist:6cqAN7tZC8eUY3862EYnUK" - }, - { - "collaborative": false, - "description": "", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/4ERLnbsHKTjKRJjLuPjr8g" - }, - "href": "https://api.spotify.com/v1/playlists/4ERLnbsHKTjKRJjLuPjr8g", - "id": "4ERLnbsHKTjKRJjLuPjr8g", - "images": [ - { - "height": 640, - "url": "https://mosaic.scdn.co/640/ab67616d0000b2734ad6e5838f15401ff7d62856ab67616d0000b2739b19c107109de740bad72df5ab67616d0000b273f7f74100d5cc850e01172cbfab67616d0000b273fe3cf32b1320e8ded39d8c74", - "width": 640 - }, - { - "height": 300, - "url": "https://mosaic.scdn.co/300/ab67616d0000b2734ad6e5838f15401ff7d62856ab67616d0000b2739b19c107109de740bad72df5ab67616d0000b273f7f74100d5cc850e01172cbfab67616d0000b273fe3cf32b1320e8ded39d8c74", - "width": 300 - }, - { - "height": 60, - "url": "https://mosaic.scdn.co/60/ab67616d0000b2734ad6e5838f15401ff7d62856ab67616d0000b2739b19c107109de740bad72df5ab67616d0000b273f7f74100d5cc850e01172cbfab67616d0000b273fe3cf32b1320e8ded39d8c74", - "width": 60 - } - ], - "name": "Playlist rap us 2000", - "owner": { - "display_name": "Ade.bltr", - "external_urls": { - "spotify": "https://open.spotify.com/user/8mntv4fukzl27b86nl85t66sf" - }, - "href": "https://api.spotify.com/v1/users/8mntv4fukzl27b86nl85t66sf", - "id": "8mntv4fukzl27b86nl85t66sf", - "type": "user", - "uri": "spotify:user:8mntv4fukzl27b86nl85t66sf" - }, - "primary_color": null, - "public": null, - "snapshot_id": "OTYsY2U5ZDkzYzY1ODM4NGFlMzE1MzdmZGM0ZDk1NzA1OGI1NzkwOGMyZA==", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/4ERLnbsHKTjKRJjLuPjr8g/tracks", - "total": 95 - }, - "type": "playlist", - "uri": "spotify:playlist:4ERLnbsHKTjKRJjLuPjr8g" - }, - { - "collaborative": false, - "description": "Game time", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/2ms4lv3Kl23tXdC0O8F0ZW" - }, - "href": "https://api.spotify.com/v1/playlists/2ms4lv3Kl23tXdC0O8F0ZW", - "id": "2ms4lv3Kl23tXdC0O8F0ZW", - "images": [ - { - "height": null, - "url": "https://i.scdn.co/image/ab67706c0000bebbe28d1988febe51f64b4493bc", - "width": null - } - ], - "name": "Gym Workout Rap Playlist ", - "owner": { - "display_name": "Jayden", - "external_urls": { - "spotify": "https://open.spotify.com/user/31xjko2hitivryhl3xm7afsntbdu" - }, - "href": "https://api.spotify.com/v1/users/31xjko2hitivryhl3xm7afsntbdu", - "id": "31xjko2hitivryhl3xm7afsntbdu", - "type": "user", - "uri": "spotify:user:31xjko2hitivryhl3xm7afsntbdu" - }, - "primary_color": null, - "public": null, - "snapshot_id": "MjUzLGJhZjMyODEwOWIxMDY2OGVjOTQ5Y2VhMTg3NThjNzkyZDc3MGNlNTU=", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/2ms4lv3Kl23tXdC0O8F0ZW/tracks", - "total": 619 - }, - "type": "playlist", - "uri": "spotify:playlist:2ms4lv3Kl23tXdC0O8F0ZW" - }, - { - "collaborative": false, - "description": "Curating Christian Rap culture. Tap the \ud83d\udc9a to follow! The Rapzilla Playlist is the hottest new songs in Christian Hip Hop. Follow our New Songs Daily Playlist also. Cover Artists: DJ Mykael V & 1995", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/4UoWnawInXuG6Z8iyi2YAs" - }, - "href": "https://api.spotify.com/v1/playlists/4UoWnawInXuG6Z8iyi2YAs", - "id": "4UoWnawInXuG6Z8iyi2YAs", - "images": [ - { - "height": null, - "url": "https://i.scdn.co/image/ab67706c0000bebb10306e9bf3961142807c6c4e", - "width": null - } - ], - "name": "Christian Rap - The Rapzilla Playlist", - "owner": { - "display_name": "Rapzilla.com", - "external_urls": { - "spotify": "https://open.spotify.com/user/rapzilla.com" - }, - "href": "https://api.spotify.com/v1/users/rapzilla.com", - "id": "rapzilla.com", - "type": "user", - "uri": "spotify:user:rapzilla.com" - }, - "primary_color": null, - "public": null, - "snapshot_id": "ODQ2OSwwNDQ1ZDQxZDZmNTdiM2I2ODZlMWI3OWVlY2Q5ZTJlMzM3NTJhMjJl", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/4UoWnawInXuG6Z8iyi2YAs/tracks", - "total": 97 - }, - "type": "playlist", - "uri": "spotify:playlist:4UoWnawInXuG6Z8iyi2YAs" - }, - { - "collaborative": false, - "description": "Damn son, where'd ya find this? Cover: MOUNT WESTMORE", - "external_urls": { - "spotify": "https://open.spotify.com/playlist/37i9dQZF1DX3XgesiUXnsq" - }, - "href": "https://api.spotify.com/v1/playlists/37i9dQZF1DX3XgesiUXnsq", - "id": "37i9dQZF1DX3XgesiUXnsq", - "images": [ - { - "height": null, - "url": "https://i.scdn.co/image/ab67706f00000003186ba85b84fc0c0af0ceec24", - "width": null - } - ], - "name": "Raw & Uncut", - "owner": { - "display_name": "Spotify", - "external_urls": { - "spotify": "https://open.spotify.com/user/spotify" - }, - "href": "https://api.spotify.com/v1/users/spotify", - "id": "spotify", - "type": "user", - "uri": "spotify:user:spotify" - }, - "primary_color": null, - "public": null, - "snapshot_id": "MTY3MDU2MjAwMCwwMDAwMDAwMDI1OTFhZjdiZDVhNzIyOTE5ZjY2Mjg4OWYzMzZiMzRl", - "tracks": { - "href": "https://api.spotify.com/v1/playlists/37i9dQZF1DX3XgesiUXnsq/tracks", - "total": 100 - }, - "type": "playlist", - "uri": "spotify:playlist:37i9dQZF1DX3XgesiUXnsq" - } - ], - "limit": 10, - "next": "https://api.spotify.com/v1/search?query=playlist%3Arap&type=playlist&offset=10&limit=10", - "offset": 0, - "previous": null, - "total": 20017 - } -} \ No newline at end of file diff --git a/json_file5.txt b/json_file5.txt deleted file mode 100644 index e69de29..0000000 diff --git a/json_file6.txt b/json_file6.txt deleted file mode 100644 index e69de29..0000000 diff --git a/librespot_example.py b/librespot_example.py deleted file mode 100644 index 6489c0a..0000000 --- a/librespot_example.py +++ /dev/null @@ -1,121 +0,0 @@ -import os -import re -import socket -import threading - -from librespot.audio.decoders import AudioQuality, VorbisOnlyAudioQuality -from librespot.core import Session -from librespot.metadata import TrackId - -session: Session -sock: socket - - -def handler(client: socket.socket, address: str): - req_raw = client.recv(1024 * 1024) - if len(req_raw) == 0: - return - req_arr = req_raw.split(b"\r\n") - req_http_raw = req_arr[0] - req_header_str = req_raw.split(b"\r\n\r\n")[0] - req_body_str = req_raw.split(b"\r\n\r\n")[1] - req_http_arr = req_http_raw.split(b" ") - req_method = req_http_arr[0] - req_uri = req_http_arr[1] - req_http_version = req_http_arr[2] - req_header = {} - for header in req_header_str.split(b"\r\n"): - try: - key, value = header.split(b": ") - except ValueError: - continue - else: - req_header[key.decode().lower()] = value.decode() - status, headers, content, manually = response(client, req_uri.decode(), - req_header, req_body_str) - if not manually: - client.send(req_http_version + b" " + status.encode() + b"\r\n") - client.send(b"Access-Control-Allow-Origin: *\r\n") - for header in headers: - client.send(header.encode() + "\r\n") - client.send(b"\r\n") - client.send(content) - client.close() - - -class HttpCode: - http_200 = "200 OK" - http_204 = "204 No Content" - http_400 = "400 Bad Request" - http_403 = "403 Forbidden" - http_404 = "404 Not Found" - http_500 = "500 Internal Server Error" - - -def main(): - global session, sock - session = None - if os.path.isfile("credentials.json"): - try: - session = Session.Builder().stored_file().create() - except RuntimeError: - pass - if session is None or not session.is_valid(): - username = input("Username: ") - password = input("Password: ") - session = Session.Builder().user_pass(username, password).create() - if not session.is_valid(): - return - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.bind(("127.0.0.1", 8080)) - sock.listen(5) - while True: - threading.Thread(target=handler, args=sock.accept()).start() - - -def response(client: socket.socket, uri: str, header: dict, - body: bytes) -> tuple[str, list, bytes, bool]: - if re.search(r"^/audio/track/([0-9a-zA-Z]{22})$", uri) is not None: - track_id_search = re.search( - r"^/audio/track/(?P[0-9a-zA-Z]{22})$", uri) - track_id_str = track_id_search.group("TrackID") - track_id = TrackId.from_base62(track_id_str) - stream = session.content_feeder().load( - track_id, VorbisOnlyAudioQuality(AudioQuality.VERY_HIGH), False, - None) - start = 0 - end = stream.input_stream.stream().size() - if header.get("range") is not None: - range_search = re.search( - "^bytes=(?P[0-9]+?)-(?P[0-9]+?)$", - header.get("range")) - if range_search is not None: - start = int(range_search.group("start")) - end = (int(range_search.group("end")) - if int(range_search.group("end")) <= - stream.input_stream.stream().size() else - stream.input_stream.stream().size()) - stream.input_stream.stream().skip(start) - client.send(b"HTTP/1.0 200 OK\r\n") - client.send(b"Access-Control-Allow-Origin: *\r\n") - client.send(b"Content-Length: " + - (str(stream.input_stream.stream().size()).encode() if - stream.input_stream.stream().size() == end else "{}-{}/{}" - .format(start, end, - stream.input_stream.stream().size()).encode()) + - b"\r\n") - client.send(b"Content-Type: audio/ogg\r\n") - client.send(b"\r\n") - while True: - if (stream.input_stream.stream().pos() >= - stream.input_stream.stream().size()): - break - byte = stream.input_stream.stream().read(1) - client.send(byte) - return "", [], b"", True - else: - return HttpCode.http_404, [], HttpCode.http_404.encode(), False - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/program.py b/program.py index 63fb6c6..7113c19 100644 --- a/program.py +++ b/program.py @@ -39,6 +39,8 @@ spotify = spotipy.Spotify(auth=token) root = ttk.Tk() root.title("Media Controller") root.attributes("-topmost", True) +root.overrideredirect(1) +# root.geometry("380x160") sv_ttk.use_dark_theme() @@ -47,10 +49,14 @@ sv_ttk.use_dark_theme() # Function to call the Spotify API to play the current track def play(): + play_button.grid_forget() + pause_button.grid(row=0, column=1) spotify.start_playback() # Function to call the Spotify API to pause the current track def pause(): + pause_button.grid_forget() + play_button.grid(row=0, column=1) spotify.pause_playback() def next(): @@ -140,21 +146,27 @@ def hide_devices(): # audio_analysis_label.config(text=audio_analysis) -# frame = tk.Frame(root) -# frame2 = tk.Frame(root) +play_img = ttk.PhotoImage(file="icons/play-circle.png") +pause_img = ttk.PhotoImage(file="icons/pause-circle.png") +next_img = ttk.PhotoImage(file="icons/skip-next.png") +previous_img = ttk.PhotoImage(file="icons/skip-previous.png") + + +frame_artist_song = tk.Frame(root) +frame_controls = tk.Frame(root) # Create the media control buttons and a text label -play_button = tk.Button(root, text="Play", command=play) -pause_button = tk.Button(root, text="Pause", command=pause) -next_button = tk.Button(root, text="Next", command=next) -previous_button = tk.Button(root, text="Previous", command=previous) +play_button = ttk.Button(frame_controls, image=play_img, command=play, borderwidth=0, relief=None) +pause_button = ttk.Button(frame_controls, image=pause_img, command=pause, borderwidth=0) +next_button = ttk.Button(frame_controls, image=next_img, command=next, borderwidth=0) +previous_button = ttk.Button(frame_controls, image=previous_img, command=previous, borderwidth=0) maxvolume_button = tk.Button(root, text="Max Volume", command=maxvolume) minvolume_button = tk.Button(root, text="Min Volume", command=minvolume) randomvolume_button = tk.Button(root, text="Random Volume", command=randomvolume) -volumeslider_button = tk.Scale(root, from_=0, to=100, orient=ttk.HORIZONTAL, command=volumeslider) +volumeslider_button = tk.Scale(root, from_=100, to=0, orient=ttk.VERTICAL, command=volumeslider) #doaudio_analysis = tk.Button(root, text="Audio Analysis", command=doaudioanalysis) -artist_label = tk.Label(root, text="") -song_label = tk.Label(root, text="") +artist_label = tk.Label(frame_artist_song, text="") +song_label = tk.Label(frame_artist_song, text="") track_progress_label = tk.Label(root, text="") track_duration_label = tk.Label(root, text="") track_combined_label = tk.Label(root, text="") @@ -169,7 +181,7 @@ username_label = tk.Label(root, text="Username: " + spotify.me()["display_name"] devices_list = ttk.Listbox(root, selectmode=ttk.SINGLE) -progress_bar = tk.Progressbar(root, orient=ttk.HORIZONTAL, length=180) +progress_bar = tk.Progressbar(root, orient=ttk.HORIZONTAL, length=300) # Play music locally @@ -179,31 +191,47 @@ progress_bar = tk.Progressbar(root, orient=ttk.HORIZONTAL, length=180) #audio_analysis = tk.Label(root, text="") #track_label = tk.Label(root, text="") + + +# root.grid_rowconfigure(1, weight=1) +# root.grid_columnconfigure(0) +# root.grid_columnconfigure(1) +# root.grid_columnconfigure(2) + # frame.pack() # frame2.pack() # Place the media control buttons and text label on the window -username_label.pack() -maxvolume_button.pack() -minvolume_button.pack() -randomvolume_button.pack() -volumeslider_button.pack() -artist_label.pack() -song_label.pack() +# username_label.grid(row=0, column=0, columnspan=2) + +# minvolume_button.grid(row=1, column=1, sticky="e", padx=(0,5)) +# maxvolume_button.grid() +# randomvolume_button.grid() +volumeslider_button.grid(row=1, column=1, rowspan=3, sticky="e", padx=(0,5)) +frame_artist_song.grid(row=1, column=1, pady=(20,5)) +frame_controls.grid(row=2, column=1, pady=(20,0)) +artist_label.grid() +song_label.grid() +previous_button.grid(row=0, column=0, padx=(0,10)) +play_button.grid(row=0, column=1) +next_button.grid(row=0, column=2, padx=(10,0)) + +# track_progress_label.grid(row=3, column=0, pady=(20,5), padx=10) +progress_bar.grid(row=3, column=1, pady=(20,5)) +# track_duration_label.grid(row=3, column=2, pady=(20,5), padx=10) +# pause_button.grid() +# track_combined_label.grid() +# track_search.grid() +# track_search_button.grid() +# get_devices_button.grid() + + #doaudio_analysis.pack() #audio_analysis.pack() -play_button.pack() -pause_button.pack() -next_button.pack() -previous_button.pack() -track_combined_label.pack() -progress_bar.pack() -track_search.pack() -track_search_button.pack() -get_devices_button.pack() # start_local_playback_button.pack() # audio_analysis_button.pack() # album_image_label.pack() + root.bind("", search) # Function to update the song label with the current track's name @@ -225,17 +253,17 @@ def update_song_label(): # Set the text of the song label to the track's name song_label.config(text=track_name) artist_label.config(text=artist_name) - track_progress_label.config(text=((track_progress//(1000*60))%60, "m", (track_progress//1000)%60, "s")) - track_duration_label.config(text=((track_duration//(1000*60))%60, "m", (track_duration//1000)%60, "s")) + track_progress_min = track_progress//(1000*60)%60 + track_progress_sec = (track_progress//1000)%60 + track_duration_min = track_duration//(1000*60)%60 + track_duration_sec = (track_duration//1000)%60 + track_progress_label.config(text=("{}:{:02d}".format(track_progress_min, track_progress_sec))) + track_duration_label.config(text=("{}:{:02d}".format(track_duration_min, track_duration_sec))) progress_bar.config(maximum=track_duration) progress_bar.config(value=track_progress) # urllib.request.urlretrieve(album_image_url, "album_image.jpg") # image_data = tk.PhotoImage("album_image.jpg") # album_image_label.config(image=image_data) - track_progress_min = track_progress//(1000*60)%60 - track_progress_sec = (track_progress//1000)%60 - track_duration_min = track_duration//(1000*60)%60 - track_duration_sec = (track_duration//1000)%60 track_combined_label.config(text=("{}:{:02d} / {}:{:02d}".format(track_progress_min, track_progress_sec, track_duration_min, track_duration_sec))) # track_combined_label.config(text=((track_progress//(1000*60))%60, ":", (track_progress//1000)%60, "/", (track_duration//(1000*60))%60, ":", (track_duration//1000)%60)) diff --git a/schematics/design.png b/schematics/design.png new file mode 100644 index 0000000..28ee62f Binary files /dev/null and b/schematics/design.png differ diff --git a/schematics/design_pull_out_drawer.png b/schematics/design_pull_out_drawer.png new file mode 100644 index 0000000..84925da Binary files /dev/null and b/schematics/design_pull_out_drawer.png differ diff --git a/schematics/potential_bottom_progress_design.png b/schematics/potential_bottom_progress_design.png new file mode 100644 index 0000000..69aff7e Binary files /dev/null and b/schematics/potential_bottom_progress_design.png differ