diff options
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) { |