Skip to content

Commit 205c87d

Browse files
committed
fix: Handle playlist adds with more than 100 songs in them
1 parent 1221fd1 commit 205c87d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/publishers/spotify_add_to_playlist.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ impl Job for SpotifyAddToPlaylist {
3434

3535
let playlist_id = self.get_playlist_id(job, &services).await?;
3636

37-
client
38-
.add_tracks_to_playlist(&playlist_id, job.track_uris.clone())
39-
.await?;
40-
37+
for chunk in job.track_uris.chunks(100) {
38+
client
39+
.add_tracks_to_playlist(&playlist_id, chunk.to_vec())
40+
.await?;
41+
}
42+
4143
Ok(())
4244
}
4345
}

0 commit comments

Comments
 (0)