Skip to content

Commit

Permalink
work on parser, finish metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
konekowo committed Jun 18, 2024
1 parent 3c8b179 commit 5b7169a
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 8 deletions.
8 changes: 7 additions & 1 deletion src/Screens/IntroScreen/IntroScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {MainMenu} from "../MainMenu/MainMenu";
import {AudioPlayer} from "../../Audio/AudioPlayer";
import {LazerLogo} from "./LazerLogo";
import {Menu} from "../../Elements/MainMenu/OsuCircle/Menu/Menu";
import {BeatmapData} from "../../Util/Beatmap/Data/BeatmapData";
import {BeatmapParser} from "../../Util/Beatmap/Parser/BeatmapParser";

export class IntroScreen extends Screen {

Expand Down Expand Up @@ -75,7 +77,11 @@ export class IntroScreen extends Screen {
});
}
if (name.endsWith(".osu")){
// TODO: parse
entry.text().then((osuFile) => {
let beatmapData = BeatmapParser.parse(osuFile);
console.log(beatmapData);
})

}
}
}, 500);
Expand Down
12 changes: 11 additions & 1 deletion src/Util/Beatmap/Data/BeatmapData.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import {GeneralData} from "./Sections/General/GeneralData";
import {EditorData} from "./Sections/Editor/EditorData";
import {Metadata} from "./Sections/Metadata/Metadata";

export class BeatmapData {
/**
* General information about the beatmap
*/
public General: GeneralData = new GeneralData();
/**
* Saved settings for the beatmap editor
*/
public Editor: EditorData = new EditorData();

/**
* <a href="https://osu.ppy.sh/wiki/en/Client/Beatmap_editor/Song_setup#general">Information</a> used to identify the beatmap
*/
public Metadata: Metadata = new Metadata();

}
43 changes: 41 additions & 2 deletions src/Util/Beatmap/Data/Sections/Metadata/Metadata.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
/**
* Information used to identify the beatmap
* <a href="https://osu.ppy.sh/wiki/en/Client/Beatmap_editor/Song_setup#general">Information</a> used to identify the beatmap
*/
export class Metadata {

/**
* Romanised song title
*/
public Title!: string;
/**
* Song title
*/
public TitleUnicode!: string;
/**
* Romanised song artist
*/
public Artist!: string;
/**
* Song artist
*/
public ArtistUnicode!: string;
/**
* Beatmap creator
*/
public Creator!: string;
/**
* Difficulty name
*/
public Version!: string;
/**
* Original media the song was produced for
*/
public Source: string | undefined;
/**
* Search terms
*/
public Tags!: string[];
/**
* Difficulty ID
*/
public BeatmapID!: number;
/**
* Beatmap ID
*/
public BeatmapSetID!: number;
}
10 changes: 6 additions & 4 deletions src/Util/Beatmap/Parser/BeatmapParser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export class BeatmapParser {
public constructor() {
import {BeatmapData} from "../Data/BeatmapData";

export class BeatmapParser {
public static parse(osuFileContent: string): BeatmapData {
// TODO: parse .osu! file
return new BeatmapData();
}

}
}

0 comments on commit 5b7169a

Please sign in to comment.