aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/feeds.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/feeds.ts')
-rw-r--r--server/controllers/feeds.ts41
1 files changed, 26 insertions, 15 deletions
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts
index 6b64ff227..104fd5dd9 100644
--- a/server/controllers/feeds.ts
+++ b/server/controllers/feeds.ts
@@ -113,22 +113,36 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
113 // Adding video items to the feed, one at a time 113 // Adding video items to the feed, one at a time
114 resultList.data.forEach(video => { 114 resultList.data.forEach(video => {
115 const formattedVideoFiles = video.getFormattedVideoFilesJSON() 115 const formattedVideoFiles = video.getFormattedVideoFilesJSON()
116
116 const torrents = formattedVideoFiles.map(videoFile => ({ 117 const torrents = formattedVideoFiles.map(videoFile => ({
117 title: video.name, 118 title: video.name,
118 url: videoFile.torrentUrl, 119 url: videoFile.torrentUrl,
119 size_in_bytes: videoFile.size 120 size_in_bytes: videoFile.size
120 })) 121 }))
121 const videos = formattedVideoFiles.map(videoFile => (Object.assign({ 122
122 type: 'video/mp4', 123 const videos = formattedVideoFiles.map(videoFile => {
123 medium: 'video', 124 const result = {
124 height: videoFile.resolution.label.replace('p', ''), 125 type: 'video/mp4',
125 fileSize: videoFile.size, 126 medium: 'video',
126 url: videoFile.fileUrl, 127 height: videoFile.resolution.label.replace('p', ''),
127 framerate: videoFile.fps, 128 fileSize: videoFile.size,
128 duration: video.duration 129 url: videoFile.fileUrl,
129 }, video.language ? { 130 framerate: videoFile.fps,
130 lang: video.language 131 duration: video.duration
131 } : {}))) 132 }
133
134 if (video.language) Object.assign(result, { lang: video.language })
135
136 return result
137 })
138
139 const categories: { value: number, label: string }[] = []
140 if (video.category) {
141 categories.push({
142 value: video.category,
143 label: VideoModel.getCategoryLabel(video.category)
144 })
145 }
132 146
133 feed.addItem({ 147 feed.addItem({
134 title: video.name, 148 title: video.name,
@@ -153,10 +167,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
153 player: { 167 player: {
154 url: video.getWatchStaticPath() 168 url: video.getWatchStaticPath()
155 }, 169 },
156 categories: [video.category ? { 170 categories,
157 value: video.category,
158 label: VideoModel.getCategoryLabel(video.category)
159 } : null].filter(Boolean),
160 community: { 171 community: {
161 statistics: { 172 statistics: {
162 views: video.views 173 views: video.views