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,8 +67,8 @@ 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,
{ {
@ -77,7 +77,6 @@ function getYoutubeDLSubs (url: string, opts?: object): Promise<YoutubeDLSubs> {
filename filename
} }
] ]
}
}, []) }, [])
return res(subtitles) return res(subtitles)