From 3092476e64d09b449b4ad4f5198024afec1b22ca Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 7 Apr 2017 12:13:37 +0200 Subject: Server: add video language attribute --- server/controllers/api/remote/videos.js | 2 ++ server/controllers/api/videos.js | 7 +++++++ 2 files changed, 9 insertions(+) (limited to 'server/controllers/api') diff --git a/server/controllers/api/remote/videos.js b/server/controllers/api/remote/videos.js index ea1eeb146..e54793628 100644 --- a/server/controllers/api/remote/videos.js +++ b/server/controllers/api/remote/videos.js @@ -296,6 +296,7 @@ function addRemoteVideo (videoToCreateData, fromPod, finalCallback) { infoHash: videoToCreateData.infoHash, category: videoToCreateData.category, licence: videoToCreateData.licence, + language: videoToCreateData.language, nsfw: videoToCreateData.nsfw, description: videoToCreateData.description, authorId: author.id, @@ -395,6 +396,7 @@ function updateRemoteVideo (videoAttributesToUpdate, fromPod, finalCallback) { videoInstance.set('name', videoAttributesToUpdate.name) videoInstance.set('category', videoAttributesToUpdate.category) videoInstance.set('licence', videoAttributesToUpdate.licence) + videoInstance.set('language', videoAttributesToUpdate.language) videoInstance.set('nsfw', videoAttributesToUpdate.nsfw) videoInstance.set('description', videoAttributesToUpdate.description) videoInstance.set('infoHash', videoAttributesToUpdate.infoHash) diff --git a/server/controllers/api/videos.js b/server/controllers/api/videos.js index 3d616e33d..5e9ff482f 100644 --- a/server/controllers/api/videos.js +++ b/server/controllers/api/videos.js @@ -47,6 +47,7 @@ const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCo router.get('/categories', listVideoCategories) router.get('/licences', listVideoLicences) +router.get('/languages', listVideoLanguages) router.get('/abuse', oAuth.authenticate, @@ -121,6 +122,10 @@ function listVideoLicences (req, res, next) { res.json(constants.VIDEO_LICENCES) } +function listVideoLanguages (req, res, next) { + res.json(constants.VIDEO_LANGUAGES) +} + function rateVideoRetryWrapper (req, res, next) { const options = { arguments: [ req, res ], @@ -313,6 +318,7 @@ function addVideo (req, res, videoFile, finalCallback) { extname: path.extname(videoFile.filename), category: videoInfos.category, licence: videoInfos.licence, + language: videoInfos.language, nsfw: videoInfos.nsfw, description: videoInfos.description, duration: videoFile.duration, @@ -429,6 +435,7 @@ function updateVideo (req, res, finalCallback) { if (videoInfosToUpdate.name) videoInstance.set('name', videoInfosToUpdate.name) if (videoInfosToUpdate.category) videoInstance.set('category', videoInfosToUpdate.category) if (videoInfosToUpdate.licence) videoInstance.set('licence', videoInfosToUpdate.licence) + if (videoInfosToUpdate.language) videoInstance.set('language', videoInfosToUpdate.language) if (videoInfosToUpdate.nsfw) videoInstance.set('nsfw', videoInfosToUpdate.nsfw) if (videoInfosToUpdate.description) videoInstance.set('description', videoInfosToUpdate.description) -- cgit v1.2.3