Saved Album Tracks filtered by Last.fm top artists #237
Answered
by
Chimildic
BuckeyePay
asked this question in
Помощь с алгоритмом
-
I am having a bit of logic problem. I am trying to create a playlist of tracks from my saved albums from a select number of my top artists from last.fm. What I don't know is how to get from artists to tracks, or if that is even possible. let artists = Lastfm.getTopArtists({ not sure how to use this with getSavedAlbumTracks or getSavedAlbums based up the last.fm artists, or that is even something I can do. |
Beta Was this translation helpful? Give feedback.
Answered by
Chimildic
Jan 8, 2023
Replies: 1 comment 1 reply
-
function createPlaylistFromSavedAlbumsByTopArtists() {
let savedAlbums = Source.getSavedAlbums()
let topArtists = Lastfm.getCustomTop({
type: 'artist',
user: KeyValue.LASTFM_LOGIN,
from: '2022-01-01',
to: '2022-12-31',
count: 25,
})
Filter.removeArtists(savedAlbums, topArtists, true)
let albumsTracks = savedAlbums.map(a => a.tracks.items).flat()
Playlist.saveWithReplace({
name: 'Saved Albums From Top Artists',
tracks: albumsTracks
})
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Chimildic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lastfm.getTopArtists
don't give top for5year
period. Because last.fm API have only such parameters:overall
,7day
,1month
,3month
,6month
,12month
. But goofy have getCustomTop.invert = true
.map
loop. With general albums probably require additional requests.