add playlist

This commit is contained in:
aria
2024-09-05 22:19:30 -04:00
parent 1381c203f2
commit 901d326c8b
4 changed files with 36 additions and 8 deletions

View File

@@ -4,9 +4,10 @@ import type {
SpotifyThumbnail,
SpotifyTrack,
SpotifyEpisode,
SpotifyPodcast
SpotifyPodcast,
SpotifyPlaylist
} from 'librespot/types'
import { Album, Artist, Episode, Podcast, Track } from '../../types.js'
import { Album, Artist, Episode, Playlist, Podcast, Track } from '../../types.js'
function parseThumbnails(raw: SpotifyThumbnail[]) {
return raw
@@ -92,3 +93,14 @@ export function parsePodcast(raw: SpotifyPodcast) {
return podcast
}
export function parsePlaylist(raw: SpotifyPlaylist) {
const playlist: Playlist = {
id: raw.id,
title: raw.name,
url: raw.externalUrl,
trackCount: raw.totalTracks
}
return playlist
}