diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-09 11:06:13 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-09 11:17:36 +0200 |
commit | 14d3270f363245d2c83fcc2ac109e39743b5627e (patch) | |
tree | 22a1d40675d372d53c35a4d7adf1fc1b4ceb1799 /server/controllers/api/videos | |
parent | aa8b6df4a51c82eb91e6fd71a090b2128098af6b (diff) | |
download | PeerTube-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/api/videos')
-rw-r--r-- | server/controllers/api/videos/index.ts | 12 |
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' |
42 | import { TagInstance, VideoInstance } from '../../../models' | 43 | import { TagInstance, VideoInstance } from '../../../models' |
43 | import { VideoCreate, VideoUpdate, VideoResolution } from '../../../../shared' | 44 | import { VideoCreate, VideoUpdate } from '../../../../shared' |
44 | 45 | ||
45 | import { abuseVideoRouter } from './abuse' | 46 | import { abuseVideoRouter } from './abuse' |
46 | import { blacklistRouter } from './blacklist' | 47 | import { 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 | ||