mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
Remove tracks function, replace with just getting album
This commit is contained in:
@@ -175,8 +175,7 @@ export interface MusicLibrary {
|
||||
artists(q: ArtistQuery): Promise<Result<ArtistSummary>>;
|
||||
artist(id: string): Promise<Artist>;
|
||||
albums(q: AlbumQuery): Promise<Result<AlbumSummary>>;
|
||||
album(id: string): Promise<AlbumSummary>;
|
||||
tracks(albumId: string): Promise<Track[]>;
|
||||
album(id: string): Promise<Album>;
|
||||
track(trackId: string): Promise<Track>;
|
||||
genres(): Promise<Genre[]>;
|
||||
years(): Promise<Year[]>;
|
||||
|
||||
@@ -981,7 +981,8 @@ function bindSmapiSoapServiceToExpress(
|
||||
});
|
||||
case "album":
|
||||
return musicLibrary
|
||||
.tracks(typeId!)
|
||||
.album(typeId!)
|
||||
.then(it => it.tracks)
|
||||
.then(slice2(paging))
|
||||
.then(([page, total]) => {
|
||||
return getMetadataResult({
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
AlbumQuery,
|
||||
ArtistQuery,
|
||||
MusicLibrary,
|
||||
Album,
|
||||
AlbumSummary,
|
||||
Rating,
|
||||
Artist,
|
||||
@@ -19,9 +20,7 @@ import {
|
||||
import {
|
||||
Subsonic,
|
||||
CustomPlayers,
|
||||
GetAlbumResponse,
|
||||
asTrack,
|
||||
asAlbumSummary,
|
||||
PingResponse,
|
||||
NO_CUSTOM_PLAYERS,
|
||||
asToken,
|
||||
@@ -171,25 +170,11 @@ export class SubsonicMusicLibrary implements MusicLibrary {
|
||||
albums = async (q: AlbumQuery): Promise<Result<AlbumSummary>> =>
|
||||
this.subsonic.getAlbumList2(this.credentials, q);
|
||||
|
||||
// todo: this should probably return an Album
|
||||
album = (id: string): Promise<AlbumSummary> =>
|
||||
this.subsonic.getAlbum(this.credentials, id).then(albumToAlbumSummary);
|
||||
album = (id: string): Promise<Album> =>
|
||||
this.subsonic.getAlbum(this.credentials, id);
|
||||
|
||||
genres = () => this.subsonic.getGenres(this.credentials);
|
||||
|
||||
// todo: do we even need this if Album has tracks?
|
||||
tracks = (albumId: string) =>
|
||||
this.subsonic
|
||||
.getJSON<GetAlbumResponse>(this.credentials, "/rest/getAlbum", {
|
||||
id: albumId,
|
||||
})
|
||||
.then((it) => it.album)
|
||||
.then((album) =>
|
||||
(album.song || []).map((song) =>
|
||||
asTrack(asAlbumSummary(album), song, this.customPlayers)
|
||||
)
|
||||
);
|
||||
|
||||
track = (trackId: string) =>
|
||||
this.subsonic.getTrack(this.credentials, trackId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user