mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-09-11 21:47:09 +03:00
Correctly fix subtitles import
This commit is contained in:
parent
49919ca16b
commit
982f2fc9b4
@ -67,17 +67,16 @@ function getYoutubeDLSubs (url: string, opts?: object): Promise<YoutubeDLSubs> {
|
||||
|
||||
const subtitles = files.reduce((acc, filename) => {
|
||||
const matched = filename.match(/\.([a-z]{2})\.(vtt|ttml)/i)
|
||||
if (!matched || !matched[1]) return acc
|
||||
|
||||
if (matched[1]) {
|
||||
return [
|
||||
...acc,
|
||||
{
|
||||
language: matched[1],
|
||||
path: join(cwd, filename),
|
||||
filename
|
||||
}
|
||||
]
|
||||
}
|
||||
return [
|
||||
...acc,
|
||||
{
|
||||
language: matched[1],
|
||||
path: join(cwd, filename),
|
||||
filename
|
||||
}
|
||||
]
|
||||
}, [])
|
||||
|
||||
return res(subtitles)
|
||||
|
Loading…
Reference in New Issue
Block a user