Skip to content

Commit 6bf31be

Browse files
committed
chore(stats/converter): also cache artist item using id for use in genre parsing
1 parent 302355b commit 6bf31be

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

stats/src/extensions/cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const cache: Record<string, unknown> = {};
22

3-
const set = <T>(key: string, value: T) => {
3+
export const set = <T>(key: string, value: T) => {
44
cache[key] = value;
55
};
66

stats/src/utils/converter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { searchForAlbum, searchForArtist, searchForTrack } from "../api/spotify";
2-
import { cacher } from "../extensions/cache";
2+
import { cacher, set } from "../extensions/cache";
33
import type * as LastFM from "../types/lastfm";
44
import type * as Spotify from "../types/spotify";
55
import type {
@@ -63,6 +63,7 @@ export const convertArtist = async (artist: LastFM.Artist) => {
6363
uri: artist.url,
6464
type: "lastfm",
6565
} as LastFMMinifiedArtist;
66+
set(`artist-${spotifyArtist.id}`, spotifyArtist);
6667
return {
6768
...minifyArtist(spotifyArtist),
6869
playcount: Number(artist.playcount),

0 commit comments

Comments
 (0)