[GH-ISSUE #1678] Spotify Integration #920

Closed
opened 2026-02-26 02:34:39 +03:00 by kerem · 3 comments
Owner

Originally created by @andreknieriem on GitHub (May 11, 2023).
Original GitHub issue: https://github.com/koel/koel/issues/1678

Describe the bug
Hey I cannot bring the spotify integration to work. I've created an app at Spotify and I have a client id and a secret which I added to the .env file. At Spotify there is another field required "Redirect URIs". What should I fill in there?
Second: When did the service try to load artist and album covers? I see the SpotifyService and the MediaMetadataService.php but I could not figure out, when this is called. If a add a new song and sync with php artisan koel:sync it seems, that these services are not called. If I click in the frontend nothing too. So what am I missing here?

To reproduce
Add spotify client and secret id, add a song and nothing will be there.

Expected behavior
The service is called and some data gets returned.

Screenshots

Environment

  • Koel version latest
  • OS: Ubuntu 22.04 and MacOs with ddev on an Mac M1 Pro
  • Firefox and Chrome
  • PHP version 8.0
Originally created by @andreknieriem on GitHub (May 11, 2023). Original GitHub issue: https://github.com/koel/koel/issues/1678 **Describe the bug** Hey I cannot bring the spotify integration to work. I've created an app at Spotify and I have a client id and a secret which I added to the .env file. At Spotify there is another field required "Redirect URIs". What should I fill in there? Second: When did the service try to load artist and album covers? I see the SpotifyService and the MediaMetadataService.php but I could not figure out, when this is called. If a add a new song and sync with `php artisan koel:sync` it seems, that these services are not called. If I click in the frontend nothing too. So what am I missing here? **To reproduce** Add spotify client and secret id, add a song and nothing will be there. **Expected behavior** The service is called and some data gets returned. **Screenshots** **Environment** - Koel version latest - OS: Ubuntu 22.04 and MacOs with ddev on an Mac M1 Pro - Firefox and Chrome - PHP version 8.0
kerem closed this issue 2026-02-26 02:34:39 +03:00
Author
Owner

@phanan commented on GitHub (May 12, 2023):

The cover is only fetched when the song is played AND if it was empty before.

<!-- gh-comment-id:1545476310 --> @phanan commented on GitHub (May 12, 2023): The cover is only fetched when the song is played AND if it was empty before.
Author
Owner

@andreknieriem commented on GitHub (May 12, 2023):

Ok. But why not adding this to the initial sync?

Just add to
App\Services\FileSynchronizer

on line 90 for example

$artist = Arr::get($info, 'artist') ? Artist::getOrCreate($info['artist']) : $this->song->artist;
if(!$artist->has_image) {
     $this->mediaMetadataService->tryDownloadArtistImage($artist);
}

and some later

if(!$album->has_cover) {
    $this->mediaMetadataService->tryDownloadAlbumCover($album);
}

Something like this? It is only needed, if no other image is found and it is a fast method. Or do you thinkt, that in a big sync to many spotify requests are generated?

Maybe additionally an AddSpotifyMetaDataCommand or something like this?

<!-- gh-comment-id:1545591565 --> @andreknieriem commented on GitHub (May 12, 2023): Ok. But why not adding this to the initial sync? Just add to App\Services\FileSynchronizer on line 90 for example ```php $artist = Arr::get($info, 'artist') ? Artist::getOrCreate($info['artist']) : $this->song->artist; if(!$artist->has_image) { $this->mediaMetadataService->tryDownloadArtistImage($artist); } ``` and some later ```php if(!$album->has_cover) { $this->mediaMetadataService->tryDownloadAlbumCover($album); } ``` Something like this? It is only needed, if no other image is found and it is a fast method. Or do you thinkt, that in a big sync to many spotify requests are generated? Maybe additionally an AddSpotifyMetaDataCommand or something like this?
Author
Owner

@phanan commented on GitHub (May 12, 2023):

It would create an overhead if you sync a lot of media and greatly slow down the sync process.

<!-- gh-comment-id:1545593555 --> @phanan commented on GitHub (May 12, 2023): It would create an overhead if you sync a lot of media and greatly slow down the sync process.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#920
No description provided.