]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/feeds.ts
miniature duration visibility and overlay background opacity
[github/Chocobozzz/PeerTube.git] / server / controllers / feeds.ts
index d3f581615fb56bcf940325836886dfb3b825d91a..6b64ff22720be688d1132b604bab92a71a168ad8 100644 (file)
@@ -43,7 +43,7 @@ export {
 async function generateVideoCommentsFeed (req: express.Request, res: express.Response) {
   const start = 0
 
-  const video = res.locals.video
+  const video = res.locals.videoAll
   const videoId: number = video ? video.id : undefined
 
   const comments = await VideoCommentModel.listForFeed(start, FEEDS.COUNT, videoId)
@@ -118,6 +118,17 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
       url: videoFile.torrentUrl,
       size_in_bytes: videoFile.size
     }))
+    const videos = formattedVideoFiles.map(videoFile => (Object.assign({
+      type: 'video/mp4',
+      medium: 'video',
+      height: videoFile.resolution.label.replace('p', ''),
+      fileSize: videoFile.size,
+      url: videoFile.fileUrl,
+      framerate: videoFile.fps,
+      duration: video.duration
+    }, video.language ? {
+      lang: video.language
+    } : {})))
 
     feed.addItem({
       title: video.name,
@@ -132,9 +143,25 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
         }
       ],
       date: video.publishedAt,
-      language: video.language,
       nsfw: video.nsfw,
       torrent: torrents,
+      videos,
+      embed: {
+        url: video.getEmbedStaticPath(),
+        allowFullscreen: true
+      },
+      player: {
+        url: video.getWatchStaticPath()
+      },
+      categories: [video.category ? {
+        value: video.category,
+        label: VideoModel.getCategoryLabel(video.category)
+      } : null].filter(Boolean),
+      community: {
+        statistics: {
+          views: video.views
+        }
+      },
       thumbnail: [
         {
           url: WEBSERVER.URL + video.getMiniatureStaticPath(),