mirror of
https://github.com/zoriya/flood.git
synced 2025-12-06 07:16:18 +00:00
chore: improve mediainfo no video file error (#742)
This commit is contained in:
@@ -918,19 +918,26 @@ router.get<{hash: string}>(
|
|||||||
return res.status(404).json({code, message});
|
return res.status(404).json({code, message});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const args = torrentContentPaths.filter((x) => {
|
||||||
|
const fn = x.toLowerCase();
|
||||||
|
for (const ext of ['.mp4', '.mkv', '.ts', '.avi', '.rmvb', '.dat', '.wmv', '.iso']) {
|
||||||
|
if (fn.endsWith(ext)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (args.length < 1) {
|
||||||
|
return res.status(200).json({
|
||||||
|
output:
|
||||||
|
'no video file found.\nIf this is a error, please create a issue at https://github.com/jesec/flood/issues',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const mediainfoProcess = childProcess.execFile(
|
const mediainfoProcess = childProcess.execFile(
|
||||||
'mediainfo',
|
'mediainfo',
|
||||||
torrentContentPaths
|
args.map((x) => path.relative(torrentDirectory, x)),
|
||||||
.filter((x) => {
|
|
||||||
const fn = x.toLowerCase();
|
|
||||||
for (const ext of ['.mp4', '.mkv', '.ts', '.avi', '.rmvb', '.dat', '.wmv', '.iso']) {
|
|
||||||
if (fn.endsWith(ext)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
.map((x) => path.relative(torrentDirectory, x)),
|
|
||||||
{maxBuffer: 1024 * 2000, timeout: 1000 * 10, cwd: torrentDirectory},
|
{maxBuffer: 1024 * 2000, timeout: 1000 * 10, cwd: torrentDirectory},
|
||||||
(error, stdout) => {
|
(error, stdout) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user