Improved handling of failed video stream fetching. Added proper Little Caprice album URL retrieval.
This commit is contained in:
31
src/media.js
31
src/media.js
@@ -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;
|
||||
}, {
|
||||
|
||||
Reference in New Issue
Block a user