From e23934bb2a26bf26a5d0ba261bb9ce27699cf8c4 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sat, 28 Aug 2021 02:45:28 -0700 Subject: [PATCH] fix song cache check --- src/components/player/Player.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/player/Player.tsx b/src/components/player/Player.tsx index 9343235..019ff29 100644 --- a/src/components/player/Player.tsx +++ b/src/components/player/Player.tsx @@ -216,7 +216,7 @@ const Player = ({ children }: any, ref: any) => { }); }; - const checkCachedSong = (id: number) => { + const checkCachedSong = (id: string) => { const rootCacheFolder = path.join( path.dirname(settings.file()), 'sonixdCache', @@ -226,9 +226,7 @@ const Player = ({ children }: any, ref: any) => { const songCacheFolder = path.join(rootCacheFolder, 'song'); const songCache = fs.readdirSync(songCacheFolder); - const matchedSong = songCache.filter( - (song) => Number(song.split('.')[0]) === id - ); + const matchedSong = songCache.filter((song) => song.split('.')[0] === id); if (matchedSong.length !== 0) { return path.join(songCacheFolder, matchedSong[0]);