Improved handling of failed video stream fetching. Added proper Little Caprice album URL retrieval.

This commit is contained in:
DebaucheryLibrarian
2026-02-02 02:44:51 +01:00
parent 7f2b1e03ff
commit 27bf48eb05
2 changed files with 49 additions and 19 deletions

View File

@@ -672,22 +672,31 @@ async function fetchHttpSource(source, tempFileTarget, hashStream) {
streamQueue.define('fetchStreamSource', async ({ source, tempFileTarget, hashStream }) => {
const meta = { mimetype: 'video/mp4' };
const video = ffmpeg(source.stream)
const command = ffmpeg(source.stream)
.format('mp4')
.outputOptions(['-movflags frag_keyframe+empty_moov'])
.on('start', (cmd) => logger.verbose(`Fetching stream from ${source.stream} with "${cmd}"`))
.on('error', (error) => {
logger.error(`Failed to fetch stream from ${source.stream}: ${error.message}`);
.on('start', (cmd) => logger.verbose(`Fetching stream from ${source.stream} with "${cmd}"`));
hashStream.end();
tempFileTarget.end();
})
.pipe();
const video = command.pipe();
// await pipeline(video, hashStream, tempFileTarget);
await stream.promises.pipeline(video, hashStream, tempFileTarget);
await Promise.all([
stream.promises.pipeline(video, hashStream, tempFileTarget),
new Promise((resolve, reject) => {
command.on('error', (error) => {
logger.error(`Failed to fetch stream from ${source.stream}: ${error.message}`);
logger.verbose(`Finished fetching stream from ${source.stream}`);
hashStream.end();
tempFileTarget.end();
reject(error);
});
command.on('end', () => {
logger.verbose(`Finished fetching stream from ${source.stream}`);
resolve();
});
}),
]);
return meta;
}, {