aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/index.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-01-21 16:57:21 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-01-25 14:38:52 +0100
commit77d7e851dccf17dcc89e8fcc2db3f655d1e63f95 (patch)
treed09e045dfabe7ab1e170d1b0caa9decda8a7d39c /server/controllers/api/videos/index.ts
parent92c871b40554d5285232eb4392cebb63d127704a (diff)
downloadPeerTube-77d7e851dccf17dcc89e8fcc2db3f655d1e63f95.tar.gz
PeerTube-77d7e851dccf17dcc89e8fcc2db3f655d1e63f95.tar.zst
PeerTube-77d7e851dccf17dcc89e8fcc2db3f655d1e63f95.zip
Add priority to transcoding jobs
(1 = highest priority) 100 for new resolutions 10 for original file optimization Add a malus for transcoding jobs depending on how many uploads the user did in the last 7 days
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r--server/controllers/api/videos/index.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index e1c775180..c2c5eb640 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -2,16 +2,16 @@ import * as express from 'express'
2import { move } from 'fs-extra' 2import { move } from 'fs-extra'
3import { extname } from 'path' 3import { extname } from 'path'
4import toInt from 'validator/lib/toInt' 4import toInt from 'validator/lib/toInt'
5import { addOptimizeOrMergeAudioJob } from '@server/helpers/video'
6import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' 5import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
7import { changeVideoChannelShare } from '@server/lib/activitypub/share' 6import { changeVideoChannelShare } from '@server/lib/activitypub/share'
8import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' 7import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'
9import { LiveManager } from '@server/lib/live-manager' 8import { LiveManager } from '@server/lib/live-manager'
10import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' 9import { addOptimizeOrMergeAudioJob, buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'
11import { getVideoFilePath } from '@server/lib/video-paths' 10import { getVideoFilePath } from '@server/lib/video-paths'
12import { getServerActor } from '@server/models/application/application' 11import { getServerActor } from '@server/models/application/application'
13import { MVideoFullLight } from '@server/types/models' 12import { MVideoFullLight } from '@server/types/models'
14import { VideoCreate, VideoState, VideoUpdate } from '../../../../shared' 13import { VideoCreate, VideoState, VideoUpdate } from '../../../../shared'
14import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
15import { VideoFilter } from '../../../../shared/models/videos/video-query.type' 15import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
16import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' 16import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
17import { resetSequelizeInstance } from '../../../helpers/database-utils' 17import { resetSequelizeInstance } from '../../../helpers/database-utils'
@@ -66,7 +66,6 @@ import { liveRouter } from './live'
66import { ownershipVideoRouter } from './ownership' 66import { ownershipVideoRouter } from './ownership'
67import { rateVideoRouter } from './rate' 67import { rateVideoRouter } from './rate'
68import { watchingRouter } from './watching' 68import { watchingRouter } from './watching'
69import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
70 69
71const auditLogger = auditLoggerFactory('videos') 70const auditLogger = auditLoggerFactory('videos')
72const videosRouter = express.Router() 71const videosRouter = express.Router()
@@ -267,7 +266,7 @@ async function addVideo (req: express.Request, res: express.Response) {
267 Notifier.Instance.notifyOnNewVideoIfNeeded(videoCreated) 266 Notifier.Instance.notifyOnNewVideoIfNeeded(videoCreated)
268 267
269 if (video.state === VideoState.TO_TRANSCODE) { 268 if (video.state === VideoState.TO_TRANSCODE) {
270 await addOptimizeOrMergeAudioJob(videoCreated, videoFile) 269 await addOptimizeOrMergeAudioJob(videoCreated, videoFile, res.locals.oauth.token.User)
271 } 270 }
272 271
273 Hooks.runAction('action:api.video.uploaded', { video: videoCreated }) 272 Hooks.runAction('action:api.video.uploaded', { video: videoCreated })