aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-12-29 19:07:05 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-12-29 19:07:05 +0100
commit7b1f49de22c40ae121ddb3c399b2540ba56fd414 (patch)
tree269e5dc7c2ebe4147319f1ee8e8b7f3c74549149 /server/models/video.js
parent4ff0d86208dafbdd07beb6286fd93c795db8a95f (diff)
downloadPeerTube-7b1f49de22c40ae121ddb3c399b2540ba56fd414.tar.gz
PeerTube-7b1f49de22c40ae121ddb3c399b2540ba56fd414.tar.zst
PeerTube-7b1f49de22c40ae121ddb3c399b2540ba56fd414.zip
Server: add ability to update a video
Diffstat (limited to 'server/models/video.js')
-rw-r--r--server/models/video.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/server/models/video.js b/server/models/video.js
index 0e84e8986..14fbe2f71 100644
--- a/server/models/video.js
+++ b/server/models/video.js
@@ -127,7 +127,8 @@ module.exports = function (sequelize, DataTypes) {
127 getTorrentName, 127 getTorrentName,
128 isOwned, 128 isOwned,
129 toFormatedJSON, 129 toFormatedJSON,
130 toRemoteJSON 130 toAddRemoteJSON,
131 toUpdateRemoteJSON
131 }, 132 },
132 hooks: { 133 hooks: {
133 beforeValidate, 134 beforeValidate,
@@ -334,7 +335,7 @@ function toFormatedJSON () {
334 return json 335 return json
335} 336}
336 337
337function toRemoteJSON (callback) { 338function toAddRemoteJSON (callback) {
338 const self = this 339 const self = this
339 340
340 // Get thumbnail data to send to the other pod 341 // Get thumbnail data to send to the other pod
@@ -362,6 +363,22 @@ function toRemoteJSON (callback) {
362 }) 363 })
363} 364}
364 365
366function toUpdateRemoteJSON (callback) {
367 const json = {
368 name: this.name,
369 description: this.description,
370 infoHash: this.infoHash,
371 remoteId: this.id,
372 author: this.Author.name,
373 duration: this.duration,
374 tags: map(this.Tags, 'name'),
375 createdAt: this.createdAt,
376 extname: this.extname
377 }
378
379 return json
380}
381
365// ------------------------------ STATICS ------------------------------ 382// ------------------------------ STATICS ------------------------------
366 383
367function generateThumbnailFromData (video, thumbnailData, callback) { 384function generateThumbnailFromData (video, thumbnailData, callback) {