aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-16 21:16:41 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-16 21:16:41 +0100
commitc77fa067a18a1fea34d5f277da19c2e4712018fa (patch)
treed68419f2449f5ec8db70e312b788e6c56d49c11c /server/controllers/api
parent9c24c07051196696fa41c3e642150ba362991055 (diff)
downloadPeerTube-c77fa067a18a1fea34d5f277da19c2e4712018fa.tar.gz
PeerTube-c77fa067a18a1fea34d5f277da19c2e4712018fa.tar.zst
PeerTube-c77fa067a18a1fea34d5f277da19c2e4712018fa.zip
Server: fix thumbnail in remote videos
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/remote.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/server/controllers/api/remote.js b/server/controllers/api/remote.js
index 4085deb2d..3e2aa6375 100644
--- a/server/controllers/api/remote.js
+++ b/server/controllers/api/remote.js
@@ -55,11 +55,15 @@ function remoteVideos (req, res, next) {
55function addRemoteVideo (videoToCreateData, callback) { 55function addRemoteVideo (videoToCreateData, callback) {
56 logger.debug('Adding remote video %s.', videoToCreateData.magnetUri) 56 logger.debug('Adding remote video %s.', videoToCreateData.magnetUri)
57 57
58 // Mongoose pre hook will automatically create the thumbnail on disk
59 videoToCreateData.thumbnail = videoToCreateData.thumbnailBase64
60
61 const video = new Video(videoToCreateData) 58 const video = new Video(videoToCreateData)
62 video.save(callback) 59 Video.generateThumbnailFromBase64(video, videoToCreateData.thumbnailBase64, function (err) {
60 if (err) {
61 logger.error('Cannot generate thumbnail from base 64 data.', { error: err })
62 return callback(err)
63 }
64
65 video.save(callback)
66 })
63} 67}
64 68
65function removeRemoteVideo (videoToRemoveData, fromHost, callback) { 69function removeRemoteVideo (videoToRemoveData, fromHost, callback) {