diff --git a/src/components/player/TrackInfo/AlbumArt.tsx b/src/components/player/TrackInfo/AlbumArt.tsx index 40c9564e..438d8a86 100644 --- a/src/components/player/TrackInfo/AlbumArt.tsx +++ b/src/components/player/TrackInfo/AlbumArt.tsx @@ -46,6 +46,7 @@ const AlbumArt: React.FC = ({ useNativeDriver: true, }), ]).start(() => { + console.log('artwork', track?.artwork); console.log('TrackInfo: Setting imagevisible to Image', !isImageVisible); setIsImageVisible(false); }); diff --git a/src/stores/appStore.ts b/src/stores/appStore.ts index 3a6a1e21..7c839155 100644 --- a/src/stores/appStore.ts +++ b/src/stores/appStore.ts @@ -11,7 +11,6 @@ import { import { logger } from '@utils/Logger'; import rejson from '../utils/rejson.json'; import { LoadJSONRegExtractors } from '../utils/re'; -import { SOURCE } from '@enums/MediaFetch'; interface AppStore { pipMode: boolean; @@ -181,12 +180,9 @@ export const cacheResolvedURL = async ( ) { logger.debug(`[CacheResolveURL] ${song.parsedName} needs to be refetched.`); const result = await resolveURL(song); - // HACK: do not cache any local source files - if (song.source !== SOURCE.local) { - appStore.setState({ - cachedResolveURLMap: { ...cachedResolveURLMap, [song.id]: result }, - }); - } + appStore.setState({ + cachedResolveURLMap: { ...cachedResolveURLMap, [song.id]: result }, + }); return result; } return cachedResolvedURL; diff --git a/src/utils/mediafetch/local.ts b/src/utils/mediafetch/local.ts index 51fc9281..bd342ba7 100644 --- a/src/utils/mediafetch/local.ts +++ b/src/utils/mediafetch/local.ts @@ -9,6 +9,7 @@ * each site needs a fetch to parse regex extracted, a videoinfo fetcher and a song fetcher. */ import { Platform, NativeModules } from 'react-native'; +import RNFetchBlob from 'react-native-blob-util'; import { probeMetadata, cacheAlbumArt } from '@utils/ffmpeg/ffmpeg'; import { SOURCE } from '@enums/MediaFetch'; @@ -55,7 +56,9 @@ const regexFetch = async ({ }); const resolveURL = async (song: NoxMedia.Song) => { - return { url: song.bvid, cover: await cacheAlbumArt(song.bvid) }; + const artworkURI = await cacheAlbumArt(song.bvid); + const artworkBase64 = await RNFetchBlob.fs.readFile(artworkURI, 'base64'); + return { url: song.bvid, cover: `data:image/png;base64,${artworkBase64}` }; }; const refreshSong = (song: NoxMedia.Song) => song;