[feat-607] add support for map info v4

This commit is contained in:
MathieuG-P
2024-10-15 20:26:05 +02:00
parent 0d93c984be
commit 7468554ea0
15 changed files with 272 additions and 86 deletions
@@ -1,11 +1,11 @@
import { RawMapInfoData } from "./raw-map.model";
import { MapInfo } from "./info/map-info.model";
import { SongDetails } from "./song-details-cache/song-details-cache.model";
export interface BsmLocalMap {
hash: string;
coverUrl: string;
songUrl: string;
rawInfo: RawMapInfoData;
mapInfo: MapInfo;
songDetails?: SongDetails;
path: string;
}
-1
View File
@@ -1,3 +1,2 @@
export { RawMapInfoData, RawMapDifficulty, RawDifficultySet } from "./raw-map.model";
export { BsvInstant, BsvMapDetail, BsvMapDetailMetadata, BsvMapDifficulty, BsvMapParitySummary, BsvMapStats, BsvMapTestplay, BsvMapVersion, BsvUserDetail } from "./beat-saver.model";
export { SongDetails, SongDifficulty, SongUploader, SongDetailDiffCharactertistic, SongDiffName } from "./song-details-cache/song-details-cache.model";
@@ -0,0 +1,42 @@
import { SongDetailDiffCharactertistic, SongDiffName } from "../song-details-cache/song-details-cache.model";
import { RawMapInfoDataV2 } from "./raw-map-info-v2.model";
import { RawMapInfoDataV4 } from "./raw-map-info-v4.model";
export type AnyRawMapInfo = RawMapInfoDataV2 | RawMapInfoDataV4;
// interfaces/mapInfo.ts
export interface MapInfo {
version: string;
songName: string;
songSubName?: string;
songAuthorName: string;
levelMappers: string[];
levelLighters: string[];
beatsPerMinute: number;
shuffle?: number;
shufflePeriod?: number;
previewStartTime: number;
previewDuration: number;
songFilename: string;
songPreviewFilename: string;
coverImageFilename: string;
environmentNames: string[];
difficulties: MapDifficulty[];
}
export interface MapDifficulty {
characteristic: SongDetailDiffCharactertistic;
difficulty: SongDiffName;
difficultyLabel?: string;
beatmapFilename: string;
noteJumpMovementSpeed: number;
noteJumpStartBeatOffset: number;
beatmapColorSchemeIdx?: number;
environmentNameIdx?: number;
// Additional fields from version 4.0.0
beatmapAuthors?: {
mappers: string[];
lighters: string[];
};
lightshowDataFilename?: string;
}
@@ -1,6 +1,6 @@
import { SongDetailDiffCharactertistic, SongDiffName } from "./song-details-cache/song-details-cache.model";
import { SongDetailDiffCharactertistic, SongDiffName } from "../song-details-cache/song-details-cache.model";
export interface RawMapInfoData<T = unknown> {
export interface RawMapInfoDataV2 {
_version: string;
_songName: string;
_songSubName: string;
@@ -16,24 +16,24 @@ export interface RawMapInfoData<T = unknown> {
_environmentName: string;
_allDirectionsEnvironmentName: string;
_songTimeOffset: number;
_customData: T;
_difficultyBeatmapSets: RawDifficultySet[];
_difficultyBeatmapSets: RawDifficultySetV2[];
// Additional fields for 2.1.0
_environmentNames?: string[];
_colorSchemes?: unknown[];
}
export interface RawDifficultySet {
interface RawDifficultySetV2 {
_beatmapCharacteristicName: SongDetailDiffCharactertistic;
_difficultyBeatmaps: RawMapDifficulty[];
_difficultyBeatmaps: RawMapDifficultyV2[];
}
export interface RawMapDifficulty {
interface RawMapDifficultyV2 {
_difficulty: SongDiffName;
_difficultyRank: string;
_difficultyRank: number;
_beatmapFilename: string;
_noteJumpMovementSpeed: number;
_noteJumpStartBeatOffset: number;
_customData?: RawMapDifficultyCustomData;
}
export interface RawMapDifficultyCustomData {
_difficultyLabel?: string;
_beatmapColorSchemeIdx?: number;
_environmentNameIdx?: number;
_customData?: { _difficultyLabel?: string; };
}
@@ -0,0 +1,40 @@
import { SongDetailDiffCharactertistic, SongDiffName } from "../song-details-cache/song-details-cache.model";
// interfaces/version4.ts
export interface RawMapInfoDataV4 {
version: string;
song: {
title: string;
subTitle: string;
author: string;
};
audio: {
songFilename: string;
songDuration: number;
audioDataFilename: string;
bpm: number;
lufs: number;
previewStartTime: number;
previewDuration: number;
};
songPreviewFilename: string;
coverImageFilename: string;
environmentNames: string[];
colorSchemes: unknown[];
difficultyBeatmaps: RawMapDifficultyV4[];
}
interface RawMapDifficultyV4 {
characteristic: SongDetailDiffCharactertistic;
difficulty: SongDiffName;
beatmapAuthors: {
mappers: string[];
lighters: string[];
};
environmentNameIdx: number;
beatmapColorSchemeIdx: number;
noteJumpMovementSpeed: number;
noteJumpStartBeatOffset: number;
beatmapDataFilename: string;
lightshowDataFilename: string;
}