diff options
author | Chocobozzz <me@florianbigard.com> | 2020-06-17 09:42:00 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-06-17 09:42:00 +0200 |
commit | 982f2fc9b42537ca40ff29bf62c1ca3692d4b587 (patch) | |
tree | 2c28f1403b7997b03262a2b74056055019f7adf7 /server | |
parent | 49919ca16ba2c100cd444fa5e66442d1b13758c7 (diff) | |
download | PeerTube-982f2fc9b42537ca40ff29bf62c1ca3692d4b587.tar.gz PeerTube-982f2fc9b42537ca40ff29bf62c1ca3692d4b587.tar.zst PeerTube-982f2fc9b42537ca40ff29bf62c1ca3692d4b587.zip |
Correctly fix subtitles import
Diffstat (limited to 'server')
-rw-r--r-- | server/helpers/youtube-dl.ts | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts index 2014aab0a..bb5930952 100644 --- a/server/helpers/youtube-dl.ts +++ b/server/helpers/youtube-dl.ts | |||
@@ -67,17 +67,16 @@ function getYoutubeDLSubs (url: string, opts?: object): Promise<YoutubeDLSubs> { | |||
67 | 67 | ||
68 | const subtitles = files.reduce((acc, filename) => { | 68 | const subtitles = files.reduce((acc, filename) => { |
69 | const matched = filename.match(/\.([a-z]{2})\.(vtt|ttml)/i) | 69 | const matched = filename.match(/\.([a-z]{2})\.(vtt|ttml)/i) |
70 | 70 | if (!matched || !matched[1]) return acc | |
71 | if (matched[1]) { | 71 | |
72 | return [ | 72 | return [ |
73 | ...acc, | 73 | ...acc, |
74 | { | 74 | { |
75 | language: matched[1], | 75 | language: matched[1], |
76 | path: join(cwd, filename), | 76 | path: join(cwd, filename), |
77 | filename | 77 | filename |
78 | } | 78 | } |
79 | ] | 79 | ] |
80 | } | ||
81 | }, []) | 80 | }, []) |
82 | 81 | ||
83 | return res(subtitles) | 82 | return res(subtitles) |