mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[feature-107] we can now download playlist from beatsaver + other internal changes
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { PlaylistItemComponentProps } from "renderer/components/maps-playlists-panel/playlists/playlist-item.component";
|
||||
import { BsvPlaylist } from "shared/models/maps/beat-saver.model";
|
||||
import { LocalBPListsDetails } from "shared/models/playlists/local-playlist.models";
|
||||
|
||||
|
||||
export abstract class PlaylistItemComponentPropsMapper {
|
||||
|
||||
|
||||
static fromBsvPlaylist(playlist: BsvPlaylist): PlaylistItemComponentProps {
|
||||
return {
|
||||
title: playlist.name,
|
||||
author: playlist.owner.name,
|
||||
coverUrl: playlist.playlistImage,
|
||||
nbMaps: playlist.stats?.totalMaps,
|
||||
nbMappers: playlist.stats?.mapperCount,
|
||||
duration: playlist.stats?.totalDuration,
|
||||
maxNps: playlist.stats?.maxNps,
|
||||
minNps: playlist.stats?.minNps
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static fromLocalBPListDetails(playlist: LocalBPListsDetails): PlaylistItemComponentProps {
|
||||
return {
|
||||
title: playlist.playlistTitle,
|
||||
author: playlist.playlistAuthor,
|
||||
coverBase64: playlist.image,
|
||||
nbMaps: playlist.nbMaps,
|
||||
nbMappers: playlist.nbMappers,
|
||||
duration: playlist.duration,
|
||||
maxNps: playlist.maxNps,
|
||||
minNps: playlist.minNps
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { BSVersion } from "shared/bs-version.interface";
|
||||
import { BSLaunchEventData, LaunchOption } from "shared/models/bs-launch";
|
||||
import { BsvMapDetail } from "shared/models/maps";
|
||||
import { BsmLocalMap, BsmLocalMapsProgress, DeleteMapsProgress } from "shared/models/maps/bsm-local-map.interface";
|
||||
import { SearchParams } from "../maps/beat-saver.model";
|
||||
import { BsvPlaylist, PlaylistSearchParams, SearchParams } from "../maps/beat-saver.model";
|
||||
import { ImportVersionOptions } from "main/services/bs-local-version.service";
|
||||
import { DownloadInfo, DownloadSteamInfo } from "main/services/bs-version-download/bs-steam-downloader.service";
|
||||
import { DepotDownloaderEvent } from "../bs-version-download/depot-downloader.model";
|
||||
@@ -22,7 +22,7 @@ import { LocalBPList, LocalBPListsDetails } from "../playlists/local-playlist.mo
|
||||
|
||||
export type IpcReplier<T> = (data: Observable<T>) => void;
|
||||
|
||||
export interface IpcChannelMapping extends Record<string, { request: unknown, response: unknown }> {
|
||||
export interface IpcChannelMapping {
|
||||
|
||||
/* ** bs-download-ipcs ** */
|
||||
"import-version": { request: ImportVersionOptions, response: Progression<BSVersion>};
|
||||
@@ -41,6 +41,7 @@ export interface IpcChannelMapping extends Record<string, { request: unknown, re
|
||||
"bsv-search-map": {request: SearchParams, response: BsvMapDetail[]};
|
||||
"bsv-get-map-details-from-hashs": {request: string[], response: BsvMapDetail[]};
|
||||
"bsv-get-map-details-by-id": {request: string, response: BsvMapDetail};
|
||||
"bsv-search-playlist": {request: PlaylistSearchParams, response: BsvPlaylist[]};
|
||||
|
||||
/* ** bs-launcher-ipcs ** */
|
||||
"create-launch-shortcut": { request: LaunchOption, response: boolean };
|
||||
@@ -80,7 +81,7 @@ export interface IpcChannelMapping extends Record<string, { request: unknown, re
|
||||
"register-playlists-deep-link": { request: void, response: boolean };
|
||||
"unregister-playlists-deep-link": { request: void, response: boolean };
|
||||
"is-playlists-deep-links-enabled": { request: void, response: boolean };
|
||||
"install-playlist": {request: {playlist: BPList, version?: BSVersion, ignoreSongsHashs?: string[]}, response: Progression<DownloadPlaylistProgressionData>};
|
||||
"download-playlist": {request: {downloadSource: string, dest?: string, version?: BSVersion, ignoreSongsHashs?: string[]}, response: Progression<DownloadPlaylistProgressionData>};
|
||||
"get-version-playlists-details": {request: BSVersion, response: Progression<LocalBPListsDetails[]>};
|
||||
"delete-playlist": {request: {version: BSVersion, bpList: LocalBPList, deleteMaps?: boolean}, response: Progression};
|
||||
|
||||
|
||||
@@ -195,8 +195,22 @@ export enum MapType {
|
||||
export const MapTags = { ...MapStyle, ...MapType };
|
||||
export type MapTag = MapStyle | MapType;
|
||||
|
||||
export type MapRequirement = "chroma" | "noodle" | "me" | "cinema";
|
||||
export type MapSpecificity = "automapper" | "ranked" | "curated" | "verified" | "fullSpread";
|
||||
export enum MapRequirement {
|
||||
Chroma = "chroma",
|
||||
Noodle = "noodle",
|
||||
Me = "me",
|
||||
Cinema = "cinema"
|
||||
|
||||
}
|
||||
|
||||
export enum MapSpecificity {
|
||||
Automapper = "automapper",
|
||||
Ranked = "ranked",
|
||||
Curated = "curated",
|
||||
Verified = "verified",
|
||||
FullSpread = "fullSpread"
|
||||
|
||||
}
|
||||
|
||||
export interface MapFilter {
|
||||
automapper?: boolean;
|
||||
@@ -224,15 +238,24 @@ export interface SearchResponse {
|
||||
redirect: string;
|
||||
}
|
||||
|
||||
export interface PlaylistSearchResponse {
|
||||
docs: BsvPlaylist[];
|
||||
}
|
||||
|
||||
export interface SearchParams {
|
||||
sortOrder: SearchOrder;
|
||||
sortOrder: BsvSearchOrder;
|
||||
filter?: MapFilter;
|
||||
page?: number;
|
||||
q?: string;
|
||||
includeEmpty?: boolean;
|
||||
}
|
||||
|
||||
export type SearchOrder = "Latest" | "Relevance" | "Rating" | "Curated";
|
||||
export enum BsvSearchOrder {
|
||||
Latest = "Latest",
|
||||
Relevance = "Relevance",
|
||||
Rating = "Rating",
|
||||
Curated = "Curated"
|
||||
}
|
||||
|
||||
export interface BsvMapDetailWithOrder {
|
||||
map: BsvMapDetail;
|
||||
@@ -251,10 +274,17 @@ export interface BsvPlaylist {
|
||||
playlistId: number;
|
||||
playlistImage: string;
|
||||
playlistImage512: string;
|
||||
public: boolean;
|
||||
songsChangedAt: BsvInstant;
|
||||
stats: BsvPlaylistStats;
|
||||
updatedAt: BsvInstant;
|
||||
type: BsvPlaylistType;
|
||||
}
|
||||
|
||||
export enum BsvPlaylistType {
|
||||
Private = "Private",
|
||||
Public = "Public",
|
||||
System = "System",
|
||||
Search = "Search"
|
||||
}
|
||||
|
||||
export interface BsvPlaylistStats {
|
||||
@@ -275,3 +305,16 @@ export interface BsvPlaylistPage {
|
||||
maps: BsvMapDetailWithOrder[];
|
||||
playlist: BsvPlaylist;
|
||||
}
|
||||
|
||||
export interface PlaylistSearchParams {
|
||||
q?: string;
|
||||
page?: number;
|
||||
sortOrder: BsvSearchOrder;
|
||||
from?: string;
|
||||
to?: string;
|
||||
minNps?: number;
|
||||
maxNps?: number;
|
||||
curated?: boolean;
|
||||
verified?: boolean;
|
||||
includeEmpty?: boolean;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { SongDiffName } from "./song-details-cache/song-details-cache.model";
|
||||
|
||||
export const MAP_DIFFICULTIES_COLORS: Record<SongDiffName, string> = {
|
||||
Easy: "#00FF9E",
|
||||
Normal: "#00FFFF",
|
||||
Hard: "#FFA700",
|
||||
Expert: "#FF4319",
|
||||
ExpertPlus: "#FF7EFF",
|
||||
};
|
||||
Reference in New Issue
Block a user