diff options
Diffstat (limited to 'server/models/video/video-format-utils.ts')
-rw-r--r-- | server/models/video/video-format-utils.ts | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index bcba90093..551cb2842 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts | |||
@@ -205,7 +205,7 @@ function videoFilesModelToFormattedJSON ( | |||
205 | label: videoFile.resolution + 'p' | 205 | label: videoFile.resolution + 'p' |
206 | }, | 206 | }, |
207 | 207 | ||
208 | magnetUri: includeMagnet && videoFile.torrentFilename | 208 | magnetUri: includeMagnet && videoFile.hasTorrent() |
209 | ? generateMagnetUri(video, videoFile, trackerUrls) | 209 | ? generateMagnetUri(video, videoFile, trackerUrls) |
210 | : undefined, | 210 | : undefined, |
211 | 211 | ||
@@ -253,19 +253,21 @@ function addVideoFilesInAPAcc ( | |||
253 | fps: file.fps | 253 | fps: file.fps |
254 | }) | 254 | }) |
255 | 255 | ||
256 | acc.push({ | 256 | if (file.hasTorrent()) { |
257 | type: 'Link', | 257 | acc.push({ |
258 | mediaType: 'application/x-bittorrent' as 'application/x-bittorrent', | 258 | type: 'Link', |
259 | href: file.getTorrentUrl(), | 259 | mediaType: 'application/x-bittorrent' as 'application/x-bittorrent', |
260 | height: file.resolution | 260 | href: file.getTorrentUrl(), |
261 | }) | 261 | height: file.resolution |
262 | 262 | }) | |
263 | acc.push({ | 263 | |
264 | type: 'Link', | 264 | acc.push({ |
265 | mediaType: 'application/x-bittorrent;x-scheme-handler/magnet' as 'application/x-bittorrent;x-scheme-handler/magnet', | 265 | type: 'Link', |
266 | href: generateMagnetUri(video, file, trackerUrls), | 266 | mediaType: 'application/x-bittorrent;x-scheme-handler/magnet' as 'application/x-bittorrent;x-scheme-handler/magnet', |
267 | height: file.resolution | 267 | href: generateMagnetUri(video, file, trackerUrls), |
268 | }) | 268 | height: file.resolution |
269 | }) | ||
270 | } | ||
269 | } | 271 | } |
270 | } | 272 | } |
271 | 273 | ||