mirror of
https://github.com/jely2002/youtube-dl-gui.git
synced 2021-11-01 22:46:21 +03:00
fix: use old filename extractor when new one doesn't work (#160)
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user