ziplayer 0.2.5 → 0.2.7-dev.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/AI-Guide.md +956 -0
- package/README.md +259 -228
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +5 -5
- package/dist/extensions/index.js.map +1 -1
- package/dist/plugins/BasePlugin.d.ts +4 -3
- package/dist/plugins/BasePlugin.d.ts.map +1 -1
- package/dist/plugins/BasePlugin.js +4 -1
- package/dist/plugins/BasePlugin.js.map +1 -1
- package/dist/plugins/index.d.ts +10 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +195 -40
- package/dist/plugins/index.js.map +1 -1
- package/dist/structures/Player.d.ts +0 -9
- package/dist/structures/Player.d.ts.map +1 -1
- package/dist/structures/Player.js +60 -94
- package/dist/structures/Player.js.map +1 -1
- package/dist/types/plugin.d.ts +3 -1
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/plugin.js.map +1 -1
- package/package.json +46 -46
- package/src/extensions/BaseExtension.ts +35 -35
- package/src/extensions/index.ts +190 -194
- package/src/index.ts +16 -16
- package/src/plugins/BasePlugin.ts +27 -26
- package/src/plugins/index.ts +288 -109
- package/src/structures/FilterManager.ts +303 -303
- package/src/structures/Player.ts +1704 -1743
- package/src/structures/PlayerManager.ts +416 -416
- package/src/structures/Queue.ts +354 -354
- package/src/types/index.ts +373 -373
- package/src/types/plugin.ts +3 -1
- package/src/utils/timeout.ts +10 -10
- package/tsconfig.json +22 -23
package/src/types/plugin.ts
CHANGED
|
@@ -6,15 +6,17 @@ import type { SearchResult, StreamInfo, Track } from ".";
|
|
|
6
6
|
* const plugin: SourcePlugin = {
|
|
7
7
|
* name: "YouTube",
|
|
8
8
|
* version: "1.0.0"
|
|
9
|
+
* priority: 0, // Optional, default is 0. Lower priority plugins are tried first in getStream fallback.
|
|
9
10
|
* };
|
|
10
11
|
*/
|
|
11
12
|
export interface SourcePlugin {
|
|
12
13
|
name: string;
|
|
13
14
|
version: string;
|
|
15
|
+
priority?: number;
|
|
14
16
|
canHandle(query: string): boolean;
|
|
15
17
|
search(query: string, requestedBy: string): Promise<SearchResult>;
|
|
16
18
|
getStream(track: Track): Promise<StreamInfo>;
|
|
17
|
-
getRelatedTracks?(track:
|
|
19
|
+
getRelatedTracks?(track: Track, opts?: { limit?: number; offset?: number }): Promise<Track[]>;
|
|
18
20
|
validate?(url: string): boolean;
|
|
19
21
|
extractPlaylist?(url: string, requestedBy: string): Promise<Track[]>;
|
|
20
22
|
}
|
package/src/utils/timeout.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility function to add timeout to a promise
|
|
3
|
-
* @param promise The promise to add timeout to
|
|
4
|
-
* @param timeoutMs Timeout in milliseconds
|
|
5
|
-
* @param message Error message when timeout occurs
|
|
6
|
-
* @returns Promise that rejects if timeout is reached
|
|
7
|
-
*/
|
|
8
|
-
export function withTimeout<T>(promise: Promise<T>, timeoutMs: number, message: string): Promise<T> {
|
|
9
|
-
return Promise.race([promise, new Promise<never>((_, reject) => setTimeout(() => reject(new Error(message)), timeoutMs))]);
|
|
10
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Utility function to add timeout to a promise
|
|
3
|
+
* @param promise The promise to add timeout to
|
|
4
|
+
* @param timeoutMs Timeout in milliseconds
|
|
5
|
+
* @param message Error message when timeout occurs
|
|
6
|
+
* @returns Promise that rejects if timeout is reached
|
|
7
|
+
*/
|
|
8
|
+
export function withTimeout<T>(promise: Promise<T>, timeoutMs: number, message: string): Promise<T> {
|
|
9
|
+
return Promise.race([promise, new Promise<never>((_, reject) => setTimeout(() => reject(new Error(message)), timeoutMs))]);
|
|
10
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"lib": ["
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"rootDir": "./src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"declarationMap": true,
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2021",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2021"],
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationMap": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"allowSyntheticDefaultImports": true,
|
|
16
|
+
"experimentalDecorators": true,
|
|
17
|
+
"emitDecoratorMetadata": true,
|
|
18
|
+
"resolveJsonModule": true
|
|
19
|
+
},
|
|
20
|
+
"include": ["src/**/*"],
|
|
21
|
+
"exclude": ["node_modules", "dist", "examples"]
|
|
22
|
+
}
|