diff --git a/js/api.js b/js/api.js index 17dcae7..6d8427c 100644 --- a/js/api.js +++ b/js/api.js @@ -675,8 +675,10 @@ export class LosslessAPI { async getArtist(artistId, options = {}) { const cacheKey = options.lightweight ? `artist_${artistId}_light` : `artist_${artistId}`; - const cached = await this.cache.get('artist', cacheKey); - if (cached) return cached; + if (!options.skipCache) { + const cached = await this.cache.get('artist', cacheKey); + if (cached) return cached; + } const [primaryResponse, contentResponse] = await Promise.all([ this.fetchWithRetry(`/artist/?id=${artistId}`), @@ -811,7 +813,7 @@ export class LosslessAPI { } } - async getRecommendedTracksForPlaylist(tracks, limit = 20) { + async getRecommendedTracksForPlaylist(tracks, limit = 20, options = {}) { const artistMap = new Map(); // Check if tracks already have artist info (some might) @@ -872,7 +874,7 @@ export class LosslessAPI { const artistPromises = artistsToProcess.map(async (artist) => { try { console.log(`Fetching tracks for artist: ${artist.name} (ID: ${artist.id})`); - const artistData = await this.getArtist(artist.id, { lightweight: true }); + const artistData = await this.getArtist(artist.id, { lightweight: true, skipCache: options.skipCache }); if (artistData && artistData.tracks && artistData.tracks.length > 0) { const newTracks = artistData.tracks.filter((track) => !seenTrackIds.has(track.id)).slice(0, 4); return newTracks; diff --git a/js/music-api.js b/js/music-api.js index 5e0974f..d0902e7 100644 --- a/js/music-api.js +++ b/js/music-api.js @@ -154,9 +154,9 @@ export class MusicAPI { return api.getSimilarAlbums(cleanId); } - async getRecommendedTracksForPlaylist(tracks, limit = 20) { + async getRecommendedTracksForPlaylist(tracks, limit = 20, options = {}) { // Use Tidal for recommendations - return this.tidalAPI.getRecommendedTracksForPlaylist(tracks, limit); + return this.tidalAPI.getRecommendedTracksForPlaylist(tracks, limit, options); } // Cache methods diff --git a/js/ui.js b/js/ui.js index f01c0e2..0bc8f93 100644 --- a/js/ui.js +++ b/js/ui.js @@ -624,6 +624,7 @@ export class UIRenderer {
+ `; } @@ -639,10 +640,10 @@ export class UIRenderer { } createSkeletonTracks(count = 5, showCover = false) { - return `