Skip to content

Commit

Permalink
fix: only generate mediainfo for video file (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 authored May 3, 2024
1 parent 875a575 commit 75dee9b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion server/routes/api/torrents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,17 @@ router.get<{hash: string}>(

const mediainfoProcess = childProcess.execFile(
'mediainfo',
torrentContentPaths.map((x) => path.relative(torrentDirectory, x)),
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;
})
.map((x) => path.relative(torrentDirectory, x)),
{maxBuffer: 1024 * 2000, timeout: 1000 * 10, cwd: torrentDirectory},
(error, stdout) => {
if (error) {
Expand Down

0 comments on commit 75dee9b

Please sign in to comment.