mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[feature-107] open playlist details from download modal + use new proto format for maps details cache
This commit is contained in:
@@ -23,3 +23,8 @@ ipc.on("bsv-search-playlist", (args, reply) => {
|
||||
const bsvService = BeatSaverService.getInstance();
|
||||
reply(from(bsvService.searchPlaylists(args)));
|
||||
});
|
||||
|
||||
ipc.on("bsv-get-playlist-details-by-id", (args, reply) => {
|
||||
const bsvService = BeatSaverService.getInstance();
|
||||
reply(from(bsvService.getPlaylistDetailsById(args.id, args.page)));
|
||||
});
|
||||
|
||||
@@ -77,6 +77,9 @@ export class SongDetailsCacheService {
|
||||
|
||||
const res: Record<string, SongDetails> = {};
|
||||
|
||||
RawSongDetailsDeserializer.setUploadersList(messageObj.uploaders);
|
||||
RawSongDetailsDeserializer.setDifficultyLabels(messageObj.difficultyLabels);
|
||||
|
||||
for(const rawSong of messageObj.songs){
|
||||
res[rawSong.hash.toLocaleLowerCase()] = RawSongDetailsDeserializer.deserialize(rawSong);
|
||||
}
|
||||
|
||||
@@ -95,4 +95,8 @@ export class BeatSaverApiService {
|
||||
url.search = new URLSearchParams(this.objectToStringRecord(search)).toString();
|
||||
return this.request.getJSON<PlaylistSearchResponse>(url.toString());
|
||||
}
|
||||
|
||||
public getPlaylistDetailsById(id: string, page = 0): Promise<BsvPlaylistPage> {
|
||||
return this.request.getJSON<BsvPlaylistPage>(`${this.bsaverApiUrl}/playlists/id/${id}/${page}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { splitIntoChunk } from "../../../../shared/helpers/array.helpers";
|
||||
import { BsvMapDetail } from "shared/models/maps";
|
||||
import { BsvPlaylist, PlaylistSearchParams, SearchParams } from "shared/models/maps/beat-saver.model";
|
||||
import { BsvPlaylist, BsvPlaylistPage, PlaylistSearchParams, SearchParams } from "shared/models/maps/beat-saver.model";
|
||||
import { BeatSaverApiService } from "./beat-saver-api.service";
|
||||
import log from "electron-log";
|
||||
|
||||
@@ -69,7 +69,15 @@ export class BeatSaverService {
|
||||
.then(res => res.docs)
|
||||
.catch(e => {
|
||||
log.error(e);
|
||||
return e;
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
|
||||
public getPlaylistDetailsById(id: string, page = 0): Promise<BsvPlaylistPage> {
|
||||
return this.bsaverApi.getPlaylistDetailsById(id, page)
|
||||
.catch(e => {
|
||||
log.error(e);
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user