aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-09 11:06:13 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-09 11:17:36 +0200
commit14d3270f363245d2c83fcc2ac109e39743b5627e (patch)
tree22a1d40675d372d53c35a4d7adf1fc1b4ceb1799 /server/controllers
parentaa8b6df4a51c82eb91e6fd71a090b2128098af6b (diff)
downloadPeerTube-14d3270f363245d2c83fcc2ac109e39743b5627e.tar.gz
PeerTube-14d3270f363245d2c83fcc2ac109e39743b5627e.tar.zst
PeerTube-14d3270f363245d2c83fcc2ac109e39743b5627e.zip
Change how we handle resolution
It was an enum before, now we just use video height
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/videos/index.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 14c969ec3..2b7ead954 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -37,10 +37,11 @@ import {
37 retryTransactionWrapper, 37 retryTransactionWrapper,
38 generateRandomString, 38 generateRandomString,
39 getFormattedObjects, 39 getFormattedObjects,
40 renamePromise 40 renamePromise,
41 getVideoFileHeight
41} from '../../../helpers' 42} from '../../../helpers'
42import { TagInstance, VideoInstance } from '../../../models' 43import { TagInstance, VideoInstance } from '../../../models'
43import { VideoCreate, VideoUpdate, VideoResolution } from '../../../../shared' 44import { VideoCreate, VideoUpdate } from '../../../../shared'
44 45
45import { abuseVideoRouter } from './abuse' 46import { abuseVideoRouter } from './abuse'
46import { blacklistRouter } from './blacklist' 47import { blacklistRouter } from './blacklist'
@@ -192,9 +193,14 @@ function addVideo (req: express.Request, res: express.Response, videoPhysicalFil
192 return { author, tagInstances, video } 193 return { author, tagInstances, video }
193 }) 194 })
194 .then(({ author, tagInstances, video }) => { 195 .then(({ author, tagInstances, video }) => {
196 const videoFilePath = join(CONFIG.STORAGE.VIDEOS_DIR, videoPhysicalFile.filename)
197 return getVideoFileHeight(videoFilePath)
198 .then(height => ({ author, tagInstances, video, videoFileHeight: height }))
199 })
200 .then(({ author, tagInstances, video, videoFileHeight }) => {
195 const videoFileData = { 201 const videoFileData = {
196 extname: extname(videoPhysicalFile.filename), 202 extname: extname(videoPhysicalFile.filename),
197 resolution: VideoResolution.ORIGINAL, 203 resolution: videoFileHeight,
198 size: videoPhysicalFile.size 204 size: videoPhysicalFile.size
199 } 205 }
200 206