From 16d9224a1c275a824b4bb3fc0466296bc2c37205 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Tue, 3 Dec 2019 16:11:04 +0100 Subject: [PATCH] (rss) add mrss properties and update pfeed resolves #2298 --- package.json | 2 +- server/controllers/feeds.ts | 29 ++++++++++++++++++++++++++++- yarn.lock | 8 ++++---- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index dfae286e0..941fc3ea8 100644 --- a/package.json +++ b/package.json @@ -138,7 +138,7 @@ "parse-torrent": "^7.0.0", "password-generator": "^2.0.2", "pem": "^1.12.3", - "pfeed": "^1.1.6", + "pfeed": "1.1.10", "pg": "^7.4.1", "prompt": "^1.0.0", "redis": "^2.8.0", diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index 468f7a668..7207baa00 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts @@ -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], + community: { + statistics: { + views: video.views + } + }, thumbnail: [ { url: WEBSERVER.URL + video.getMiniatureStaticPath(), diff --git a/yarn.lock b/yarn.lock index 466397fd2..fd58b3c4a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4911,10 +4911,10 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -pfeed@^1.1.6: - version "1.1.9" - resolved "https://registry.yarnpkg.com/pfeed/-/pfeed-1.1.9.tgz#62225ff674e154aa3d665afa9d85df71f088807e" - integrity sha512-xAm85IdpLNcVp3Q7QyzAe1ncb9REZVdNcQNLYyF8+QiFuy0wDcxGYrqphI2ga6rs1m4sFfhiGZv6iwXdZDQJXA== +pfeed@1.1.10: + version "1.1.10" + resolved "https://registry.yarnpkg.com/pfeed/-/pfeed-1.1.10.tgz#9550017c61925e73b18c6fe3d6c6329d4d41d75f" + integrity sha512-Gv13vtX/6Bac+NxWOYauLCW4br7QaooKUcGHOhKn0SSaYZc5cx2vT5P5hs4533su9uf8VnlLi44VzXodWnQYNg== dependencies: lodash "^4.17.15" xml "^1.0.1" -- 2.25.1