aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-22 21:15:55 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-03-22 21:25:24 +0100
commit6e07c3de88791a0b342e0cc319590048117f9c2d (patch)
tree049f88d3f6d3ec0aeea09702a583deb86d6ef78f /server/controllers
parent2d7653dc8726185615bab66353c4e3fb8fbb5a5f (diff)
downloadPeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.tar.gz
PeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.tar.zst
PeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.zip
Add video category support
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/remote/videos.js2
-rw-r--r--server/controllers/api/videos.js8
2 files changed, 10 insertions, 0 deletions
diff --git a/server/controllers/api/remote/videos.js b/server/controllers/api/remote/videos.js
index cbd58e0e4..c8ef0c445 100644
--- a/server/controllers/api/remote/videos.js
+++ b/server/controllers/api/remote/videos.js
@@ -294,6 +294,7 @@ function addRemoteVideo (videoToCreateData, fromPod, finalCallback) {
294 remoteId: videoToCreateData.remoteId, 294 remoteId: videoToCreateData.remoteId,
295 extname: videoToCreateData.extname, 295 extname: videoToCreateData.extname,
296 infoHash: videoToCreateData.infoHash, 296 infoHash: videoToCreateData.infoHash,
297 category: videoToCreateData.category,
297 description: videoToCreateData.description, 298 description: videoToCreateData.description,
298 authorId: author.id, 299 authorId: author.id,
299 duration: videoToCreateData.duration, 300 duration: videoToCreateData.duration,
@@ -390,6 +391,7 @@ function updateRemoteVideo (videoAttributesToUpdate, fromPod, finalCallback) {
390 const options = { transaction: t } 391 const options = { transaction: t }
391 392
392 videoInstance.set('name', videoAttributesToUpdate.name) 393 videoInstance.set('name', videoAttributesToUpdate.name)
394 videoInstance.set('category', videoAttributesToUpdate.category)
393 videoInstance.set('description', videoAttributesToUpdate.description) 395 videoInstance.set('description', videoAttributesToUpdate.description)
394 videoInstance.set('infoHash', videoAttributesToUpdate.infoHash) 396 videoInstance.set('infoHash', videoAttributesToUpdate.infoHash)
395 videoInstance.set('duration', videoAttributesToUpdate.duration) 397 videoInstance.set('duration', videoAttributesToUpdate.duration)
diff --git a/server/controllers/api/videos.js b/server/controllers/api/videos.js
index 9acdb8fd2..8c69ff4e5 100644
--- a/server/controllers/api/videos.js
+++ b/server/controllers/api/videos.js
@@ -45,6 +45,8 @@ const storage = multer.diskStorage({
45 45
46const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }]) 46const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }])
47 47
48router.get('/categories', listVideoCategories)
49
48router.get('/abuse', 50router.get('/abuse',
49 oAuth.authenticate, 51 oAuth.authenticate,
50 admin.ensureIsAdmin, 52 admin.ensureIsAdmin,
@@ -110,6 +112,10 @@ module.exports = router
110 112
111// --------------------------------------------------------------------------- 113// ---------------------------------------------------------------------------
112 114
115function listVideoCategories (req, res, next) {
116 res.json(constants.VIDEO_CATEGORIES)
117}
118
113function rateVideoRetryWrapper (req, res, next) { 119function rateVideoRetryWrapper (req, res, next) {
114 const options = { 120 const options = {
115 arguments: [ req, res ], 121 arguments: [ req, res ],
@@ -300,6 +306,7 @@ function addVideo (req, res, videoFile, finalCallback) {
300 name: videoInfos.name, 306 name: videoInfos.name,
301 remoteId: null, 307 remoteId: null,
302 extname: path.extname(videoFile.filename), 308 extname: path.extname(videoFile.filename),
309 category: videoInfos.category,
303 description: videoInfos.description, 310 description: videoInfos.description,
304 duration: videoFile.duration, 311 duration: videoFile.duration,
305 authorId: author.id 312 authorId: author.id
@@ -413,6 +420,7 @@ function updateVideo (req, res, finalCallback) {
413 } 420 }
414 421
415 if (videoInfosToUpdate.name) videoInstance.set('name', videoInfosToUpdate.name) 422 if (videoInfosToUpdate.name) videoInstance.set('name', videoInfosToUpdate.name)
423 if (videoInfosToUpdate.category) videoInstance.set('category', videoInfosToUpdate.category)
416 if (videoInfosToUpdate.description) videoInstance.set('description', videoInfosToUpdate.description) 424 if (videoInfosToUpdate.description) videoInstance.set('description', videoInfosToUpdate.description)
417 425
418 videoInstance.save(options).asCallback(function (err) { 426 videoInstance.save(options).asCallback(function (err) {