[scraper] detects and handles disk torrents

This commit is contained in:
TheBeastLT
2020-05-12 09:15:26 +02:00
parent eb2b831a7c
commit f4740694a0
2 changed files with 21 additions and 2 deletions

View File

@@ -35,6 +35,12 @@ const SUBTITLE_EXTENSIONS = [
"idx",
"vtt"
];
const DISK_EXTENSIONS = [
"iso",
"m2ts",
"ts",
"vob"
]
function isVideo(filename) {
return isExtension(filename, VIDEO_EXTENSIONS);
@@ -44,9 +50,13 @@ function isSubtitle(filename) {
return isExtension(filename, SUBTITLE_EXTENSIONS);
}
function isDisk(filename) {
return isExtension(filename, DISK_EXTENSIONS);
}
function isExtension(filename, extensions) {
const extensionMatch = filename.match(/\.(\w{2,4})$/);
return extensionMatch && extensions.includes(extensionMatch[1].toLowerCase());
}
module.exports = { isVideo, isSubtitle }
module.exports = { isVideo, isSubtitle, isDisk }