This commit is contained in:
truewhile
2026-09-13 21:23:06 +08:00
parent 670dd90dbe
commit b8e48a1f45
14 changed files with 218 additions and 36 deletions
+15
View File
@@ -3,4 +3,19 @@
// embyremote~{accountID}~{remoteID}。
export function isRemoteEmbyID(id?: string | null): boolean {
return Boolean(id && id.startsWith('embyremote~'))
}
// partitionPreviewIDs 把本地库和远程库拆开。混在一个预览请求里时,本地 SQL
// 会等最慢的远程 Emby 回来才一起返回。
export function partitionPreviewIDs(ids: string[]): string[][] {
const local: string[] = []
const remote: string[] = []
for (const id of ids) {
if (isRemoteEmbyID(id)) remote.push(id)
else local.push(id)
}
const batches: string[][] = []
if (local.length > 0) batches.push(local)
if (remote.length > 0) batches.push(remote)
return batches
}