diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-18 11:22:35 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-02-18 13:38:09 +0100 |
commit | f66db4d5c851fe87bb71cccee96926000f59a15b (patch) | |
tree | 94fb0826669140ed42b3c82943ec9ba205a7b7fa | |
parent | b3d5cb92b100406df98e5cd1f54eff9cd2078b1c (diff) | |
download | PeerTube-f66db4d5c851fe87bb71cccee96926000f59a15b.tar.gz PeerTube-f66db4d5c851fe87bb71cccee96926000f59a15b.tar.zst PeerTube-f66db4d5c851fe87bb71cccee96926000f59a15b.zip |
Fix feeds
-rw-r--r-- | server/controllers/feeds.ts | 2 | ||||
-rw-r--r-- | server/models/video/video-format-utils.ts | 12 | ||||
-rw-r--r-- | server/models/video/video.ts | 6 | ||||
-rw-r--r-- | shared/models/videos/video-file.model.ts | 3 |
4 files changed, 13 insertions, 10 deletions
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index 2182b42f5..e29a8fe1d 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts | |||
@@ -255,7 +255,7 @@ function addVideosToFeed (feed, videos: VideoModel[]) { | |||
255 | * Adding video items to the feed object, one at a time | 255 | * Adding video items to the feed object, one at a time |
256 | */ | 256 | */ |
257 | for (const video of videos) { | 257 | for (const video of videos) { |
258 | const formattedVideoFiles = video.getFormattedVideoFilesJSON() | 258 | const formattedVideoFiles = video.getFormattedVideoFilesJSON(false) |
259 | 259 | ||
260 | const torrents = formattedVideoFiles.map(videoFile => ({ | 260 | const torrents = formattedVideoFiles.map(videoFile => ({ |
261 | title: video.name, | 261 | title: video.name, |
diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index 9dc3e7722..455597d22 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts | |||
@@ -188,9 +188,12 @@ function sortByResolutionDesc (fileA: MVideoFile, fileB: MVideoFile) { | |||
188 | 188 | ||
189 | function videoFilesModelToFormattedJSON ( | 189 | function videoFilesModelToFormattedJSON ( |
190 | video: MVideoFormattableDetails, | 190 | video: MVideoFormattableDetails, |
191 | videoFiles: MVideoFileRedundanciesOpt[] | 191 | videoFiles: MVideoFileRedundanciesOpt[], |
192 | includeMagnet = true | ||
192 | ): VideoFile[] { | 193 | ): VideoFile[] { |
193 | const trackerUrls = video.getTrackerUrls() | 194 | const trackerUrls = includeMagnet |
195 | ? video.getTrackerUrls() | ||
196 | : [] | ||
194 | 197 | ||
195 | return [ ...videoFiles ] | 198 | return [ ...videoFiles ] |
196 | .filter(f => !f.isLive()) | 199 | .filter(f => !f.isLive()) |
@@ -202,8 +205,9 @@ function videoFilesModelToFormattedJSON ( | |||
202 | label: videoFile.resolution + 'p' | 205 | label: videoFile.resolution + 'p' |
203 | }, | 206 | }, |
204 | 207 | ||
205 | // FIXME: deprecated in 3.2 | 208 | magnetUri: includeMagnet |
206 | magnetUri: generateMagnetUri(video, videoFile, trackerUrls), | 209 | ? generateMagnetUri(video, videoFile, trackerUrls) |
210 | : undefined, | ||
207 | 211 | ||
208 | size: videoFile.size, | 212 | size: videoFile.size, |
209 | fps: videoFile.fps, | 213 | fps: videoFile.fps, |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 9e67ca0f4..48d4ba47a 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1904,16 +1904,16 @@ export class VideoModel extends Model { | |||
1904 | return videoModelToFormattedDetailsJSON(this) | 1904 | return videoModelToFormattedDetailsJSON(this) |
1905 | } | 1905 | } |
1906 | 1906 | ||
1907 | getFormattedVideoFilesJSON (): VideoFile[] { | 1907 | getFormattedVideoFilesJSON (includeMagnet = true): VideoFile[] { |
1908 | let files: VideoFile[] = [] | 1908 | let files: VideoFile[] = [] |
1909 | 1909 | ||
1910 | if (Array.isArray(this.VideoFiles)) { | 1910 | if (Array.isArray(this.VideoFiles)) { |
1911 | const result = videoFilesModelToFormattedJSON(this, this.VideoFiles) | 1911 | const result = videoFilesModelToFormattedJSON(this, this.VideoFiles, includeMagnet) |
1912 | files = files.concat(result) | 1912 | files = files.concat(result) |
1913 | } | 1913 | } |
1914 | 1914 | ||
1915 | for (const p of (this.VideoStreamingPlaylists || [])) { | 1915 | for (const p of (this.VideoStreamingPlaylists || [])) { |
1916 | const result = videoFilesModelToFormattedJSON(this, p.VideoFiles) | 1916 | const result = videoFilesModelToFormattedJSON(this, p.VideoFiles, includeMagnet) |
1917 | files = files.concat(result) | 1917 | files = files.concat(result) |
1918 | } | 1918 | } |
1919 | 1919 | ||
diff --git a/shared/models/videos/video-file.model.ts b/shared/models/videos/video-file.model.ts index f3d93f0ed..1e830b19c 100644 --- a/shared/models/videos/video-file.model.ts +++ b/shared/models/videos/video-file.model.ts | |||
@@ -17,6 +17,5 @@ export interface VideoFile { | |||
17 | metadata?: VideoFileMetadata | 17 | metadata?: VideoFileMetadata |
18 | metadataUrl?: string | 18 | metadataUrl?: string |
19 | 19 | ||
20 | // FIXME: deprecated in 3.2 | 20 | magnetUri: string | null |
21 | magnetUri: string | ||
22 | } | 21 | } |