1
0
Fork 0

Correctly fix subtitles import

This commit is contained in:
Chocobozzz 2020-06-17 09:42:00 +02:00
parent 49919ca16b
commit 982f2fc9b4
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 9 additions and 10 deletions

View File

@ -67,17 +67,16 @@ function getYoutubeDLSubs (url: string, opts?: object): Promise<YoutubeDLSubs> {
const subtitles = files.reduce((acc, filename) => { const subtitles = files.reduce((acc, filename) => {
const matched = filename.match(/\.([a-z]{2})\.(vtt|ttml)/i) const matched = filename.match(/\.([a-z]{2})\.(vtt|ttml)/i)
if (!matched || !matched[1]) return acc
if (matched[1]) { return [
return [ ...acc,
...acc, {
{ language: matched[1],
language: matched[1], path: join(cwd, filename),
path: join(cwd, filename), filename
filename }
} ]
]
}
}, []) }, [])
return res(subtitles) return res(subtitles)