diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-18 11:28:00 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-02-18 13:38:09 +0100 |
commit | 8efc27bf14f1fe3ed23cd8a6d2de1f0918a7f769 (patch) | |
tree | 863daf231cf4a66d9e5abf1cfe4fbe2b742cd856 /server/helpers | |
parent | f66db4d5c851fe87bb71cccee96926000f59a15b (diff) | |
download | PeerTube-8efc27bf14f1fe3ed23cd8a6d2de1f0918a7f769.tar.gz PeerTube-8efc27bf14f1fe3ed23cd8a6d2de1f0918a7f769.tar.zst PeerTube-8efc27bf14f1fe3ed23cd8a6d2de1f0918a7f769.zip |
Cleanup
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/webtorrent.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts index 4e08c27c6..d8220ba9c 100644 --- a/server/helpers/webtorrent.ts +++ b/server/helpers/webtorrent.ts | |||
@@ -7,13 +7,14 @@ import * as WebTorrent from 'webtorrent' | |||
7 | import { isArray } from '@server/helpers/custom-validators/misc' | 7 | import { isArray } from '@server/helpers/custom-validators/misc' |
8 | import { WEBSERVER } from '@server/initializers/constants' | 8 | import { WEBSERVER } from '@server/initializers/constants' |
9 | import { generateTorrentFileName, getVideoFilePath } from '@server/lib/video-paths' | 9 | import { generateTorrentFileName, getVideoFilePath } from '@server/lib/video-paths' |
10 | import { MVideo, MVideoWithHost } from '@server/types/models/video/video' | 10 | import { MVideo } from '@server/types/models/video/video' |
11 | import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/video/video-file' | 11 | import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/video/video-file' |
12 | import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist' | 12 | import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist' |
13 | import { CONFIG } from '../initializers/config' | 13 | import { CONFIG } from '../initializers/config' |
14 | import { promisify2 } from './core-utils' | 14 | import { promisify2 } from './core-utils' |
15 | import { logger } from './logger' | 15 | import { logger } from './logger' |
16 | import { generateVideoImportTmpPath } from './utils' | 16 | import { generateVideoImportTmpPath } from './utils' |
17 | import { extractVideo } from './video' | ||
17 | 18 | ||
18 | const createTorrentPromise = promisify2<string, any, any>(createTorrent) | 19 | const createTorrentPromise = promisify2<string, any, any>(createTorrent) |
19 | 20 | ||
@@ -77,12 +78,12 @@ async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName | |||
77 | }) | 78 | }) |
78 | } | 79 | } |
79 | 80 | ||
80 | // FIXME: refactor/merge videoOrPlaylist and video arguments | ||
81 | async function createTorrentAndSetInfoHash ( | 81 | async function createTorrentAndSetInfoHash ( |
82 | videoOrPlaylist: MVideo | MStreamingPlaylistVideo, | 82 | videoOrPlaylist: MVideo | MStreamingPlaylistVideo, |
83 | video: MVideoWithHost, | ||
84 | videoFile: MVideoFile | 83 | videoFile: MVideoFile |
85 | ) { | 84 | ) { |
85 | const video = extractVideo(videoOrPlaylist) | ||
86 | |||
86 | const options = { | 87 | const options = { |
87 | // Keep the extname, it's used by the client to stream the file inside a web browser | 88 | // Keep the extname, it's used by the client to stream the file inside a web browser |
88 | name: `${video.name} ${videoFile.resolution}p${videoFile.extname}`, | 89 | name: `${video.name} ${videoFile.resolution}p${videoFile.extname}`, |
@@ -108,7 +109,7 @@ async function createTorrentAndSetInfoHash ( | |||
108 | } | 109 | } |
109 | 110 | ||
110 | function generateMagnetUri ( | 111 | function generateMagnetUri ( |
111 | video: MVideoWithHost, | 112 | video: MVideo, |
112 | videoFile: MVideoFileRedundanciesOpt, | 113 | videoFile: MVideoFileRedundanciesOpt, |
113 | trackerUrls: string[] | 114 | trackerUrls: string[] |
114 | ) { | 115 | ) { |