osu-play 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -12
- package/package.json +11 -11
- package/src/cli/main.ts +53 -60
- package/dist/index.d.ts +0 -124
- package/dist/index.js +0 -329
- package/dist/index.js.map +0 -1
- package/dist/src/cli/main.d.ts +0 -24
- package/dist/src/cli/main.js +0 -442
- package/dist/src/cli/main.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,34 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<br>
|
|
3
|
+
osu!play
|
|
4
|
+
<br>
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
[](https://npmjs.org/package/osu-play)
|
|
7
|
+
[](https://www.npmjs.com/package/osu-play)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
</h1>
|
|
11
|
+
|
|
12
|
+
> Listen to your favourite [osu!lazer](https://lazer.ppy.sh) beatmaps as a
|
|
13
|
+
> spotify playlist from the terminal
|
|
4
14
|
|
|
5
15
|
## Installation
|
|
6
16
|
|
|
7
17
|
### Requirements
|
|
8
18
|
|
|
9
19
|
- [Node.js](https://nodejs.org/en/) (v18 or higher)
|
|
10
|
-
- [osu!lazer](https://lazer.ppy.sh/home/download) with some beatmaps to listen
|
|
20
|
+
- [osu!lazer](https://lazer.ppy.sh/home/download) with some beatmaps to listen
|
|
21
|
+
to 😉
|
|
11
22
|
- That's it!
|
|
12
23
|
|
|
13
24
|
### Quick start
|
|
14
25
|
|
|
15
26
|
- Try out the latest release without installing anything:
|
|
16
27
|
|
|
17
|
-
```sh
|
|
18
|
-
npx osu-play # using npm
|
|
19
|
-
pnpm dlx osu-play # using pnpm
|
|
20
|
-
```
|
|
28
|
+
```sh
|
|
29
|
+
npx osu-play # using npm
|
|
30
|
+
pnpm dlx osu-play # using pnpm
|
|
31
|
+
```
|
|
21
32
|
|
|
22
33
|
- Install the latest release globally:
|
|
23
34
|
|
|
24
|
-
```sh
|
|
25
|
-
npm i -g osu-play # using npm
|
|
26
|
-
pnpm i -g osu-play # using pnpm
|
|
27
|
-
```
|
|
35
|
+
```sh
|
|
36
|
+
npm i -g osu-play # using npm
|
|
37
|
+
pnpm i -g osu-play # using pnpm
|
|
38
|
+
```
|
|
28
39
|
|
|
29
40
|
## Usage
|
|
30
41
|
|
|
31
42
|
The `osu-play` command can be used with the following options:
|
|
43
|
+
|
|
32
44
|
```sh
|
|
33
45
|
➜ korigamik git:(main) ✗ osu-play --help
|
|
34
46
|
Play music from your osu!lazer beatmaps from the terminal
|
|
@@ -55,4 +67,3 @@ import { lazer } from "osu-play";
|
|
|
55
67
|
|
|
56
68
|
const realm = getLazerDB();
|
|
57
69
|
```
|
|
58
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "osu-play",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Play music from your osu!lazer beatmaps from the terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/osu-play.js",
|
|
@@ -19,16 +19,23 @@
|
|
|
19
19
|
"bin": {
|
|
20
20
|
"osu-play": "./bin/osu-play.js"
|
|
21
21
|
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
24
|
+
"build": "tsup",
|
|
25
|
+
"start": "./bin/osu-play.js",
|
|
26
|
+
"dev:start": "tsc && ./bin/osu-play.js",
|
|
27
|
+
"clean": "rm -rf dist"
|
|
28
|
+
},
|
|
22
29
|
"author": "KorigamiK",
|
|
23
30
|
"license": "MIT",
|
|
24
31
|
"devDependencies": {
|
|
25
32
|
"@types/node": "^20.8.9",
|
|
26
33
|
"@types/prompts": "^2.4.7",
|
|
27
|
-
"tsup": "^
|
|
34
|
+
"tsup": "^8.0.2",
|
|
28
35
|
"typescript": "^5.2.2"
|
|
29
36
|
},
|
|
30
37
|
"dependencies": {
|
|
31
|
-
"@types/yargs": "^17.0.
|
|
38
|
+
"@types/yargs": "^17.0.32",
|
|
32
39
|
"prompts": "^2.4.2",
|
|
33
40
|
"realm": "^12.2.1",
|
|
34
41
|
"yargs": "^17.7.2"
|
|
@@ -45,12 +52,5 @@
|
|
|
45
52
|
"type": "git",
|
|
46
53
|
"url": "https://github.com/KorigamiK/osu-play"
|
|
47
54
|
},
|
|
48
|
-
"bugs": "https://github.com/KorigamiK/osu-play/issues"
|
|
49
|
-
"scripts": {
|
|
50
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
51
|
-
"build": "tsup",
|
|
52
|
-
"start": "./bin/osu-play.js",
|
|
53
|
-
"dev:start": "tsc && ./bin/osu-play.js",
|
|
54
|
-
"clean": "rm -rf dist"
|
|
55
|
-
}
|
|
55
|
+
"bugs": "https://github.com/KorigamiK/osu-play/issues"
|
|
56
56
|
}
|
package/src/cli/main.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { existsSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { execFileSync } from "node:child_process";
|
|
4
3
|
|
|
5
4
|
import Realm from "realm";
|
|
6
5
|
import prompts from "prompts";
|
|
@@ -10,45 +9,49 @@ import { getLazerDB, getNamedFileHash, hashedFilePath } from "../realm/mod.js";
|
|
|
10
9
|
|
|
11
10
|
import yargs from "yargs/yargs";
|
|
12
11
|
import { hideBin } from "yargs/helpers";
|
|
12
|
+
import util from "node:util";
|
|
13
|
+
import { execFile } from "node:child_process";
|
|
14
|
+
|
|
15
|
+
const execFilePromise = util.promisify(execFile);
|
|
13
16
|
|
|
14
17
|
export function getArgs() {
|
|
15
18
|
const argv = yargs(hideBin(process.argv))
|
|
16
19
|
.usage("Play music from your osu!lazer beatmaps from the terminal\nUsage: $0 [options]")
|
|
17
20
|
.options({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
21
|
+
reload: {
|
|
22
|
+
type: "boolean",
|
|
23
|
+
default: false,
|
|
24
|
+
alias: "r",
|
|
25
|
+
describe: "Reload lazer database",
|
|
26
|
+
},
|
|
27
|
+
exportPlaylist: {
|
|
28
|
+
type: "string",
|
|
29
|
+
describe: "Export playlist to a file",
|
|
30
|
+
},
|
|
31
|
+
osuDataDir: {
|
|
32
|
+
type: "string",
|
|
33
|
+
default: path.join(getDataDir() || ".", "osu"),
|
|
34
|
+
alias: "d",
|
|
35
|
+
describe: "Osu!lazer data directory",
|
|
36
|
+
},
|
|
37
|
+
configDir: {
|
|
38
|
+
type: "string",
|
|
39
|
+
default: path.join(getConfigDir() || ".", "osu-play"),
|
|
40
|
+
alias: "c",
|
|
41
|
+
describe: "Config directory",
|
|
42
|
+
},
|
|
43
|
+
loop: {
|
|
44
|
+
type: "boolean",
|
|
45
|
+
default: false,
|
|
46
|
+
alias: "l",
|
|
47
|
+
describe: "Loop the playlist on end",
|
|
48
|
+
},
|
|
49
|
+
help: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
alias: "h",
|
|
52
|
+
describe: "Show help",
|
|
53
|
+
}
|
|
54
|
+
}).argv;
|
|
52
55
|
return argv;
|
|
53
56
|
}
|
|
54
57
|
|
|
@@ -65,7 +68,7 @@ export async function main() {
|
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
if (argv.osuDataDir !== getDataDir()) {
|
|
68
|
-
console.log(`[INFO] Using osu!lazer data directory: ${argv.osuDataDir}`);
|
|
71
|
+
console.log(`[INFO] Using osu!lazer data directory: ${ argv.osuDataDir }`);
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
const realmDBPath = getRealmDBPath(argv.configDir, { reload, osuDataDir });
|
|
@@ -76,14 +79,12 @@ export async function main() {
|
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
const currentSchema = Realm.schemaVersion(realmDBPath);
|
|
79
|
-
console.log(`currentSchema: ${currentSchema}`);
|
|
82
|
+
console.log(`currentSchema: ${ currentSchema }`);
|
|
80
83
|
|
|
81
84
|
Realm.flags.ALLOW_CLEAR_TEST_STATE = true;
|
|
82
85
|
|
|
83
86
|
const realm: Realm = await getLazerDB(realmDBPath);
|
|
84
87
|
|
|
85
|
-
console.log(`realm.isClosed: ${realm.isClosed}`);
|
|
86
|
-
|
|
87
88
|
const beatmapSets = realm.objects(BeatmapSet);
|
|
88
89
|
|
|
89
90
|
const songSet = new Set<string>();
|
|
@@ -101,22 +102,21 @@ export async function main() {
|
|
|
101
102
|
songSet.add(hash);
|
|
102
103
|
const meta = beatmap.Metadata;
|
|
103
104
|
const path = hashedFilePath(hash);
|
|
104
|
-
const title = `${meta.Title} : ${meta.Artist} - ${meta.TitleUnicode} : ${meta.ArtistUnicode}`;
|
|
105
|
+
const title = `${ meta.Title } : ${ meta.Artist } - ${ meta.TitleUnicode } : ${ meta.ArtistUnicode }`;
|
|
105
106
|
uniqueBeatmaps.push({ title, path });
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
console.log(`beatmap songs: ${beatmapSets.length}`);
|
|
110
|
+
console.log(`beatmap songs: ${ beatmapSets.length }`);
|
|
110
111
|
|
|
111
112
|
if (argv.exportPlaylist) {
|
|
112
|
-
console.log(`[INFO] Exporting playlist to ${argv.exportPlaylist}`);
|
|
113
|
+
console.log(`[INFO] Exporting playlist to ${ argv.exportPlaylist }`);
|
|
113
114
|
const playlist = uniqueBeatmaps.map((mp) => mp.path).join("\n");
|
|
114
115
|
writeFileSync(argv.exportPlaylist, playlist);
|
|
115
|
-
console.log(`[INFO] Done. Use something like \`mpv --playlist=${argv.exportPlaylist}\` to play the playlist`);
|
|
116
|
+
console.log(`[INFO] Done. Use something like \`mpv --playlist=${ argv.exportPlaylist }\` to play the playlist`);
|
|
116
117
|
return;
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
// Get the map index from the user
|
|
120
120
|
let selectedBeatmap: number = (
|
|
121
121
|
await prompts({
|
|
122
122
|
type: "autocomplete",
|
|
@@ -128,22 +128,18 @@ export async function main() {
|
|
|
128
128
|
})),
|
|
129
129
|
})
|
|
130
130
|
).beatmap;
|
|
131
|
+
console.log(`Selected: ${ selectedBeatmap }`);
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
let i = selectedBeatmap
|
|
134
|
+
|
|
135
|
+
for (; i < uniqueBeatmaps.length; ++i) {
|
|
133
136
|
const beatmap = uniqueBeatmaps[i];
|
|
134
|
-
console.log(`Map : ${beatmap.title}`);
|
|
137
|
+
console.log(`Map : ${ beatmap.title }`);
|
|
135
138
|
if (beatmap.path && existsSync(beatmap.path)) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
console.log(`Playing ${beatmap.title}`);
|
|
139
|
-
try {
|
|
140
|
-
execFileSync("exo-open", [beatmap.path]);
|
|
141
|
-
} catch (err) {
|
|
142
|
-
console.log(`Error: ${err}`);
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
139
|
+
console.log(`Playing ${ beatmap.title }`);
|
|
140
|
+
await execFilePromise('exo-open', [beatmap.path]);
|
|
145
141
|
} else {
|
|
146
|
-
console.log(`File does not exist: ${beatmap.path}`);
|
|
142
|
+
console.log(`File does not exist: ${ beatmap.path }`);
|
|
147
143
|
}
|
|
148
144
|
if (i < uniqueBeatmaps.length - 1) {
|
|
149
145
|
// Wait 1 second between
|
|
@@ -151,13 +147,10 @@ export async function main() {
|
|
|
151
147
|
} else if (argv.loop) {
|
|
152
148
|
console.log('[INFO] Looping playlist');
|
|
153
149
|
i = 0;
|
|
154
|
-
} else {
|
|
150
|
+
} else {
|
|
155
151
|
console.log('[INFO] Done. Use --loop to loop the playlist');
|
|
156
152
|
}
|
|
157
153
|
}
|
|
158
154
|
|
|
159
155
|
realm.close();
|
|
160
|
-
console.log(`realm.isClosed: ${realm.isClosed}`);
|
|
161
|
-
|
|
162
|
-
// Realm.clearTestState();
|
|
163
156
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import Realm, { ObjectSchema } from 'realm';
|
|
2
|
-
|
|
3
|
-
declare function getDataDir(): string | undefined;
|
|
4
|
-
declare function getConfigDir(): string | undefined;
|
|
5
|
-
/**
|
|
6
|
-
* Get Realm for the app, import to the config if it doesn't exist
|
|
7
|
-
*/
|
|
8
|
-
declare function getRealmDBPath(appConfigDir: string, options?: {
|
|
9
|
-
osuDataDir: string;
|
|
10
|
-
reload: boolean;
|
|
11
|
-
}): string | null;
|
|
12
|
-
|
|
13
|
-
declare const mod$1_getConfigDir: typeof getConfigDir;
|
|
14
|
-
declare const mod$1_getDataDir: typeof getDataDir;
|
|
15
|
-
declare const mod$1_getRealmDBPath: typeof getRealmDBPath;
|
|
16
|
-
declare namespace mod$1 {
|
|
17
|
-
export {
|
|
18
|
-
mod$1_getConfigDir as getConfigDir,
|
|
19
|
-
mod$1_getDataDir as getDataDir,
|
|
20
|
-
mod$1_getRealmDBPath as getRealmDBPath,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
declare class RealmUser extends Realm.Object<RealmUser> {
|
|
25
|
-
OnlineID: number;
|
|
26
|
-
Username?: string;
|
|
27
|
-
CountryCode?: string;
|
|
28
|
-
static embedded: boolean;
|
|
29
|
-
static schema: ObjectSchema;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare class BeatmapMetadata extends Realm.Object<BeatmapMetadata> {
|
|
33
|
-
Title?: string;
|
|
34
|
-
TitleUnicode?: string;
|
|
35
|
-
Artist?: string;
|
|
36
|
-
ArtistUnicode?: string;
|
|
37
|
-
Author?: RealmUser;
|
|
38
|
-
Source?: string;
|
|
39
|
-
Tags?: string;
|
|
40
|
-
PreviewTime?: number;
|
|
41
|
-
AudioFile?: string;
|
|
42
|
-
BackgroundFile?: string;
|
|
43
|
-
static schema: ObjectSchema;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
declare class Beatmap extends Realm.Object<Beatmap> {
|
|
47
|
-
ID: string;
|
|
48
|
-
DifficultyName?: string;
|
|
49
|
-
Ruleset: any;
|
|
50
|
-
Difficulty: any;
|
|
51
|
-
Metadata: BeatmapMetadata;
|
|
52
|
-
UserSettings: any;
|
|
53
|
-
BeatmapSet: any;
|
|
54
|
-
Status: number;
|
|
55
|
-
OnlineID: number;
|
|
56
|
-
Length: number;
|
|
57
|
-
BPM: number;
|
|
58
|
-
Hash?: string;
|
|
59
|
-
StarRating: number;
|
|
60
|
-
MD5Hash?: string;
|
|
61
|
-
OnlineMD5Hash?: string;
|
|
62
|
-
LastLocalUpdate?: Date;
|
|
63
|
-
LastOnlineUpdate?: Date;
|
|
64
|
-
Hidden: boolean;
|
|
65
|
-
AudioLeadIn: number;
|
|
66
|
-
StackLeniency: number;
|
|
67
|
-
SpecialStyle: boolean;
|
|
68
|
-
LetterboxInBreaks: boolean;
|
|
69
|
-
WidescreenStoryboard: boolean;
|
|
70
|
-
EpilepsyWarning: boolean;
|
|
71
|
-
SamplesMatchPlaybackRate: boolean;
|
|
72
|
-
LastPlayed?: Date;
|
|
73
|
-
DistanceSpacing: number;
|
|
74
|
-
BeatDivisor: number;
|
|
75
|
-
GridSize: number;
|
|
76
|
-
TimelineZoom: number;
|
|
77
|
-
EditorTimestamp?: number;
|
|
78
|
-
CountdownOffset: number;
|
|
79
|
-
static schema: ObjectSchema;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
declare class RealmFile extends Realm.Object<RealmFile> {
|
|
83
|
-
Hash?: string;
|
|
84
|
-
static schema: ObjectSchema;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
declare class RealmNamedFileUsage extends Realm.Object<RealmNamedFileUsage> {
|
|
88
|
-
File: RealmFile;
|
|
89
|
-
Filename?: string;
|
|
90
|
-
static embedded: boolean;
|
|
91
|
-
static schema: ObjectSchema;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
declare class BeatmapSet extends Realm.Object<BeatmapSet> {
|
|
95
|
-
ID: string;
|
|
96
|
-
OnlineID: number;
|
|
97
|
-
DateAdded: Date;
|
|
98
|
-
DateSubmitted?: Date;
|
|
99
|
-
DateRanked?: Date;
|
|
100
|
-
Beatmaps: Array<Beatmap>;
|
|
101
|
-
Files: Array<RealmNamedFileUsage>;
|
|
102
|
-
Status: number;
|
|
103
|
-
DeletePending: boolean;
|
|
104
|
-
Hash?: string;
|
|
105
|
-
Protected: boolean;
|
|
106
|
-
static schema: ObjectSchema;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
declare const getLazerDB: (realmDBPath: string) => Promise<Realm>;
|
|
110
|
-
declare const hashedFilePath: (hash: string) => string | null;
|
|
111
|
-
declare const getNamedFileHash: (fileName: string, beatmapSet: BeatmapSet) => string | undefined;
|
|
112
|
-
|
|
113
|
-
declare const mod_getLazerDB: typeof getLazerDB;
|
|
114
|
-
declare const mod_getNamedFileHash: typeof getNamedFileHash;
|
|
115
|
-
declare const mod_hashedFilePath: typeof hashedFilePath;
|
|
116
|
-
declare namespace mod {
|
|
117
|
-
export {
|
|
118
|
-
mod_getLazerDB as getLazerDB,
|
|
119
|
-
mod_getNamedFileHash as getNamedFileHash,
|
|
120
|
-
mod_hashedFilePath as hashedFilePath,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export { mod as lazer, mod$1 as utils };
|
package/dist/index.js
DELETED
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
// src/utils/mod.ts
|
|
8
|
-
var mod_exports = {};
|
|
9
|
-
__export(mod_exports, {
|
|
10
|
-
getConfigDir: () => getConfigDir,
|
|
11
|
-
getDataDir: () => getDataDir,
|
|
12
|
-
getRealmDBPath: () => getRealmDBPath
|
|
13
|
-
});
|
|
14
|
-
import path from "path";
|
|
15
|
-
import { copyFileSync, existsSync, mkdirSync } from "fs";
|
|
16
|
-
function getDataDir() {
|
|
17
|
-
switch (process.platform) {
|
|
18
|
-
case "linux":
|
|
19
|
-
case "openbsd":
|
|
20
|
-
case "freebsd": {
|
|
21
|
-
const xdg = process.env["XDG_DATA_HOME"];
|
|
22
|
-
if (xdg)
|
|
23
|
-
return xdg;
|
|
24
|
-
const home = process.env["HOME"];
|
|
25
|
-
if (home)
|
|
26
|
-
return path.join(home, ".local", "share");
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
case "darwin": {
|
|
30
|
-
const home = process.env["HOME"];
|
|
31
|
-
if (home)
|
|
32
|
-
return path.join(home, "Library", "Application Support");
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
case "win32":
|
|
36
|
-
return process.env["LOCALAPPDATA"] ?? void 0;
|
|
37
|
-
}
|
|
38
|
-
return void 0;
|
|
39
|
-
}
|
|
40
|
-
function getConfigDir() {
|
|
41
|
-
switch (process.platform) {
|
|
42
|
-
case "openbsd":
|
|
43
|
-
case "freebsd":
|
|
44
|
-
case "linux": {
|
|
45
|
-
const xdg = process.env["XDG_CONFIG_HOME"];
|
|
46
|
-
if (xdg)
|
|
47
|
-
return xdg;
|
|
48
|
-
const home = process.env["HOME"];
|
|
49
|
-
if (home)
|
|
50
|
-
return path.join(home, ".config");
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
case "darwin": {
|
|
54
|
-
const home = process.env["HOME"];
|
|
55
|
-
if (home)
|
|
56
|
-
return path.join(home, "Library", "Preferences");
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
case "win32":
|
|
60
|
-
return process.env["APPDATA"] ?? void 0;
|
|
61
|
-
}
|
|
62
|
-
return void 0;
|
|
63
|
-
}
|
|
64
|
-
function getRealmDBPath(appConfigDir, options = { reload: false, osuDataDir: getDataDir() || "." }) {
|
|
65
|
-
const localDBPath = path.join(appConfigDir, "client.realm");
|
|
66
|
-
if (!options.reload && existsSync(localDBPath))
|
|
67
|
-
return localDBPath;
|
|
68
|
-
const osuDBPath = path.join(options.osuDataDir, "client.realm");
|
|
69
|
-
if (existsSync(osuDBPath)) {
|
|
70
|
-
console.log(`[getRealmDBPath]: ${osuDBPath} is being imported from osu!lazer to ${localDBPath}`);
|
|
71
|
-
mkdirSync(appConfigDir, { recursive: true });
|
|
72
|
-
copyFileSync(osuDBPath, localDBPath);
|
|
73
|
-
return localDBPath;
|
|
74
|
-
} else {
|
|
75
|
-
console.log(`[getRealmDBPath]: ${osuDBPath} not found`);
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// src/realm/mod.ts
|
|
81
|
-
var mod_exports2 = {};
|
|
82
|
-
__export(mod_exports2, {
|
|
83
|
-
getLazerDB: () => getLazerDB,
|
|
84
|
-
getNamedFileHash: () => getNamedFileHash,
|
|
85
|
-
hashedFilePath: () => hashedFilePath
|
|
86
|
-
});
|
|
87
|
-
import Realm7 from "realm";
|
|
88
|
-
import path2 from "path";
|
|
89
|
-
|
|
90
|
-
// src/realm/schema/beatmap.ts
|
|
91
|
-
import Realm from "realm";
|
|
92
|
-
var Beatmap = class extends Realm.Object {
|
|
93
|
-
ID;
|
|
94
|
-
DifficultyName;
|
|
95
|
-
Ruleset;
|
|
96
|
-
Difficulty;
|
|
97
|
-
Metadata;
|
|
98
|
-
UserSettings;
|
|
99
|
-
BeatmapSet;
|
|
100
|
-
Status;
|
|
101
|
-
OnlineID;
|
|
102
|
-
Length;
|
|
103
|
-
BPM;
|
|
104
|
-
Hash;
|
|
105
|
-
StarRating;
|
|
106
|
-
MD5Hash;
|
|
107
|
-
OnlineMD5Hash;
|
|
108
|
-
LastLocalUpdate;
|
|
109
|
-
LastOnlineUpdate;
|
|
110
|
-
Hidden;
|
|
111
|
-
AudioLeadIn;
|
|
112
|
-
StackLeniency;
|
|
113
|
-
SpecialStyle;
|
|
114
|
-
LetterboxInBreaks;
|
|
115
|
-
WidescreenStoryboard;
|
|
116
|
-
EpilepsyWarning;
|
|
117
|
-
SamplesMatchPlaybackRate;
|
|
118
|
-
LastPlayed;
|
|
119
|
-
DistanceSpacing;
|
|
120
|
-
BeatDivisor;
|
|
121
|
-
GridSize;
|
|
122
|
-
TimelineZoom;
|
|
123
|
-
EditorTimestamp;
|
|
124
|
-
CountdownOffset;
|
|
125
|
-
static schema = {
|
|
126
|
-
name: "Beatmap",
|
|
127
|
-
primaryKey: "ID",
|
|
128
|
-
properties: {
|
|
129
|
-
ID: { type: "uuid", default: "" },
|
|
130
|
-
DifficultyName: { type: "string", default: "", optional: true },
|
|
131
|
-
// Ruleset: { type: "object", objectType: "Ruleset", default: null },
|
|
132
|
-
// Difficulty: { type: "object", objectType: "BeatmapDifficulty", default: null },
|
|
133
|
-
Metadata: {
|
|
134
|
-
type: "object",
|
|
135
|
-
objectType: "BeatmapMetadata",
|
|
136
|
-
default: null
|
|
137
|
-
},
|
|
138
|
-
// UserSettings: { type: "object", objectType: "BeatmapUserSettings", default: null },
|
|
139
|
-
BeatmapSet: { type: "object", objectType: "BeatmapSet", default: null },
|
|
140
|
-
Status: { type: "int", default: -3 },
|
|
141
|
-
OnlineID: { type: "int", default: -1 },
|
|
142
|
-
Length: { type: "double", default: 0 },
|
|
143
|
-
BPM: { type: "double", default: 0 },
|
|
144
|
-
Hash: { type: "string", default: "", optional: true },
|
|
145
|
-
StarRating: { type: "double", default: -1 },
|
|
146
|
-
MD5Hash: { type: "string", default: "", optional: true },
|
|
147
|
-
OnlineMD5Hash: {
|
|
148
|
-
type: "string",
|
|
149
|
-
default: "",
|
|
150
|
-
optional: true
|
|
151
|
-
},
|
|
152
|
-
LastLocalUpdate: { type: "date", optional: true },
|
|
153
|
-
LastOnlineUpdate: { type: "date", optional: true },
|
|
154
|
-
Hidden: { type: "bool", default: false },
|
|
155
|
-
AudioLeadIn: { type: "double", default: 0 },
|
|
156
|
-
StackLeniency: { type: "float", default: 0.7 },
|
|
157
|
-
SpecialStyle: { type: "bool", default: false },
|
|
158
|
-
LetterboxInBreaks: { type: "bool", default: false },
|
|
159
|
-
WidescreenStoryboard: { type: "bool", default: false },
|
|
160
|
-
EpilepsyWarning: { type: "bool", default: false },
|
|
161
|
-
SamplesMatchPlaybackRate: { type: "bool", default: false },
|
|
162
|
-
LastPlayed: { type: "date", optional: true },
|
|
163
|
-
DistanceSpacing: { type: "double", default: 0 },
|
|
164
|
-
BeatDivisor: { type: "int", default: 0 },
|
|
165
|
-
GridSize: { type: "int", default: 0 },
|
|
166
|
-
TimelineZoom: { type: "double", default: 0 },
|
|
167
|
-
EditorTimestamp: { type: "double", optional: true },
|
|
168
|
-
CountdownOffset: { type: "int", default: 0 }
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
// src/realm/schema/beatmapMetadata.ts
|
|
174
|
-
import Realm2 from "realm";
|
|
175
|
-
var BeatmapMetadata = class extends Realm2.Object {
|
|
176
|
-
Title;
|
|
177
|
-
TitleUnicode;
|
|
178
|
-
Artist;
|
|
179
|
-
ArtistUnicode;
|
|
180
|
-
Author;
|
|
181
|
-
Source;
|
|
182
|
-
Tags;
|
|
183
|
-
PreviewTime;
|
|
184
|
-
AudioFile;
|
|
185
|
-
BackgroundFile;
|
|
186
|
-
static schema = {
|
|
187
|
-
name: "BeatmapMetadata",
|
|
188
|
-
properties: {
|
|
189
|
-
Title: { type: "string", default: "", optional: true },
|
|
190
|
-
TitleUnicode: { type: "string", default: "", optional: true },
|
|
191
|
-
Artist: { type: "string", default: "", optional: true },
|
|
192
|
-
ArtistUnicode: { type: "string", default: "", optional: true },
|
|
193
|
-
Author: { type: "object", objectType: "RealmUser", default: null },
|
|
194
|
-
Source: { type: "string", default: "", optional: true },
|
|
195
|
-
Tags: { type: "string", default: "", optional: true },
|
|
196
|
-
PreviewTime: { type: "int", default: 0 },
|
|
197
|
-
AudioFile: { type: "string", default: "", optional: true },
|
|
198
|
-
BackgroundFile: { type: "string", default: "", optional: true }
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
// src/realm/schema/beatmapSet.ts
|
|
204
|
-
import Realm3 from "realm";
|
|
205
|
-
var BeatmapSet = class extends Realm3.Object {
|
|
206
|
-
ID;
|
|
207
|
-
OnlineID;
|
|
208
|
-
DateAdded;
|
|
209
|
-
DateSubmitted;
|
|
210
|
-
DateRanked;
|
|
211
|
-
Beatmaps;
|
|
212
|
-
Files;
|
|
213
|
-
Status;
|
|
214
|
-
DeletePending;
|
|
215
|
-
Hash;
|
|
216
|
-
Protected;
|
|
217
|
-
static schema = {
|
|
218
|
-
name: "BeatmapSet",
|
|
219
|
-
primaryKey: "ID",
|
|
220
|
-
properties: {
|
|
221
|
-
ID: { type: "uuid", default: "" },
|
|
222
|
-
OnlineID: { type: "int", default: -1 },
|
|
223
|
-
DateAdded: { type: "date" },
|
|
224
|
-
DateSubmitted: { type: "date", optional: true },
|
|
225
|
-
DateRanked: { type: "date", optional: true },
|
|
226
|
-
Beatmaps: { type: "list", objectType: "Beatmap", default: [] },
|
|
227
|
-
Files: { type: "list", objectType: "RealmNamedFileUsage", default: [] },
|
|
228
|
-
Status: { type: "int", default: -3 },
|
|
229
|
-
DeletePending: { type: "bool", default: false },
|
|
230
|
-
Hash: { type: "string", default: "", optional: true },
|
|
231
|
-
Protected: { type: "bool", default: false }
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
// src/realm/schema/realmFile.ts
|
|
237
|
-
import Realm4 from "realm";
|
|
238
|
-
var RealmFile = class extends Realm4.Object {
|
|
239
|
-
Hash;
|
|
240
|
-
static schema = {
|
|
241
|
-
name: "File",
|
|
242
|
-
primaryKey: "Hash",
|
|
243
|
-
properties: {
|
|
244
|
-
Hash: { type: "string", default: "", optional: true }
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
// src/realm/schema/realmUser.ts
|
|
250
|
-
import Realm5 from "realm";
|
|
251
|
-
var RealmUser = class extends Realm5.Object {
|
|
252
|
-
OnlineID;
|
|
253
|
-
Username;
|
|
254
|
-
CountryCode;
|
|
255
|
-
static embedded = true;
|
|
256
|
-
static schema = {
|
|
257
|
-
name: "RealmUser",
|
|
258
|
-
embedded: true,
|
|
259
|
-
properties: {
|
|
260
|
-
OnlineID: { type: "int", default: 1 },
|
|
261
|
-
Username: { type: "string", default: "", optional: true },
|
|
262
|
-
CountryCode: { type: "string", optional: true }
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
// src/realm/schema/realmNamedFileUsage.ts
|
|
268
|
-
import Realm6 from "realm";
|
|
269
|
-
var RealmNamedFileUsage = class extends Realm6.Object {
|
|
270
|
-
File;
|
|
271
|
-
Filename;
|
|
272
|
-
static embedded = true;
|
|
273
|
-
static schema = {
|
|
274
|
-
name: "RealmNamedFileUsage",
|
|
275
|
-
embedded: true,
|
|
276
|
-
properties: {
|
|
277
|
-
File: "File",
|
|
278
|
-
Filename: { type: "string", optional: true }
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
// src/realm/mod.ts
|
|
284
|
-
var getLazerDB = async (realmDBPath) => {
|
|
285
|
-
const realm = await Realm7.open({
|
|
286
|
-
schema: [
|
|
287
|
-
BeatmapSet,
|
|
288
|
-
RealmFile,
|
|
289
|
-
RealmNamedFileUsage,
|
|
290
|
-
Beatmap,
|
|
291
|
-
BeatmapMetadata,
|
|
292
|
-
RealmUser
|
|
293
|
-
],
|
|
294
|
-
path: realmDBPath,
|
|
295
|
-
schemaVersion: 41,
|
|
296
|
-
onMigration: (oldRealm, newRealm) => {
|
|
297
|
-
console.log(
|
|
298
|
-
`[onMigration]: Migrating ${oldRealm.path} - ${oldRealm.schemaVersion} -> ${newRealm.path} - ${newRealm.schemaVersion}`
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
return realm;
|
|
303
|
-
};
|
|
304
|
-
var hashedFilePath = (hash) => {
|
|
305
|
-
const dataDir = getDataDir();
|
|
306
|
-
if (!dataDir)
|
|
307
|
-
return null;
|
|
308
|
-
return path2.join(
|
|
309
|
-
dataDir,
|
|
310
|
-
"osu",
|
|
311
|
-
"files",
|
|
312
|
-
hash.slice(0, 1),
|
|
313
|
-
hash.slice(0, 2),
|
|
314
|
-
hash
|
|
315
|
-
);
|
|
316
|
-
};
|
|
317
|
-
var getNamedFileHash = (fileName, beatmapSet) => {
|
|
318
|
-
const files = beatmapSet.Files;
|
|
319
|
-
for (const file of files) {
|
|
320
|
-
if (file.Filename == fileName)
|
|
321
|
-
return file.File.Hash;
|
|
322
|
-
}
|
|
323
|
-
return void 0;
|
|
324
|
-
};
|
|
325
|
-
export {
|
|
326
|
-
mod_exports2 as lazer,
|
|
327
|
-
mod_exports as utils
|
|
328
|
-
};
|
|
329
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/mod.ts","../src/realm/mod.ts","../src/realm/schema/beatmap.ts","../src/realm/schema/beatmapMetadata.ts","../src/realm/schema/beatmapSet.ts","../src/realm/schema/realmFile.ts","../src/realm/schema/realmUser.ts","../src/realm/schema/realmNamedFileUsage.ts"],"sourcesContent":["import path from \"node:path\";\nimport { copyFileSync, existsSync, mkdirSync } from \"node:fs\";\n\nexport function getDataDir(): string | undefined {\n switch (process.platform) {\n case \"linux\":\n case \"openbsd\":\n case \"freebsd\": {\n const xdg = process.env[\"XDG_DATA_HOME\"];\n if (xdg) return xdg;\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \".local\", \"share\");\n break;\n }\n\n case \"darwin\": {\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \"Library\", \"Application Support\");\n break;\n }\n\n case \"win32\":\n return process.env[\"LOCALAPPDATA\"] ?? undefined;\n }\n\n return undefined;\n}\n\nexport function getConfigDir(): string | undefined {\n switch (process.platform) {\n case \"openbsd\":\n case \"freebsd\":\n case \"linux\": {\n const xdg = process.env[\"XDG_CONFIG_HOME\"];\n if (xdg) return xdg;\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \".config\");\n break;\n }\n\n case \"darwin\": {\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \"Library\", \"Preferences\");\n break;\n }\n\n case \"win32\":\n return process.env[\"APPDATA\"] ?? undefined;\n }\n\n return undefined;\n}\n\n/**\n * Get Realm for the app, import to the config if it doesn't exist\n */\nexport function getRealmDBPath(\n appConfigDir: string,\n options: {\n osuDataDir: string;\n reload: boolean;\n } = { reload: false, osuDataDir: getDataDir() || \".\" },\n) {\n const localDBPath = path.join(appConfigDir, \"client.realm\");\n if (!options.reload && existsSync(localDBPath)) return localDBPath;\n\n const osuDBPath = path.join(options.osuDataDir, \"client.realm\");\n if (existsSync(osuDBPath)) {\n console.log( `[getRealmDBPath]: ${osuDBPath} is being imported from osu!lazer to ${localDBPath}`);\n mkdirSync(appConfigDir, { recursive: true });\n copyFileSync(osuDBPath, localDBPath );\n return localDBPath;\n } else {\n console.log(`[getRealmDBPath]: ${osuDBPath} not found`);\n return null;\n }\n}\n","import Realm from \"realm\";\nimport path from \"node:path\";\nimport { getDataDir } from \"../utils/mod.js\";\nimport {\n Beatmap,\n BeatmapMetadata,\n BeatmapSet,\n RealmFile,\n RealmNamedFileUsage,\n RealmUser,\n} from \"./schema/mod.js\";\n\nexport const getLazerDB = async (realmDBPath: string) => {\n const realm = await Realm.open({\n schema: [\n BeatmapSet,\n RealmFile,\n RealmNamedFileUsage,\n Beatmap,\n BeatmapMetadata,\n RealmUser,\n ],\n path: realmDBPath,\n schemaVersion: 41,\n onMigration: (oldRealm, newRealm) => {\n console.log(\n `[onMigration]: Migrating ${oldRealm.path} - ${oldRealm.schemaVersion} -> ${newRealm.path} - ${newRealm.schemaVersion}`,\n );\n },\n });\n\n return realm;\n};\n\nexport const hashedFilePath = (hash: string) => {\n const dataDir = getDataDir();\n if (!dataDir) return null;\n return path.join(\n dataDir,\n \"osu\",\n \"files\",\n hash.slice(0, 1),\n hash.slice(0, 2),\n hash,\n );\n};\n\nexport const getNamedFileHash = (fileName: string, beatmapSet: BeatmapSet) => {\n const files = beatmapSet.Files;\n for (const file of files) {\n if (file.Filename == fileName) return file.File.Hash;\n }\n return undefined;\n};\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { BeatmapMetadata } from \"./beatmapMetadata.js\";\n\nexport class Beatmap extends Realm.Object<Beatmap> {\n ID!: string;\n DifficultyName?: string;\n Ruleset!: any;\n Difficulty!: any;\n Metadata!: BeatmapMetadata;\n UserSettings!: any;\n BeatmapSet!: any;\n Status!: number;\n OnlineID!: number;\n Length!: number;\n BPM!: number;\n Hash?: string;\n StarRating!: number;\n MD5Hash?: string;\n OnlineMD5Hash?: string;\n LastLocalUpdate?: Date;\n LastOnlineUpdate?: Date;\n Hidden!: boolean;\n AudioLeadIn!: number;\n StackLeniency!: number;\n SpecialStyle!: boolean;\n LetterboxInBreaks!: boolean;\n WidescreenStoryboard!: boolean;\n EpilepsyWarning!: boolean;\n SamplesMatchPlaybackRate!: boolean;\n LastPlayed?: Date;\n DistanceSpacing!: number;\n BeatDivisor!: number;\n GridSize!: number;\n TimelineZoom!: number;\n EditorTimestamp?: number;\n CountdownOffset!: number;\n\n static schema: ObjectSchema = {\n name: \"Beatmap\",\n primaryKey: \"ID\",\n properties: {\n ID: { type: \"uuid\", default: \"\" },\n DifficultyName: { type: \"string\", default: \"\", optional: true },\n // Ruleset: { type: \"object\", objectType: \"Ruleset\", default: null },\n // Difficulty: { type: \"object\", objectType: \"BeatmapDifficulty\", default: null },\n Metadata: {\n type: \"object\",\n objectType: \"BeatmapMetadata\",\n default: null,\n },\n // UserSettings: { type: \"object\", objectType: \"BeatmapUserSettings\", default: null },\n BeatmapSet: { type: \"object\", objectType: \"BeatmapSet\", default: null },\n Status: { type: \"int\", default: -3 },\n OnlineID: { type: \"int\", default: -1 },\n Length: { type: \"double\", default: 0 },\n BPM: { type: \"double\", default: 0 },\n Hash: { type: \"string\", default: \"\", optional: true },\n StarRating: { type: \"double\", default: -1 },\n MD5Hash: { type: \"string\", default: \"\", optional: true },\n OnlineMD5Hash: {\n type: \"string\",\n default: \"\",\n optional: true,\n },\n LastLocalUpdate: { type: \"date\", optional: true },\n LastOnlineUpdate: { type: \"date\", optional: true },\n Hidden: { type: \"bool\", default: false },\n AudioLeadIn: { type: \"double\", default: 0 },\n StackLeniency: { type: \"float\", default: 0.7 },\n SpecialStyle: { type: \"bool\", default: false },\n LetterboxInBreaks: { type: \"bool\", default: false },\n WidescreenStoryboard: { type: \"bool\", default: false },\n EpilepsyWarning: { type: \"bool\", default: false },\n SamplesMatchPlaybackRate: { type: \"bool\", default: false },\n LastPlayed: { type: \"date\", optional: true },\n DistanceSpacing: { type: \"double\", default: 0 },\n BeatDivisor: { type: \"int\", default: 0 },\n GridSize: { type: \"int\", default: 0 },\n TimelineZoom: { type: \"double\", default: 0 },\n EditorTimestamp: { type: \"double\", optional: true },\n CountdownOffset: { type: \"int\", default: 0 },\n },\n };\n}\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { RealmUser } from \"./realmUser.js\";\n\nexport class BeatmapMetadata extends Realm.Object<BeatmapMetadata> {\n Title?: string;\n TitleUnicode?: string;\n Artist?: string;\n ArtistUnicode?: string;\n Author?: RealmUser;\n Source?: string;\n Tags?: string;\n PreviewTime?: number;\n AudioFile?: string;\n BackgroundFile?: string;\n\n static schema: ObjectSchema = {\n name: \"BeatmapMetadata\",\n properties: {\n Title: { type: \"string\", default: \"\", optional: true },\n TitleUnicode: { type: \"string\", default: \"\", optional: true },\n Artist: { type: \"string\", default: \"\", optional: true },\n ArtistUnicode: { type: \"string\", default: \"\", optional: true },\n Author: { type: \"object\", objectType: \"RealmUser\", default: null },\n Source: { type: \"string\", default: \"\", optional: true },\n Tags: { type: \"string\", default: \"\", optional: true },\n PreviewTime: { type: \"int\", default: 0 },\n AudioFile: { type: \"string\", default: \"\", optional: true },\n BackgroundFile: { type: \"string\", default: \"\", optional: true },\n },\n };\n}\n\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { Beatmap } from \"./beatmap.js\";\nimport { RealmNamedFileUsage } from \"./realmNamedFileUsage.js\";\n\nexport class BeatmapSet extends Realm.Object<BeatmapSet> {\n ID!: string;\n OnlineID!: number;\n DateAdded!: Date;\n DateSubmitted?: Date;\n DateRanked?: Date;\n Beatmaps!: Array<Beatmap>;\n Files!: Array<RealmNamedFileUsage>;\n Status!: number;\n DeletePending!: boolean;\n Hash?: string;\n Protected!: boolean;\n\n static schema: ObjectSchema = {\n name: \"BeatmapSet\",\n primaryKey: \"ID\",\n properties: {\n ID: { type: \"uuid\", default: \"\" },\n OnlineID: { type: \"int\", default: -1 },\n DateAdded: { type: \"date\" },\n DateSubmitted: { type: \"date\", optional: true },\n DateRanked: { type: \"date\", optional: true },\n Beatmaps: { type: \"list\", objectType: \"Beatmap\", default: [] },\n Files: { type: \"list\", objectType: \"RealmNamedFileUsage\", default: [] },\n Status: { type: \"int\", default: -3 },\n DeletePending: { type: \"bool\", default: false },\n Hash: { type: \"string\", default: \"\", optional: true },\n Protected: { type: \"bool\", default: false },\n },\n };\n}\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\n\nexport class RealmFile extends Realm.Object<RealmFile> {\n Hash?: string;\n\n static schema: ObjectSchema = {\n name: \"File\",\n primaryKey: \"Hash\",\n properties: {\n Hash: { type: \"string\", default: \"\", optional: true },\n },\n };\n}\n\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\n\nexport class RealmUser extends Realm.Object<RealmUser> {\n OnlineID!: number;\n Username?: string;\n CountryCode?: string;\n\n static embedded = true;\n\n static schema: ObjectSchema = {\n name: \"RealmUser\",\n embedded: true,\n properties: {\n OnlineID: { type: \"int\", default: 1 },\n Username: { type: \"string\", default: \"\", optional: true },\n CountryCode: { type: \"string\", optional: true },\n },\n };\n}\n\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { RealmFile } from \"./realmFile.js\";\n\nexport class RealmNamedFileUsage extends Realm.Object<RealmNamedFileUsage> {\n File!: RealmFile;\n Filename?: string;\n\n static embedded = true;\n\n static schema: ObjectSchema = {\n name: \"RealmNamedFileUsage\",\n embedded: true,\n properties: {\n File: \"File\",\n Filename: { type: \"string\", optional: true },\n },\n };\n}\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAO,UAAU;AACjB,SAAS,cAAc,YAAY,iBAAiB;AAE7C,SAAS,aAAiC;AAC/C,UAAQ,QAAQ,UAAU;AAAA,IACxB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK,WAAW;AACd,YAAM,MAAM,QAAQ,IAAI,eAAe;AACvC,UAAI;AAAK,eAAO;AAChB,YAAM,OAAO,QAAQ,IAAI,MAAM;AAC/B,UAAI;AAAM,eAAO,KAAK,KAAK,MAAM,UAAU,OAAO;AAClD;AAAA,IACF;AAAA,IAEA,KAAK,UAAU;AACb,YAAM,OAAO,QAAQ,IAAI,MAAM;AAC/B,UAAI;AAAM,eAAO,KAAK,KAAK,MAAM,WAAW,qBAAqB;AACjE;AAAA,IACF;AAAA,IAEA,KAAK;AACH,aAAO,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AAI,MAAM,SAAS,aAAa;AAAA,MACvH;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAEO,IAAM,iBAAiB,CAAC,SAAiB;AAC9C,QAAM,UAAU,WAAW;AAC3B,MAAI,CAAC;AAAS,WAAO;AACrB,SAAOC,MAAK;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK,MAAM,GAAG,CAAC;AAAA,IACf,KAAK,MAAM,GAAG,CAAC;AAAA,IACf;AAAA,EACF;AACF;AAEO,IAAM,mBAAmB,CAAC,UAAkB,eAA2B;AAC5E,QAAM,QAAQ,WAAW;AACzB,aAAW,QAAQ,OAAO;AACxB,QAAI,KAAK,YAAY;AAAU,aAAO,KAAK,KAAK;AAAA,EAClD;AACA,SAAO;AACT;","names":["mod_exports","Realm","path","Realm","Realm","Realm","Realm","Realm","Realm","path"]}
|
package/dist/src/cli/main.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
declare function getArgs(): {
|
|
2
|
-
[x: string]: unknown;
|
|
3
|
-
reload: boolean;
|
|
4
|
-
exportPlaylist: string | undefined;
|
|
5
|
-
osuDataDir: string;
|
|
6
|
-
configDir: string;
|
|
7
|
-
loop: boolean;
|
|
8
|
-
help: boolean | undefined;
|
|
9
|
-
_: (string | number)[];
|
|
10
|
-
$0: string;
|
|
11
|
-
} | Promise<{
|
|
12
|
-
[x: string]: unknown;
|
|
13
|
-
reload: boolean;
|
|
14
|
-
exportPlaylist: string | undefined;
|
|
15
|
-
osuDataDir: string;
|
|
16
|
-
configDir: string;
|
|
17
|
-
loop: boolean;
|
|
18
|
-
help: boolean | undefined;
|
|
19
|
-
_: (string | number)[];
|
|
20
|
-
$0: string;
|
|
21
|
-
}>;
|
|
22
|
-
declare function main(): Promise<void>;
|
|
23
|
-
|
|
24
|
-
export { getArgs, main };
|
package/dist/src/cli/main.js
DELETED
|
@@ -1,442 +0,0 @@
|
|
|
1
|
-
// src/cli/main.ts
|
|
2
|
-
import path3 from "path";
|
|
3
|
-
import { existsSync as existsSync2, writeFileSync } from "fs";
|
|
4
|
-
import { execFileSync } from "child_process";
|
|
5
|
-
import Realm8 from "realm";
|
|
6
|
-
import prompts from "prompts";
|
|
7
|
-
|
|
8
|
-
// src/realm/schema/beatmap.ts
|
|
9
|
-
import Realm from "realm";
|
|
10
|
-
var Beatmap = class extends Realm.Object {
|
|
11
|
-
ID;
|
|
12
|
-
DifficultyName;
|
|
13
|
-
Ruleset;
|
|
14
|
-
Difficulty;
|
|
15
|
-
Metadata;
|
|
16
|
-
UserSettings;
|
|
17
|
-
BeatmapSet;
|
|
18
|
-
Status;
|
|
19
|
-
OnlineID;
|
|
20
|
-
Length;
|
|
21
|
-
BPM;
|
|
22
|
-
Hash;
|
|
23
|
-
StarRating;
|
|
24
|
-
MD5Hash;
|
|
25
|
-
OnlineMD5Hash;
|
|
26
|
-
LastLocalUpdate;
|
|
27
|
-
LastOnlineUpdate;
|
|
28
|
-
Hidden;
|
|
29
|
-
AudioLeadIn;
|
|
30
|
-
StackLeniency;
|
|
31
|
-
SpecialStyle;
|
|
32
|
-
LetterboxInBreaks;
|
|
33
|
-
WidescreenStoryboard;
|
|
34
|
-
EpilepsyWarning;
|
|
35
|
-
SamplesMatchPlaybackRate;
|
|
36
|
-
LastPlayed;
|
|
37
|
-
DistanceSpacing;
|
|
38
|
-
BeatDivisor;
|
|
39
|
-
GridSize;
|
|
40
|
-
TimelineZoom;
|
|
41
|
-
EditorTimestamp;
|
|
42
|
-
CountdownOffset;
|
|
43
|
-
static schema = {
|
|
44
|
-
name: "Beatmap",
|
|
45
|
-
primaryKey: "ID",
|
|
46
|
-
properties: {
|
|
47
|
-
ID: { type: "uuid", default: "" },
|
|
48
|
-
DifficultyName: { type: "string", default: "", optional: true },
|
|
49
|
-
// Ruleset: { type: "object", objectType: "Ruleset", default: null },
|
|
50
|
-
// Difficulty: { type: "object", objectType: "BeatmapDifficulty", default: null },
|
|
51
|
-
Metadata: {
|
|
52
|
-
type: "object",
|
|
53
|
-
objectType: "BeatmapMetadata",
|
|
54
|
-
default: null
|
|
55
|
-
},
|
|
56
|
-
// UserSettings: { type: "object", objectType: "BeatmapUserSettings", default: null },
|
|
57
|
-
BeatmapSet: { type: "object", objectType: "BeatmapSet", default: null },
|
|
58
|
-
Status: { type: "int", default: -3 },
|
|
59
|
-
OnlineID: { type: "int", default: -1 },
|
|
60
|
-
Length: { type: "double", default: 0 },
|
|
61
|
-
BPM: { type: "double", default: 0 },
|
|
62
|
-
Hash: { type: "string", default: "", optional: true },
|
|
63
|
-
StarRating: { type: "double", default: -1 },
|
|
64
|
-
MD5Hash: { type: "string", default: "", optional: true },
|
|
65
|
-
OnlineMD5Hash: {
|
|
66
|
-
type: "string",
|
|
67
|
-
default: "",
|
|
68
|
-
optional: true
|
|
69
|
-
},
|
|
70
|
-
LastLocalUpdate: { type: "date", optional: true },
|
|
71
|
-
LastOnlineUpdate: { type: "date", optional: true },
|
|
72
|
-
Hidden: { type: "bool", default: false },
|
|
73
|
-
AudioLeadIn: { type: "double", default: 0 },
|
|
74
|
-
StackLeniency: { type: "float", default: 0.7 },
|
|
75
|
-
SpecialStyle: { type: "bool", default: false },
|
|
76
|
-
LetterboxInBreaks: { type: "bool", default: false },
|
|
77
|
-
WidescreenStoryboard: { type: "bool", default: false },
|
|
78
|
-
EpilepsyWarning: { type: "bool", default: false },
|
|
79
|
-
SamplesMatchPlaybackRate: { type: "bool", default: false },
|
|
80
|
-
LastPlayed: { type: "date", optional: true },
|
|
81
|
-
DistanceSpacing: { type: "double", default: 0 },
|
|
82
|
-
BeatDivisor: { type: "int", default: 0 },
|
|
83
|
-
GridSize: { type: "int", default: 0 },
|
|
84
|
-
TimelineZoom: { type: "double", default: 0 },
|
|
85
|
-
EditorTimestamp: { type: "double", optional: true },
|
|
86
|
-
CountdownOffset: { type: "int", default: 0 }
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// src/realm/schema/beatmapMetadata.ts
|
|
92
|
-
import Realm2 from "realm";
|
|
93
|
-
var BeatmapMetadata = class extends Realm2.Object {
|
|
94
|
-
Title;
|
|
95
|
-
TitleUnicode;
|
|
96
|
-
Artist;
|
|
97
|
-
ArtistUnicode;
|
|
98
|
-
Author;
|
|
99
|
-
Source;
|
|
100
|
-
Tags;
|
|
101
|
-
PreviewTime;
|
|
102
|
-
AudioFile;
|
|
103
|
-
BackgroundFile;
|
|
104
|
-
static schema = {
|
|
105
|
-
name: "BeatmapMetadata",
|
|
106
|
-
properties: {
|
|
107
|
-
Title: { type: "string", default: "", optional: true },
|
|
108
|
-
TitleUnicode: { type: "string", default: "", optional: true },
|
|
109
|
-
Artist: { type: "string", default: "", optional: true },
|
|
110
|
-
ArtistUnicode: { type: "string", default: "", optional: true },
|
|
111
|
-
Author: { type: "object", objectType: "RealmUser", default: null },
|
|
112
|
-
Source: { type: "string", default: "", optional: true },
|
|
113
|
-
Tags: { type: "string", default: "", optional: true },
|
|
114
|
-
PreviewTime: { type: "int", default: 0 },
|
|
115
|
-
AudioFile: { type: "string", default: "", optional: true },
|
|
116
|
-
BackgroundFile: { type: "string", default: "", optional: true }
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
// src/realm/schema/beatmapSet.ts
|
|
122
|
-
import Realm3 from "realm";
|
|
123
|
-
var BeatmapSet = class extends Realm3.Object {
|
|
124
|
-
ID;
|
|
125
|
-
OnlineID;
|
|
126
|
-
DateAdded;
|
|
127
|
-
DateSubmitted;
|
|
128
|
-
DateRanked;
|
|
129
|
-
Beatmaps;
|
|
130
|
-
Files;
|
|
131
|
-
Status;
|
|
132
|
-
DeletePending;
|
|
133
|
-
Hash;
|
|
134
|
-
Protected;
|
|
135
|
-
static schema = {
|
|
136
|
-
name: "BeatmapSet",
|
|
137
|
-
primaryKey: "ID",
|
|
138
|
-
properties: {
|
|
139
|
-
ID: { type: "uuid", default: "" },
|
|
140
|
-
OnlineID: { type: "int", default: -1 },
|
|
141
|
-
DateAdded: { type: "date" },
|
|
142
|
-
DateSubmitted: { type: "date", optional: true },
|
|
143
|
-
DateRanked: { type: "date", optional: true },
|
|
144
|
-
Beatmaps: { type: "list", objectType: "Beatmap", default: [] },
|
|
145
|
-
Files: { type: "list", objectType: "RealmNamedFileUsage", default: [] },
|
|
146
|
-
Status: { type: "int", default: -3 },
|
|
147
|
-
DeletePending: { type: "bool", default: false },
|
|
148
|
-
Hash: { type: "string", default: "", optional: true },
|
|
149
|
-
Protected: { type: "bool", default: false }
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
// src/realm/schema/realmFile.ts
|
|
155
|
-
import Realm4 from "realm";
|
|
156
|
-
var RealmFile = class extends Realm4.Object {
|
|
157
|
-
Hash;
|
|
158
|
-
static schema = {
|
|
159
|
-
name: "File",
|
|
160
|
-
primaryKey: "Hash",
|
|
161
|
-
properties: {
|
|
162
|
-
Hash: { type: "string", default: "", optional: true }
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
// src/realm/schema/realmUser.ts
|
|
168
|
-
import Realm5 from "realm";
|
|
169
|
-
var RealmUser = class extends Realm5.Object {
|
|
170
|
-
OnlineID;
|
|
171
|
-
Username;
|
|
172
|
-
CountryCode;
|
|
173
|
-
static embedded = true;
|
|
174
|
-
static schema = {
|
|
175
|
-
name: "RealmUser",
|
|
176
|
-
embedded: true,
|
|
177
|
-
properties: {
|
|
178
|
-
OnlineID: { type: "int", default: 1 },
|
|
179
|
-
Username: { type: "string", default: "", optional: true },
|
|
180
|
-
CountryCode: { type: "string", optional: true }
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
// src/realm/schema/realmNamedFileUsage.ts
|
|
186
|
-
import Realm6 from "realm";
|
|
187
|
-
var RealmNamedFileUsage = class extends Realm6.Object {
|
|
188
|
-
File;
|
|
189
|
-
Filename;
|
|
190
|
-
static embedded = true;
|
|
191
|
-
static schema = {
|
|
192
|
-
name: "RealmNamedFileUsage",
|
|
193
|
-
embedded: true,
|
|
194
|
-
properties: {
|
|
195
|
-
File: "File",
|
|
196
|
-
Filename: { type: "string", optional: true }
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
// src/utils/mod.ts
|
|
202
|
-
import path from "path";
|
|
203
|
-
import { copyFileSync, existsSync, mkdirSync } from "fs";
|
|
204
|
-
function getDataDir() {
|
|
205
|
-
switch (process.platform) {
|
|
206
|
-
case "linux":
|
|
207
|
-
case "openbsd":
|
|
208
|
-
case "freebsd": {
|
|
209
|
-
const xdg = process.env["XDG_DATA_HOME"];
|
|
210
|
-
if (xdg)
|
|
211
|
-
return xdg;
|
|
212
|
-
const home = process.env["HOME"];
|
|
213
|
-
if (home)
|
|
214
|
-
return path.join(home, ".local", "share");
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
case "darwin": {
|
|
218
|
-
const home = process.env["HOME"];
|
|
219
|
-
if (home)
|
|
220
|
-
return path.join(home, "Library", "Application Support");
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
case "win32":
|
|
224
|
-
return process.env["LOCALAPPDATA"] ?? void 0;
|
|
225
|
-
}
|
|
226
|
-
return void 0;
|
|
227
|
-
}
|
|
228
|
-
function getConfigDir() {
|
|
229
|
-
switch (process.platform) {
|
|
230
|
-
case "openbsd":
|
|
231
|
-
case "freebsd":
|
|
232
|
-
case "linux": {
|
|
233
|
-
const xdg = process.env["XDG_CONFIG_HOME"];
|
|
234
|
-
if (xdg)
|
|
235
|
-
return xdg;
|
|
236
|
-
const home = process.env["HOME"];
|
|
237
|
-
if (home)
|
|
238
|
-
return path.join(home, ".config");
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
case "darwin": {
|
|
242
|
-
const home = process.env["HOME"];
|
|
243
|
-
if (home)
|
|
244
|
-
return path.join(home, "Library", "Preferences");
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
case "win32":
|
|
248
|
-
return process.env["APPDATA"] ?? void 0;
|
|
249
|
-
}
|
|
250
|
-
return void 0;
|
|
251
|
-
}
|
|
252
|
-
function getRealmDBPath(appConfigDir, options = { reload: false, osuDataDir: getDataDir() || "." }) {
|
|
253
|
-
const localDBPath = path.join(appConfigDir, "client.realm");
|
|
254
|
-
if (!options.reload && existsSync(localDBPath))
|
|
255
|
-
return localDBPath;
|
|
256
|
-
const osuDBPath = path.join(options.osuDataDir, "client.realm");
|
|
257
|
-
if (existsSync(osuDBPath)) {
|
|
258
|
-
console.log(`[getRealmDBPath]: ${osuDBPath} is being imported from osu!lazer to ${localDBPath}`);
|
|
259
|
-
mkdirSync(appConfigDir, { recursive: true });
|
|
260
|
-
copyFileSync(osuDBPath, localDBPath);
|
|
261
|
-
return localDBPath;
|
|
262
|
-
} else {
|
|
263
|
-
console.log(`[getRealmDBPath]: ${osuDBPath} not found`);
|
|
264
|
-
return null;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// src/realm/mod.ts
|
|
269
|
-
import Realm7 from "realm";
|
|
270
|
-
import path2 from "path";
|
|
271
|
-
var getLazerDB = async (realmDBPath) => {
|
|
272
|
-
const realm = await Realm7.open({
|
|
273
|
-
schema: [
|
|
274
|
-
BeatmapSet,
|
|
275
|
-
RealmFile,
|
|
276
|
-
RealmNamedFileUsage,
|
|
277
|
-
Beatmap,
|
|
278
|
-
BeatmapMetadata,
|
|
279
|
-
RealmUser
|
|
280
|
-
],
|
|
281
|
-
path: realmDBPath,
|
|
282
|
-
schemaVersion: 41,
|
|
283
|
-
onMigration: (oldRealm, newRealm) => {
|
|
284
|
-
console.log(
|
|
285
|
-
`[onMigration]: Migrating ${oldRealm.path} - ${oldRealm.schemaVersion} -> ${newRealm.path} - ${newRealm.schemaVersion}`
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
return realm;
|
|
290
|
-
};
|
|
291
|
-
var hashedFilePath = (hash) => {
|
|
292
|
-
const dataDir = getDataDir();
|
|
293
|
-
if (!dataDir)
|
|
294
|
-
return null;
|
|
295
|
-
return path2.join(
|
|
296
|
-
dataDir,
|
|
297
|
-
"osu",
|
|
298
|
-
"files",
|
|
299
|
-
hash.slice(0, 1),
|
|
300
|
-
hash.slice(0, 2),
|
|
301
|
-
hash
|
|
302
|
-
);
|
|
303
|
-
};
|
|
304
|
-
var getNamedFileHash = (fileName, beatmapSet) => {
|
|
305
|
-
const files = beatmapSet.Files;
|
|
306
|
-
for (const file of files) {
|
|
307
|
-
if (file.Filename == fileName)
|
|
308
|
-
return file.File.Hash;
|
|
309
|
-
}
|
|
310
|
-
return void 0;
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
// src/cli/main.ts
|
|
314
|
-
import yargs from "yargs/yargs";
|
|
315
|
-
import { hideBin } from "yargs/helpers";
|
|
316
|
-
function getArgs() {
|
|
317
|
-
const argv = yargs(hideBin(process.argv)).usage("Play music from your osu!lazer beatmaps from the terminal\nUsage: $0 [options]").options({
|
|
318
|
-
reload: {
|
|
319
|
-
type: "boolean",
|
|
320
|
-
default: false,
|
|
321
|
-
alias: "r",
|
|
322
|
-
describe: "Reload lazer database"
|
|
323
|
-
},
|
|
324
|
-
exportPlaylist: {
|
|
325
|
-
type: "string",
|
|
326
|
-
describe: "Export playlist to a file"
|
|
327
|
-
},
|
|
328
|
-
osuDataDir: {
|
|
329
|
-
type: "string",
|
|
330
|
-
default: path3.join(getDataDir() || ".", "osu"),
|
|
331
|
-
alias: "d",
|
|
332
|
-
describe: "Osu!lazer data directory"
|
|
333
|
-
},
|
|
334
|
-
configDir: {
|
|
335
|
-
type: "string",
|
|
336
|
-
default: path3.join(getConfigDir() || ".", "osu-play"),
|
|
337
|
-
alias: "c",
|
|
338
|
-
describe: "Config directory"
|
|
339
|
-
},
|
|
340
|
-
loop: {
|
|
341
|
-
type: "boolean",
|
|
342
|
-
default: false,
|
|
343
|
-
alias: "l",
|
|
344
|
-
describe: "Loop the playlist on end"
|
|
345
|
-
},
|
|
346
|
-
help: {
|
|
347
|
-
type: "boolean",
|
|
348
|
-
alias: "h",
|
|
349
|
-
describe: "Show help"
|
|
350
|
-
}
|
|
351
|
-
}).argv;
|
|
352
|
-
return argv;
|
|
353
|
-
}
|
|
354
|
-
async function main() {
|
|
355
|
-
const argv = await getArgs();
|
|
356
|
-
console.log("[INFO] osu!play");
|
|
357
|
-
let reload = false;
|
|
358
|
-
let osuDataDir = argv.osuDataDir;
|
|
359
|
-
if (argv.reload) {
|
|
360
|
-
console.log("[INFO] Reloading lazer database");
|
|
361
|
-
reload = true;
|
|
362
|
-
}
|
|
363
|
-
if (argv.osuDataDir !== getDataDir()) {
|
|
364
|
-
console.log(`[INFO] Using osu!lazer data directory: ${argv.osuDataDir}`);
|
|
365
|
-
}
|
|
366
|
-
const realmDBPath = getRealmDBPath(argv.configDir, { reload, osuDataDir });
|
|
367
|
-
if (realmDBPath == null) {
|
|
368
|
-
console.log("[ERROR] Realm DB not found");
|
|
369
|
-
process.exit(1);
|
|
370
|
-
}
|
|
371
|
-
const currentSchema = Realm8.schemaVersion(realmDBPath);
|
|
372
|
-
console.log(`currentSchema: ${currentSchema}`);
|
|
373
|
-
Realm8.flags.ALLOW_CLEAR_TEST_STATE = true;
|
|
374
|
-
const realm = await getLazerDB(realmDBPath);
|
|
375
|
-
console.log(`realm.isClosed: ${realm.isClosed}`);
|
|
376
|
-
const beatmapSets = realm.objects(BeatmapSet);
|
|
377
|
-
const songSet = /* @__PURE__ */ new Set();
|
|
378
|
-
const uniqueBeatmaps = [];
|
|
379
|
-
for (const beatmapSet of beatmapSets) {
|
|
380
|
-
for (const beatmap of beatmapSet.Beatmaps) {
|
|
381
|
-
const fileName = beatmap.Metadata.AudioFile;
|
|
382
|
-
const hash = getNamedFileHash(fileName ?? "", beatmapSet);
|
|
383
|
-
if (!hash)
|
|
384
|
-
continue;
|
|
385
|
-
if (songSet.has(hash))
|
|
386
|
-
continue;
|
|
387
|
-
songSet.add(hash);
|
|
388
|
-
const meta = beatmap.Metadata;
|
|
389
|
-
const path4 = hashedFilePath(hash);
|
|
390
|
-
const title = `${meta.Title} : ${meta.Artist} - ${meta.TitleUnicode} : ${meta.ArtistUnicode}`;
|
|
391
|
-
uniqueBeatmaps.push({ title, path: path4 });
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
console.log(`beatmap songs: ${beatmapSets.length}`);
|
|
395
|
-
if (argv.exportPlaylist) {
|
|
396
|
-
console.log(`[INFO] Exporting playlist to ${argv.exportPlaylist}`);
|
|
397
|
-
const playlist = uniqueBeatmaps.map((mp) => mp.path).join("\n");
|
|
398
|
-
writeFileSync(argv.exportPlaylist, playlist);
|
|
399
|
-
console.log(`[INFO] Done. Use something like \`mpv --playlist=${argv.exportPlaylist}\` to play the playlist`);
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
let selectedBeatmap = (await prompts({
|
|
403
|
-
type: "autocomplete",
|
|
404
|
-
name: "beatmap",
|
|
405
|
-
message: "Which map do you want to play:",
|
|
406
|
-
choices: uniqueBeatmaps.map((mp, index) => ({
|
|
407
|
-
title: mp.title,
|
|
408
|
-
value: index
|
|
409
|
-
}))
|
|
410
|
-
})).beatmap;
|
|
411
|
-
for (let i = selectedBeatmap; i < uniqueBeatmaps.length; ++i) {
|
|
412
|
-
const beatmap = uniqueBeatmaps[i];
|
|
413
|
-
console.log(`Map : ${beatmap.title}`);
|
|
414
|
-
if (beatmap.path && existsSync2(beatmap.path)) {
|
|
415
|
-
console.log(`File exists: ${beatmap.path}`);
|
|
416
|
-
console.log(`Playing ${beatmap.title}`);
|
|
417
|
-
try {
|
|
418
|
-
execFileSync("exo-open", [beatmap.path]);
|
|
419
|
-
} catch (err) {
|
|
420
|
-
console.log(`Error: ${err}`);
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
} else {
|
|
424
|
-
console.log(`File does not exist: ${beatmap.path}`);
|
|
425
|
-
}
|
|
426
|
-
if (i < uniqueBeatmaps.length - 1) {
|
|
427
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
428
|
-
} else if (argv.loop) {
|
|
429
|
-
console.log("[INFO] Looping playlist");
|
|
430
|
-
i = 0;
|
|
431
|
-
} else {
|
|
432
|
-
console.log("[INFO] Done. Use --loop to loop the playlist");
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
realm.close();
|
|
436
|
-
console.log(`realm.isClosed: ${realm.isClosed}`);
|
|
437
|
-
}
|
|
438
|
-
export {
|
|
439
|
-
getArgs,
|
|
440
|
-
main
|
|
441
|
-
};
|
|
442
|
-
//# sourceMappingURL=main.js.map
|
package/dist/src/cli/main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/main.ts","../../../src/realm/schema/beatmap.ts","../../../src/realm/schema/beatmapMetadata.ts","../../../src/realm/schema/beatmapSet.ts","../../../src/realm/schema/realmFile.ts","../../../src/realm/schema/realmUser.ts","../../../src/realm/schema/realmNamedFileUsage.ts","../../../src/utils/mod.ts","../../../src/realm/mod.ts"],"sourcesContent":["import path from \"node:path\";\nimport { existsSync, writeFileSync } from \"node:fs\";\nimport { execFileSync } from \"node:child_process\";\n\nimport Realm from \"realm\";\nimport prompts from \"prompts\";\nimport { BeatmapSet } from \"../realm/schema/mod.js\";\nimport { getConfigDir, getDataDir, getRealmDBPath } from \"../utils/mod.js\";\nimport { getLazerDB, getNamedFileHash, hashedFilePath } from \"../realm/mod.js\";\n\nimport yargs from \"yargs/yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nexport function getArgs() {\n const argv = yargs(hideBin(process.argv))\n .usage(\"Play music from your osu!lazer beatmaps from the terminal\\nUsage: $0 [options]\")\n .options({\n reload: {\n type: \"boolean\",\n default: false,\n alias: \"r\",\n describe: \"Reload lazer database\",\n },\n exportPlaylist: {\n type: \"string\",\n describe: \"Export playlist to a file\",\n },\n osuDataDir: {\n type: \"string\",\n default: path.join(getDataDir() || \".\", \"osu\"),\n alias: \"d\",\n describe: \"Osu!lazer data directory\",\n },\n configDir: {\n type: \"string\",\n default: path.join(getConfigDir() || \".\", \"osu-play\"),\n alias: \"c\",\n describe: \"Config directory\",\n },\n loop: {\n type: \"boolean\",\n default: false,\n alias: \"l\",\n describe: \"Loop the playlist on end\",\n },\n help: {\n type: \"boolean\",\n alias: \"h\",\n describe: \"Show help\",\n }\n }).argv;\n return argv;\n}\n\nexport async function main() {\n const argv = await getArgs();\n console.log(\"[INFO] osu!play\");\n\n let reload = false;\n let osuDataDir = argv.osuDataDir;\n\n if (argv.reload) {\n console.log(\"[INFO] Reloading lazer database\");\n reload = true;\n }\n\n if (argv.osuDataDir !== getDataDir()) {\n console.log(`[INFO] Using osu!lazer data directory: ${argv.osuDataDir}`);\n }\n\n const realmDBPath = getRealmDBPath(argv.configDir, { reload, osuDataDir });\n\n if (realmDBPath == null) {\n console.log(\"[ERROR] Realm DB not found\");\n process.exit(1);\n }\n\n const currentSchema = Realm.schemaVersion(realmDBPath);\n console.log(`currentSchema: ${currentSchema}`);\n\n Realm.flags.ALLOW_CLEAR_TEST_STATE = true;\n\n const realm: Realm = await getLazerDB(realmDBPath);\n\n console.log(`realm.isClosed: ${realm.isClosed}`);\n\n const beatmapSets = realm.objects(BeatmapSet);\n\n const songSet = new Set<string>();\n const uniqueBeatmaps: {\n title: string;\n path: string | null;\n }[] = [];\n\n for (const beatmapSet of beatmapSets) {\n for (const beatmap of beatmapSet.Beatmaps) {\n const fileName = beatmap.Metadata.AudioFile;\n const hash = getNamedFileHash(fileName ?? \"\", beatmapSet);\n if (!hash) continue;\n if (songSet.has(hash)) continue;\n songSet.add(hash);\n const meta = beatmap.Metadata;\n const path = hashedFilePath(hash);\n const title = `${meta.Title} : ${meta.Artist} - ${meta.TitleUnicode} : ${meta.ArtistUnicode}`;\n uniqueBeatmaps.push({ title, path });\n }\n }\n\n console.log(`beatmap songs: ${beatmapSets.length}`);\n\n if (argv.exportPlaylist) {\n console.log(`[INFO] Exporting playlist to ${argv.exportPlaylist}`);\n const playlist = uniqueBeatmaps.map((mp) => mp.path).join(\"\\n\");\n writeFileSync(argv.exportPlaylist, playlist);\n console.log(`[INFO] Done. Use something like \\`mpv --playlist=${argv.exportPlaylist}\\` to play the playlist`);\n return;\n }\n\n // Get the map index from the user\n let selectedBeatmap: number = (\n await prompts({\n type: \"autocomplete\",\n name: \"beatmap\",\n message: \"Which map do you want to play:\",\n choices: uniqueBeatmaps.map((mp, index) => ({\n title: mp.title,\n value: index,\n })),\n })\n ).beatmap;\n\n for (let i = selectedBeatmap; i < uniqueBeatmaps.length; ++i) {\n const beatmap = uniqueBeatmaps[i];\n console.log(`Map : ${beatmap.title}`);\n if (beatmap.path && existsSync(beatmap.path)) {\n // Open file using exo-open.\n console.log(`File exists: ${beatmap.path}`);\n console.log(`Playing ${beatmap.title}`);\n try {\n execFileSync(\"exo-open\", [beatmap.path]);\n } catch (err) {\n console.log(`Error: ${err}`);\n break;\n }\n } else {\n console.log(`File does not exist: ${beatmap.path}`);\n }\n if (i < uniqueBeatmaps.length - 1) {\n // Wait 1 second between\n await new Promise((resolve) => setTimeout(resolve, 1000));\n } else if (argv.loop) {\n console.log('[INFO] Looping playlist');\n i = 0;\n } else { \n console.log('[INFO] Done. Use --loop to loop the playlist');\n }\n }\n\n realm.close();\n console.log(`realm.isClosed: ${realm.isClosed}`);\n\n // Realm.clearTestState();\n}\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { BeatmapMetadata } from \"./beatmapMetadata.js\";\n\nexport class Beatmap extends Realm.Object<Beatmap> {\n ID!: string;\n DifficultyName?: string;\n Ruleset!: any;\n Difficulty!: any;\n Metadata!: BeatmapMetadata;\n UserSettings!: any;\n BeatmapSet!: any;\n Status!: number;\n OnlineID!: number;\n Length!: number;\n BPM!: number;\n Hash?: string;\n StarRating!: number;\n MD5Hash?: string;\n OnlineMD5Hash?: string;\n LastLocalUpdate?: Date;\n LastOnlineUpdate?: Date;\n Hidden!: boolean;\n AudioLeadIn!: number;\n StackLeniency!: number;\n SpecialStyle!: boolean;\n LetterboxInBreaks!: boolean;\n WidescreenStoryboard!: boolean;\n EpilepsyWarning!: boolean;\n SamplesMatchPlaybackRate!: boolean;\n LastPlayed?: Date;\n DistanceSpacing!: number;\n BeatDivisor!: number;\n GridSize!: number;\n TimelineZoom!: number;\n EditorTimestamp?: number;\n CountdownOffset!: number;\n\n static schema: ObjectSchema = {\n name: \"Beatmap\",\n primaryKey: \"ID\",\n properties: {\n ID: { type: \"uuid\", default: \"\" },\n DifficultyName: { type: \"string\", default: \"\", optional: true },\n // Ruleset: { type: \"object\", objectType: \"Ruleset\", default: null },\n // Difficulty: { type: \"object\", objectType: \"BeatmapDifficulty\", default: null },\n Metadata: {\n type: \"object\",\n objectType: \"BeatmapMetadata\",\n default: null,\n },\n // UserSettings: { type: \"object\", objectType: \"BeatmapUserSettings\", default: null },\n BeatmapSet: { type: \"object\", objectType: \"BeatmapSet\", default: null },\n Status: { type: \"int\", default: -3 },\n OnlineID: { type: \"int\", default: -1 },\n Length: { type: \"double\", default: 0 },\n BPM: { type: \"double\", default: 0 },\n Hash: { type: \"string\", default: \"\", optional: true },\n StarRating: { type: \"double\", default: -1 },\n MD5Hash: { type: \"string\", default: \"\", optional: true },\n OnlineMD5Hash: {\n type: \"string\",\n default: \"\",\n optional: true,\n },\n LastLocalUpdate: { type: \"date\", optional: true },\n LastOnlineUpdate: { type: \"date\", optional: true },\n Hidden: { type: \"bool\", default: false },\n AudioLeadIn: { type: \"double\", default: 0 },\n StackLeniency: { type: \"float\", default: 0.7 },\n SpecialStyle: { type: \"bool\", default: false },\n LetterboxInBreaks: { type: \"bool\", default: false },\n WidescreenStoryboard: { type: \"bool\", default: false },\n EpilepsyWarning: { type: \"bool\", default: false },\n SamplesMatchPlaybackRate: { type: \"bool\", default: false },\n LastPlayed: { type: \"date\", optional: true },\n DistanceSpacing: { type: \"double\", default: 0 },\n BeatDivisor: { type: \"int\", default: 0 },\n GridSize: { type: \"int\", default: 0 },\n TimelineZoom: { type: \"double\", default: 0 },\n EditorTimestamp: { type: \"double\", optional: true },\n CountdownOffset: { type: \"int\", default: 0 },\n },\n };\n}\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { RealmUser } from \"./realmUser.js\";\n\nexport class BeatmapMetadata extends Realm.Object<BeatmapMetadata> {\n Title?: string;\n TitleUnicode?: string;\n Artist?: string;\n ArtistUnicode?: string;\n Author?: RealmUser;\n Source?: string;\n Tags?: string;\n PreviewTime?: number;\n AudioFile?: string;\n BackgroundFile?: string;\n\n static schema: ObjectSchema = {\n name: \"BeatmapMetadata\",\n properties: {\n Title: { type: \"string\", default: \"\", optional: true },\n TitleUnicode: { type: \"string\", default: \"\", optional: true },\n Artist: { type: \"string\", default: \"\", optional: true },\n ArtistUnicode: { type: \"string\", default: \"\", optional: true },\n Author: { type: \"object\", objectType: \"RealmUser\", default: null },\n Source: { type: \"string\", default: \"\", optional: true },\n Tags: { type: \"string\", default: \"\", optional: true },\n PreviewTime: { type: \"int\", default: 0 },\n AudioFile: { type: \"string\", default: \"\", optional: true },\n BackgroundFile: { type: \"string\", default: \"\", optional: true },\n },\n };\n}\n\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { Beatmap } from \"./beatmap.js\";\nimport { RealmNamedFileUsage } from \"./realmNamedFileUsage.js\";\n\nexport class BeatmapSet extends Realm.Object<BeatmapSet> {\n ID!: string;\n OnlineID!: number;\n DateAdded!: Date;\n DateSubmitted?: Date;\n DateRanked?: Date;\n Beatmaps!: Array<Beatmap>;\n Files!: Array<RealmNamedFileUsage>;\n Status!: number;\n DeletePending!: boolean;\n Hash?: string;\n Protected!: boolean;\n\n static schema: ObjectSchema = {\n name: \"BeatmapSet\",\n primaryKey: \"ID\",\n properties: {\n ID: { type: \"uuid\", default: \"\" },\n OnlineID: { type: \"int\", default: -1 },\n DateAdded: { type: \"date\" },\n DateSubmitted: { type: \"date\", optional: true },\n DateRanked: { type: \"date\", optional: true },\n Beatmaps: { type: \"list\", objectType: \"Beatmap\", default: [] },\n Files: { type: \"list\", objectType: \"RealmNamedFileUsage\", default: [] },\n Status: { type: \"int\", default: -3 },\n DeletePending: { type: \"bool\", default: false },\n Hash: { type: \"string\", default: \"\", optional: true },\n Protected: { type: \"bool\", default: false },\n },\n };\n}\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\n\nexport class RealmFile extends Realm.Object<RealmFile> {\n Hash?: string;\n\n static schema: ObjectSchema = {\n name: \"File\",\n primaryKey: \"Hash\",\n properties: {\n Hash: { type: \"string\", default: \"\", optional: true },\n },\n };\n}\n\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\n\nexport class RealmUser extends Realm.Object<RealmUser> {\n OnlineID!: number;\n Username?: string;\n CountryCode?: string;\n\n static embedded = true;\n\n static schema: ObjectSchema = {\n name: \"RealmUser\",\n embedded: true,\n properties: {\n OnlineID: { type: \"int\", default: 1 },\n Username: { type: \"string\", default: \"\", optional: true },\n CountryCode: { type: \"string\", optional: true },\n },\n };\n}\n\n","import Realm from \"realm\";\nimport type { ObjectSchema } from \"realm\";\nimport { RealmFile } from \"./realmFile.js\";\n\nexport class RealmNamedFileUsage extends Realm.Object<RealmNamedFileUsage> {\n File!: RealmFile;\n Filename?: string;\n\n static embedded = true;\n\n static schema: ObjectSchema = {\n name: \"RealmNamedFileUsage\",\n embedded: true,\n properties: {\n File: \"File\",\n Filename: { type: \"string\", optional: true },\n },\n };\n}\n","import path from \"node:path\";\nimport { copyFileSync, existsSync, mkdirSync } from \"node:fs\";\n\nexport function getDataDir(): string | undefined {\n switch (process.platform) {\n case \"linux\":\n case \"openbsd\":\n case \"freebsd\": {\n const xdg = process.env[\"XDG_DATA_HOME\"];\n if (xdg) return xdg;\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \".local\", \"share\");\n break;\n }\n\n case \"darwin\": {\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \"Library\", \"Application Support\");\n break;\n }\n\n case \"win32\":\n return process.env[\"LOCALAPPDATA\"] ?? undefined;\n }\n\n return undefined;\n}\n\nexport function getConfigDir(): string | undefined {\n switch (process.platform) {\n case \"openbsd\":\n case \"freebsd\":\n case \"linux\": {\n const xdg = process.env[\"XDG_CONFIG_HOME\"];\n if (xdg) return xdg;\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \".config\");\n break;\n }\n\n case \"darwin\": {\n const home = process.env[\"HOME\"];\n if (home) return path.join(home, \"Library\", \"Preferences\");\n break;\n }\n\n case \"win32\":\n return process.env[\"APPDATA\"] ?? undefined;\n }\n\n return undefined;\n}\n\n/**\n * Get Realm for the app, import to the config if it doesn't exist\n */\nexport function getRealmDBPath(\n appConfigDir: string,\n options: {\n osuDataDir: string;\n reload: boolean;\n } = { reload: false, osuDataDir: getDataDir() || \".\" },\n) {\n const localDBPath = path.join(appConfigDir, \"client.realm\");\n if (!options.reload && existsSync(localDBPath)) return localDBPath;\n\n const osuDBPath = path.join(options.osuDataDir, \"client.realm\");\n if (existsSync(osuDBPath)) {\n console.log( `[getRealmDBPath]: ${osuDBPath} is being imported from osu!lazer to ${localDBPath}`);\n mkdirSync(appConfigDir, { recursive: true });\n copyFileSync(osuDBPath, localDBPath );\n return localDBPath;\n } else {\n console.log(`[getRealmDBPath]: ${osuDBPath} not found`);\n return null;\n }\n}\n","import Realm from \"realm\";\nimport path from \"node:path\";\nimport { getDataDir } from \"../utils/mod.js\";\nimport {\n Beatmap,\n BeatmapMetadata,\n BeatmapSet,\n RealmFile,\n RealmNamedFileUsage,\n RealmUser,\n} from \"./schema/mod.js\";\n\nexport const getLazerDB = async (realmDBPath: string) => {\n const realm = await Realm.open({\n schema: [\n BeatmapSet,\n RealmFile,\n RealmNamedFileUsage,\n Beatmap,\n BeatmapMetadata,\n RealmUser,\n ],\n path: realmDBPath,\n schemaVersion: 41,\n onMigration: (oldRealm, newRealm) => {\n console.log(\n `[onMigration]: Migrating ${oldRealm.path} - ${oldRealm.schemaVersion} -> ${newRealm.path} - ${newRealm.schemaVersion}`,\n );\n },\n });\n\n return realm;\n};\n\nexport const hashedFilePath = (hash: string) => {\n const dataDir = getDataDir();\n if (!dataDir) return null;\n return path.join(\n dataDir,\n \"osu\",\n \"files\",\n hash.slice(0, 1),\n hash.slice(0, 2),\n hash,\n );\n};\n\nexport const getNamedFileHash = (fileName: string, beatmapSet: BeatmapSet) => {\n const files = beatmapSet.Files;\n for (const file of files) {\n if (file.Filename == fileName) return file.File.Hash;\n }\n return undefined;\n};\n"],"mappings":";AAAA,OAAOA,WAAU;AACjB,SAAS,cAAAC,aAAY,qBAAqB;AAC1C,SAAS,oBAAoB;AAE7B,OAAOC,YAAW;AAClB,OAAO,aAAa;;;ACLpB,OAAO,WAAW;AAIX,IAAM,UAAN,cAAsB,MAAM,OAAgB;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,OAAO,SAAuB;AAAA,IAC5B,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,YAAY;AAAA,MACV,IAAI,EAAE,MAAM,QAAQ,SAAS,GAAG;AAAA,MAChC,gBAAgB,EAAE,MAAM,UAAU,SAAS,IAAI,UAAU,KAAK;AAAA;AAAA;AAAA,MAG9D,UAAU;AAAA,QACR,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,SAAS;AAAA,MAC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