mirror of
https://github.com/austinried/subtracks.git
synced 2026-02-10 15:02:42 +01:00
added top songs to artist view
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
GetCoverArtParams,
|
||||
GetIndexesParams,
|
||||
GetMusicDirectoryParams,
|
||||
GetTopSongsParams,
|
||||
StreamParams,
|
||||
} from '@app/subsonic/params'
|
||||
import {
|
||||
@@ -22,6 +23,7 @@ import {
|
||||
GetArtistsResponse,
|
||||
GetIndexesResponse,
|
||||
GetMusicDirectoryResponse,
|
||||
GetTopSongsResponse,
|
||||
SubsonicResponse,
|
||||
} from '@app/subsonic/responses'
|
||||
import { Server } from '@app/models/settings'
|
||||
@@ -165,6 +167,11 @@ export class SubsonicApiClient {
|
||||
return new SubsonicResponse<GetArtistResponse>(xml, new GetArtistResponse(xml))
|
||||
}
|
||||
|
||||
async getTopSongs(params: GetTopSongsParams): Promise<SubsonicResponse<GetTopSongsResponse>> {
|
||||
const xml = await this.apiGetXml('getTopSongs', params)
|
||||
return new SubsonicResponse<GetTopSongsResponse>(xml, new GetTopSongsResponse(xml))
|
||||
}
|
||||
|
||||
//
|
||||
// Album/song lists
|
||||
//
|
||||
|
||||
@@ -27,6 +27,11 @@ export type GetArtistParams = {
|
||||
id: string
|
||||
}
|
||||
|
||||
export type GetTopSongsParams = {
|
||||
artist: string
|
||||
count?: number
|
||||
}
|
||||
|
||||
//
|
||||
// Album/song lists
|
||||
//
|
||||
|
||||
@@ -116,6 +116,17 @@ export class GetAlbumResponse {
|
||||
}
|
||||
}
|
||||
|
||||
export class GetTopSongsResponse {
|
||||
songs: ChildElement[] = []
|
||||
|
||||
constructor(xml: Document) {
|
||||
const childElements = xml.getElementsByTagName('song')
|
||||
for (let i = 0; i < childElements.length; i++) {
|
||||
this.songs.push(new ChildElement(childElements[i]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Album/song lists
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user