feat: prepare media resolver source kinds

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-05-15 19:11:23 +07:00
parent 73901231c3
commit 6aeabc690f
5 changed files with 29 additions and 3 deletions

View File

@@ -21,9 +21,9 @@
"db:studio": "drizzle-kit studio" "db:studio": "drizzle-kit studio"
}, },
"dependencies": { "dependencies": {
"@dank074/discord-video-stream": "workspace:*",
"@discordjs/opus": "^0.10.0", "@discordjs/opus": "^0.10.0",
"@discordjs/voice": "^0.19.1", "@discordjs/voice": "^0.19.1",
"@dank074/discord-video-stream": "workspace:*",
"@snazzah/davey": "^0.1.10", "@snazzah/davey": "^0.1.10",
"@types/pg": "^8.20.0", "@types/pg": "^8.20.0",
"@vitejs/plugin-react": "^6.0.2", "@vitejs/plugin-react": "^6.0.2",
@@ -38,6 +38,7 @@
"pg": "^8.20.0", "pg": "^8.20.0",
"pino": "^10.3.1", "pino": "^10.3.1",
"pino-http": "^11.0.0", "pino-http": "^11.0.0",
"play-dl": "^1.9.7",
"prism-media": "2.0.0-alpha.0", "prism-media": "2.0.0-alpha.0",
"prom-client": "^15.1.3", "prom-client": "^15.1.3",
"react": "^19.2.6", "react": "^19.2.6",

16
pnpm-lock.yaml generated
View File

@@ -59,6 +59,9 @@ importers:
pino-http: pino-http:
specifier: ^11.0.0 specifier: ^11.0.0
version: 11.0.0 version: 11.0.0
play-dl:
specifier: ^1.9.7
version: 1.9.7
prism-media: prism-media:
specifier: 2.0.0-alpha.0 specifier: 2.0.0-alpha.0
version: 2.0.0-alpha.0 version: 2.0.0-alpha.0
@@ -3364,6 +3367,13 @@ packages:
pkg-types@1.3.1: pkg-types@1.3.1:
resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==} resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==}
play-audio@0.5.2:
resolution: {integrity: sha512-ZAqHUKkQLix2Iga7pPbsf1LpUoBjcpwU93F1l3qBIfxYddQLhxS6GKmS0d3jV8kSVaUbr6NnOEcEMFvuX93SWQ==}
play-dl@1.9.7:
resolution: {integrity: sha512-KpgerWxUCY4s9Mhze2qdqPhiqd8Ve6HufpH9mBH3FN+vux55qSh6WJKDabfie8IBHN7lnrAlYcT/UdGax58c2A==}
engines: {node: '>=16.0.0'}
plur@4.0.0: plur@4.0.0:
resolution: {integrity: sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg==} resolution: {integrity: sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg==}
engines: {node: '>=10'} engines: {node: '>=10'}
@@ -7293,6 +7303,12 @@ snapshots:
mlly: 1.8.2 mlly: 1.8.2
pathe: 2.0.3 pathe: 2.0.3
play-audio@0.5.2: {}
play-dl@1.9.7:
dependencies:
play-audio: 0.5.2
plur@4.0.0: plur@4.0.0:
dependencies: dependencies:
irregular-plurals: 3.5.0 irregular-plurals: 3.5.0

View File

@@ -1,7 +1,7 @@
import type { Readable } from "node:stream"; import type { Readable } from "node:stream";
export type MediaMode = "music" | "screen"; export type MediaMode = "music" | "screen";
export type MediaSourceKind = "url" | "local"; export type MediaSourceKind = "url" | "local" | "youtube" | "spotify" | "search";
export type MediaQueueItemStatus = "queued" | "playing" | "failed"; export type MediaQueueItemStatus = "queued" | "playing" | "failed";
export interface ResolvedMediaSource { export interface ResolvedMediaSource {

View File

@@ -93,7 +93,7 @@ export interface AnalysisResult {
} }
export type MediaMode = "music" | "screen"; export type MediaMode = "music" | "screen";
export type MediaSourceKind = "url" | "local"; export type MediaSourceKind = "url" | "local" | "youtube" | "spotify" | "search";
export type MediaQueueItemStatus = "queued" | "playing" | "failed"; export type MediaQueueItemStatus = "queued" | "playing" | "failed";
export interface MediaQueueItem { export interface MediaQueueItem {

View File

@@ -68,4 +68,13 @@ describe("resolveMediaSource", () => {
statusCode: 400, statusCode: 400,
} satisfies Partial<AppError>); } satisfies Partial<AppError>);
}); });
it("keeps direct URLs as generic URL sources", async () => {
await expect(
resolveMediaSource("https://cdn.example.com/song.mp3"),
).resolves.toMatchObject({
kind: "url",
source: "https://cdn.example.com/song.mp3",
});
});
}); });