osu-play 1.3.3 → 1.4.0
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 +50 -4
- package/dist/cli.cjs +868 -91
- package/dist/cli.cjs.map +9 -6
- package/dist/cli.js +857 -80
- package/dist/cli.js.map +9 -6
- package/dist/core/api/catalog.d.ts +61 -0
- package/dist/core/api/server.d.ts +13 -0
- package/dist/core/cli/main.d.ts +6 -0
- package/dist/core/lazer/library.d.ts +17 -0
- package/dist/core/player/session.d.ts +8 -0
- package/dist/core/player/types.d.ts +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type CatalogBeatmapMetadata = {
|
|
2
|
+
Artist?: string | null;
|
|
3
|
+
ArtistUnicode?: string | null;
|
|
4
|
+
AudioFile?: string | null;
|
|
5
|
+
BackgroundFile?: string | null;
|
|
6
|
+
Title?: string | null;
|
|
7
|
+
TitleUnicode?: string | null;
|
|
8
|
+
};
|
|
9
|
+
export type CatalogBeatmap = {
|
|
10
|
+
Length?: number | null;
|
|
11
|
+
Metadata: CatalogBeatmapMetadata;
|
|
12
|
+
};
|
|
13
|
+
export type CatalogBeatmapSet = {
|
|
14
|
+
Beatmaps: Iterable<CatalogBeatmap>;
|
|
15
|
+
DeletePending?: boolean;
|
|
16
|
+
Files: Iterable<{
|
|
17
|
+
File?: {
|
|
18
|
+
Hash?: string | null;
|
|
19
|
+
} | null;
|
|
20
|
+
Filename?: string | null;
|
|
21
|
+
}>;
|
|
22
|
+
Hash?: string | null;
|
|
23
|
+
ID?: unknown;
|
|
24
|
+
};
|
|
25
|
+
export type CatalogMedia = {
|
|
26
|
+
fileName: string;
|
|
27
|
+
path: string;
|
|
28
|
+
};
|
|
29
|
+
export type CatalogSong = {
|
|
30
|
+
album: string;
|
|
31
|
+
albumId: string;
|
|
32
|
+
artist: string;
|
|
33
|
+
coverArt?: string;
|
|
34
|
+
duration?: number;
|
|
35
|
+
fileName: string;
|
|
36
|
+
id: string;
|
|
37
|
+
path: string;
|
|
38
|
+
title: string;
|
|
39
|
+
track: number;
|
|
40
|
+
};
|
|
41
|
+
export type CatalogAlbum = {
|
|
42
|
+
artist: string;
|
|
43
|
+
coverArt?: string;
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
songs: CatalogSong[];
|
|
47
|
+
};
|
|
48
|
+
export type CatalogArtist = {
|
|
49
|
+
coverArt?: string;
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
};
|
|
53
|
+
export type MusicCatalog = {
|
|
54
|
+
albums: CatalogAlbum[];
|
|
55
|
+
albumsById: Map<string, CatalogAlbum>;
|
|
56
|
+
artists: CatalogArtist[];
|
|
57
|
+
coversById: Map<string, CatalogMedia>;
|
|
58
|
+
songsById: Map<string, CatalogSong>;
|
|
59
|
+
};
|
|
60
|
+
export declare function emptyMusicCatalog(): MusicCatalog;
|
|
61
|
+
export declare function buildMusicCatalog(beatmapSets: Iterable<CatalogBeatmapSet>, osuDataDir: string): MusicCatalog;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CatalogStore } from "../lazer/library.js";
|
|
2
|
+
export type StartApiServerOptions = {
|
|
3
|
+
catalogStore: CatalogStore;
|
|
4
|
+
host?: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
};
|
|
7
|
+
export type RunningApiServer = {
|
|
8
|
+
close(): Promise<void>;
|
|
9
|
+
host: string;
|
|
10
|
+
port: number;
|
|
11
|
+
url: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function startApiServer(options: StartApiServerOptions): Promise<RunningApiServer>;
|
package/dist/core/cli/main.d.ts
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
export declare function getArgs(): {
|
|
2
2
|
[x: string]: unknown;
|
|
3
|
+
api: boolean;
|
|
4
|
+
apiPort: number;
|
|
3
5
|
reload: boolean;
|
|
4
6
|
exportPlaylist: string | undefined;
|
|
5
7
|
osuDataDir: string;
|
|
6
8
|
configDir: string | undefined;
|
|
7
9
|
loop: boolean;
|
|
10
|
+
shuffle: boolean;
|
|
8
11
|
_: (string | number)[];
|
|
9
12
|
$0: string;
|
|
10
13
|
} | Promise<{
|
|
11
14
|
[x: string]: unknown;
|
|
15
|
+
api: boolean;
|
|
16
|
+
apiPort: number;
|
|
12
17
|
reload: boolean;
|
|
13
18
|
exportPlaylist: string | undefined;
|
|
14
19
|
osuDataDir: string;
|
|
15
20
|
configDir: string | undefined;
|
|
16
21
|
loop: boolean;
|
|
22
|
+
shuffle: boolean;
|
|
17
23
|
_: (string | number)[];
|
|
18
24
|
$0: string;
|
|
19
25
|
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type MusicCatalog } from "../api/catalog.js";
|
|
2
|
+
import { type PlaylistTrack } from "../playlist/mod.js";
|
|
3
|
+
export declare function loadPlaylistFromLazer(osuDataDir: string): Promise<PlaylistTrack[]>;
|
|
4
|
+
export declare function loadMusicCatalogFromLazer(osuDataDir: string): Promise<MusicCatalog>;
|
|
5
|
+
export declare function deleteBeatmapSetFromLazer(track: Pick<PlaylistTrack, "beatmapSetHash" | "beatmapSetId" | "title">, osuDataDir: string): Promise<void>;
|
|
6
|
+
export type CatalogStore = {
|
|
7
|
+
getCatalog(): MusicCatalog;
|
|
8
|
+
refreshIfChanged(): Promise<MusicCatalog>;
|
|
9
|
+
};
|
|
10
|
+
type RefreshingCatalogStoreOptions = {
|
|
11
|
+
getSignature: () => Promise<string>;
|
|
12
|
+
loadCatalog: () => Promise<MusicCatalog>;
|
|
13
|
+
onRefreshError?: (error: unknown) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare function createRefreshingCatalogStore(options: RefreshingCatalogStoreOptions): Promise<CatalogStore>;
|
|
16
|
+
export declare function createLazerCatalogStore(osuDataDir: string, onRefreshError?: (error: unknown) => void): Promise<CatalogStore>;
|
|
17
|
+
export {};
|
|
@@ -5,8 +5,10 @@ export declare function findTrackIndicesByQuery(playlist: PlaylistTrack[], query
|
|
|
5
5
|
type PlaylistPlayerSessionOptions = {
|
|
6
6
|
deleteTrack?: (track: PlaylistTrack) => Promise<void>;
|
|
7
7
|
loop?: boolean;
|
|
8
|
+
random?: () => number;
|
|
8
9
|
reloadPlaylist?: () => Promise<PlaylistTrack[]>;
|
|
9
10
|
revealTrack?: (track: PlaylistTrack) => Promise<void>;
|
|
11
|
+
shuffle?: boolean;
|
|
10
12
|
};
|
|
11
13
|
export declare class PlaylistPlayerSession {
|
|
12
14
|
private readonly backend;
|
|
@@ -16,10 +18,13 @@ export declare class PlaylistPlayerSession {
|
|
|
16
18
|
private loop;
|
|
17
19
|
private deleteTrack?;
|
|
18
20
|
private playlist;
|
|
21
|
+
private readonly random;
|
|
19
22
|
private readonly reloadPlaylist?;
|
|
20
23
|
private readonly revealTrack?;
|
|
21
24
|
private searchQuery;
|
|
22
25
|
private selectedIndex;
|
|
26
|
+
private shuffle;
|
|
27
|
+
private shuffleOrder;
|
|
23
28
|
private operationQueue;
|
|
24
29
|
private readonly unsubscribeBackend;
|
|
25
30
|
constructor(playlist: PlaylistTrack[], backend: PlayerBackend, options?: PlaylistPlayerSessionOptions);
|
|
@@ -34,8 +39,10 @@ export declare class PlaylistPlayerSession {
|
|
|
34
39
|
selectEnd(): void;
|
|
35
40
|
setSelectionIndex(index: number): void;
|
|
36
41
|
toggleLoop(): void;
|
|
42
|
+
toggleShuffle(): void;
|
|
37
43
|
appendSearchQuery(text: string): void;
|
|
38
44
|
deleteSearchCharacter(): void;
|
|
45
|
+
deleteSearchWord(): void;
|
|
39
46
|
clearSearch(): void;
|
|
40
47
|
playSelected(): Promise<void>;
|
|
41
48
|
playNext(): Promise<void>;
|
|
@@ -50,6 +57,7 @@ export declare class PlaylistPlayerSession {
|
|
|
50
57
|
private emit;
|
|
51
58
|
private playIndex;
|
|
52
59
|
private getAdjacentIndex;
|
|
60
|
+
private resetShuffleOrder;
|
|
53
61
|
private handleBackendEvent;
|
|
54
62
|
private enqueueOperation;
|
|
55
63
|
private syncSelectionToSearch;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "osu-play",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Play music from your osu!lazer beatmaps
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "Play and stream music from your osu!lazer beatmaps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -75,6 +75,9 @@
|
|
|
75
75
|
"cli",
|
|
76
76
|
"music",
|
|
77
77
|
"game",
|
|
78
|
+
"subsonic",
|
|
79
|
+
"kopuz",
|
|
80
|
+
"music-server",
|
|
78
81
|
"typescript"
|
|
79
82
|
],
|
|
80
83
|
"repository": {
|