diff options
Diffstat (limited to 'server/helpers/youtube-dl/youtube-dl-wrapper.ts')
-rw-r--r-- | server/helpers/youtube-dl/youtube-dl-wrapper.ts | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/server/helpers/youtube-dl/youtube-dl-wrapper.ts b/server/helpers/youtube-dl/youtube-dl-wrapper.ts index 176cf3b69..7cd5e3310 100644 --- a/server/helpers/youtube-dl/youtube-dl-wrapper.ts +++ b/server/helpers/youtube-dl/youtube-dl-wrapper.ts | |||
@@ -46,6 +46,24 @@ class YoutubeDLWrapper { | |||
46 | return infoBuilder.getInfo() | 46 | return infoBuilder.getInfo() |
47 | } | 47 | } |
48 | 48 | ||
49 | async getInfoForListImport (options: { | ||
50 | latestVideosCount?: number | ||
51 | }) { | ||
52 | const youtubeDL = await YoutubeDLCLI.safeGet() | ||
53 | |||
54 | const list = await youtubeDL.getListInfo({ | ||
55 | url: this.url, | ||
56 | latestVideosCount: options.latestVideosCount, | ||
57 | processOptions | ||
58 | }) | ||
59 | |||
60 | return list.map(info => { | ||
61 | const infoBuilder = new YoutubeDLInfoBuilder(info) | ||
62 | |||
63 | return infoBuilder.getInfo() | ||
64 | }) | ||
65 | } | ||
66 | |||
49 | async getSubtitles (): Promise<YoutubeDLSubs> { | 67 | async getSubtitles (): Promise<YoutubeDLSubs> { |
50 | const cwd = CONFIG.STORAGE.TMP_DIR | 68 | const cwd = CONFIG.STORAGE.TMP_DIR |
51 | 69 | ||
@@ -103,7 +121,7 @@ class YoutubeDLWrapper { | |||
103 | 121 | ||
104 | return remove(path) | 122 | return remove(path) |
105 | }) | 123 | }) |
106 | .catch(innerErr => logger.error('Cannot remove file in youtubeDL timeout.', { innerErr, ...lTags() })) | 124 | .catch(innerErr => logger.error('Cannot remove file in youtubeDL error.', { innerErr, ...lTags() })) |
107 | 125 | ||
108 | throw err | 126 | throw err |
109 | } | 127 | } |