mirror of
https://github.com/p-stream/providers.git
synced 2026-03-11 17:55:36 +00:00
Fix validatePlayableStream crashing everything
This commit is contained in:
parent
9aac094373
commit
6f761c0187
1 changed files with 18 additions and 7 deletions
|
|
@ -111,13 +111,24 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
|
||||||
|
|
||||||
// return stream is there are any
|
// return stream is there are any
|
||||||
if (output.stream?.[0]) {
|
if (output.stream?.[0]) {
|
||||||
const playableStream = await validatePlayableStream(output.stream[0], ops, source.id);
|
try {
|
||||||
if (!playableStream) throw new NotFoundError('No streams found');
|
const playableStream = await validatePlayableStream(output.stream[0], ops, source.id);
|
||||||
|
if (!playableStream) throw new NotFoundError('No streams found');
|
||||||
return {
|
|
||||||
sourceId: source.id,
|
return {
|
||||||
stream: playableStream,
|
sourceId: source.id,
|
||||||
};
|
stream: playableStream,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
const updateParams: UpdateEvent = {
|
||||||
|
id: source.id,
|
||||||
|
percentage: 100,
|
||||||
|
status: error instanceof NotFoundError ? 'notfound' : 'failure',
|
||||||
|
reason: error instanceof NotFoundError ? error.message : 'Stream validation failed',
|
||||||
|
error: error instanceof NotFoundError ? undefined : error,
|
||||||
|
};
|
||||||
|
ops.events?.update?.(updateParams);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter disabled and run embed scrapers on listed embeds
|
// filter disabled and run embed scrapers on listed embeds
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue