From a15871560f80e07386c1dabb8370cd2664ecfd1f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 Jan 2020 16:56:52 +0100 Subject: Move to eslint --- server/models/video/video-format-utils.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'server/models/video/video-format-utils.ts') diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index bb50edcaa..55b0ed062 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts @@ -27,12 +27,13 @@ import { generateMagnetUri } from '@server/helpers/webtorrent' export type VideoFormattingJSONOptions = { completeDescription?: boolean additionalAttributes: { - state?: boolean, - waitTranscoding?: boolean, - scheduledUpdate?: boolean, + state?: boolean + waitTranscoding?: boolean + scheduledUpdate?: boolean blacklistInfo?: boolean } } + function videoModelToFormattedJSON (video: MVideoFormattable, options?: VideoFormattingJSONOptions): Video { const userHistory = isArray(video.UserVideoHistories) ? video.UserVideoHistories[0] : undefined @@ -181,12 +182,10 @@ function videoFilesModelToFormattedJSON ( ): VideoFile[] { return videoFiles .map(videoFile => { - let resolutionLabel = videoFile.resolution + 'p' - return { resolution: { id: videoFile.resolution, - label: resolutionLabel + label: videoFile.resolution + 'p' }, magnetUri: generateMagnetUri(model, videoFile, baseUrlHttp, baseUrlWs), size: videoFile.size, @@ -214,7 +213,7 @@ function addVideoFilesInAPAcc ( for (const file of files) { acc.push({ type: 'Link', - mediaType: MIMETYPES.VIDEO.EXT_MIMETYPE[ file.extname ] as any, + mediaType: MIMETYPES.VIDEO.EXT_MIMETYPE[file.extname] as any, href: model.getVideoFileUrl(file, baseUrlHttp), height: file.resolution, size: file.size, @@ -274,10 +273,8 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoTorrentObject { addVideoFilesInAPAcc(url, video, baseUrlHttp, baseUrlWs, video.VideoFiles || []) for (const playlist of (video.VideoStreamingPlaylists || [])) { - let tag: ActivityTagObject[] - - tag = playlist.p2pMediaLoaderInfohashes - .map(i => ({ type: 'Infohash' as 'Infohash', name: i })) + const tag = playlist.p2pMediaLoaderInfohashes + .map(i => ({ type: 'Infohash' as 'Infohash', name: i })) as ActivityTagObject[] tag.push({ type: 'Link', name: 'sha256', -- cgit v1.2.3