diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-29 19:07:05 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-29 19:07:05 +0100 |
commit | 7b1f49de22c40ae121ddb3c399b2540ba56fd414 (patch) | |
tree | 269e5dc7c2ebe4147319f1ee8e8b7f3c74549149 /server/models | |
parent | 4ff0d86208dafbdd07beb6286fd93c795db8a95f (diff) | |
download | PeerTube-7b1f49de22c40ae121ddb3c399b2540ba56fd414.tar.gz PeerTube-7b1f49de22c40ae121ddb3c399b2540ba56fd414.tar.zst PeerTube-7b1f49de22c40ae121ddb3c399b2540ba56fd414.zip |
Server: add ability to update a video
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/video.js | 21 |
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 | ||
337 | function toRemoteJSON (callback) { | 338 | function 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 | ||
366 | function 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 | ||
367 | function generateThumbnailFromData (video, thumbnailData, callback) { | 384 | function generateThumbnailFromData (video, thumbnailData, callback) { |