Ability to browse Random Albums

This commit is contained in:
simojenki
2021-03-23 10:42:49 +11:00
parent 8f5905c16f
commit 4730511a84
8 changed files with 185 additions and 89 deletions

View File

@@ -21,11 +21,11 @@ import {
} from "./music_service";
import X2JS from "x2js";
import sharp from "sharp";
import { pick } from "underscore";
import axios, { AxiosRequestConfig } from "axios";
import { Encryption } from "./encryption";
import randomString from "./random_string";
import { fold } from "fp-ts/lib/Option";
export const BROWSER_HEADERS = {
accept:
@@ -391,17 +391,9 @@ export class Navidrome implements MusicService {
albums: (q: AlbumQuery): Promise<Result<AlbumSummary>> =>
navidrome
.getJSON<GetAlbumListResponse>(credentials, "/rest/getAlbumList", {
...fold(
() => ({
type: "alphabeticalByArtist",
}),
(genre) => ({
type: "byGenre",
genre,
})
)(O.fromNullable(q.genre)),
size: MAX_ALBUM_LIST,
offset: 0,
...pick(q, 'type', 'genre'),
size: Math.min(MAX_ALBUM_LIST, q._count),
offset: q._index,
})
.then((response) => response.albumList.album || [])
.then((albumList) =>