fix: use old filename extractor when new one doesn't work (#160)

This commit is contained in:
Jelle Glebbeek
2021-08-28 03:39:30 +02:00
parent 7263736640
commit c0ec57ea15

View File

@@ -390,15 +390,28 @@ class QueryManager {
if(fallback) {
shell.openPath(video.downloadedPath);
} else {
shell.showItemInFolder(path.join(video.downloadedPath, file));
shell.showItemInFolder(await this.verifyOpenVideoFilepath(video, file));
}
} else if(args.type === "item") {
shell.openPath(path.join(video.downloadedPath, file));
shell.openPath(await this.verifyOpenVideoFilepath(video, file));
} else {
console.error("Wrong openVideo type specified.")
}
}
async verifyOpenVideoFilepath(video, file) {
const videoPath = path.join(video.downloadedPath, file);
try {
await fs.promises.access(videoPath)
return path.join(video.downloadedPath, file);
} catch (e) {
let extension = file.substring(file.lastIndexOf('.'), file.length);
if(!extension) extension = '.mp4';
//Fallback to original method if file doesnt exist.
return path.join(video.downloadedPath, video.getFilename() + extension);
}
}
getUnifiedAvailableSubtitles(videos) {
let totalSubs = [];
let totalAutoGen = [];