PiekJ / jambot

Discord bot for playing music in voice channels.
https://jambot.red
MIT License
4 stars 1 forks source link

Add SpotifyAPI to search for tracks and playlist via /play command #11

Closed carstenflokstra closed 1 year ago

carstenflokstra commented 1 year ago

Prerequirements and summary of this PR

In order to test this you need to make a Spotify Developer Application. After creating an application, you can provide the spotify.clientId and the spotify.clientSecret in the application.properties file or inject it via some kind of pipeline. Authorisation via oAuth is handeled in the ApiSpotifyService.java where a request to the authorisation api is being done to receive an access token.

After merging this PR, it is possible to fetch Spotify data. This data is getting parsed into a understandable format into the Youtube API to search for video's. After a video is found, it is being played through the bot.

This also works with playlists. You can add a Spotify playlist (open.spotify.com/playlist) link to the bot. All the songs in that list will get fetched. After that, it is going to be routed to the search API of YouTube to queue the items.

Thing to watch for is that we have a limitation on the Youtube API. If the quatation is reached, the API will return 403. So maybe we need to do something about that in case someone queues a list with a lot of tracks.

Related issues:

This PR contains

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information