diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/services/get-songs.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/services/get-songs.ts b/src/services/get-songs.ts index d3e951d..c7d37ea 100644 --- a/src/services/get-songs.ts +++ b/src/services/get-songs.ts @@ -6,7 +6,7 @@ import spotifyURI from 'spotify-uri'; import Spotify from 'spotify-web-api-node'; import YouTube, {YoutubePlaylistItem} from 'youtube.ts'; import pLimit from 'p-limit'; -import uniqueRandomArray from 'unique-random-array'; +import shuffle from 'array-shuffle'; import {QueuedSong, QueuedPlaylist} from '../services/player'; import {TYPES} from '../types'; @@ -182,12 +182,9 @@ export default class { const originalNSongs = tracks.length; if (tracks.length > 50) { - const random = uniqueRandomArray(tracks); + const shuffled = shuffle(tracks); - tracks = []; - for (let i = 0; i < 50; i++) { - tracks.push(random()); - } + tracks = shuffled.slice(0, 50); } // Limit concurrency so hopefully we don't get banned for searching |
