diff options
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/playlist.ts | 2 | ||||
-rw-r--r-- | server/lib/activitypub/videos.ts | 21 |
2 files changed, 18 insertions, 5 deletions
diff --git a/server/lib/activitypub/playlist.ts b/server/lib/activitypub/playlist.ts index 8b54a001a..53298e968 100644 --- a/server/lib/activitypub/playlist.ts +++ b/server/lib/activitypub/playlist.ts | |||
@@ -99,8 +99,6 @@ async function createOrUpdateVideoPlaylist (playlistObject: PlaylistObject, byAc | |||
99 | return Promise.resolve() | 99 | return Promise.resolve() |
100 | }) | 100 | }) |
101 | 101 | ||
102 | logger.info('toto', { playlist, id: playlist.id }) | ||
103 | |||
104 | const refreshedPlaylist = await VideoPlaylistModel.loadWithAccountAndChannel(playlist.id, null) | 102 | const refreshedPlaylist = await VideoPlaylistModel.loadWithAccountAndChannel(playlist.id, null) |
105 | 103 | ||
106 | if (playlistObject.icon) { | 104 | if (playlistObject.icon) { |
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index b5a199e67..201ef0302 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -56,6 +56,7 @@ import { | |||
56 | MVideoAccountLightBlacklistAllFiles, | 56 | MVideoAccountLightBlacklistAllFiles, |
57 | MVideoAP, | 57 | MVideoAP, |
58 | MVideoAPWithoutCaption, | 58 | MVideoAPWithoutCaption, |
59 | MVideoCaption, | ||
59 | MVideoFile, | 60 | MVideoFile, |
60 | MVideoFullLight, | 61 | MVideoFullLight, |
61 | MVideoId, | 62 | MVideoId, |
@@ -90,7 +91,7 @@ async function federateVideoIfNeeded (videoArg: MVideoAPWithoutCaption, isNewVid | |||
90 | // Fetch more attributes that we will need to serialize in AP object | 91 | // Fetch more attributes that we will need to serialize in AP object |
91 | if (isArray(video.VideoCaptions) === false) { | 92 | if (isArray(video.VideoCaptions) === false) { |
92 | video.VideoCaptions = await video.$get('VideoCaptions', { | 93 | video.VideoCaptions = await video.$get('VideoCaptions', { |
93 | attributes: [ 'language' ], | 94 | attributes: [ 'filename', 'language' ], |
94 | transaction | 95 | transaction |
95 | }) | 96 | }) |
96 | } | 97 | } |
@@ -423,7 +424,14 @@ async function updateVideoFromAP (options: { | |||
423 | await VideoCaptionModel.deleteAllCaptionsOfRemoteVideo(videoUpdated.id, t) | 424 | await VideoCaptionModel.deleteAllCaptionsOfRemoteVideo(videoUpdated.id, t) |
424 | 425 | ||
425 | const videoCaptionsPromises = videoObject.subtitleLanguage.map(c => { | 426 | const videoCaptionsPromises = videoObject.subtitleLanguage.map(c => { |
426 | return VideoCaptionModel.insertOrReplaceLanguage(videoUpdated.id, c.identifier, c.url, t) | 427 | const caption = new VideoCaptionModel({ |
428 | videoId: videoUpdated.id, | ||
429 | filename: VideoCaptionModel.generateCaptionName(c.identifier), | ||
430 | language: c.identifier, | ||
431 | fileUrl: c.url | ||
432 | }) as MVideoCaption | ||
433 | |||
434 | return VideoCaptionModel.insertOrReplaceLanguage(caption, t) | ||
427 | }) | 435 | }) |
428 | await Promise.all(videoCaptionsPromises) | 436 | await Promise.all(videoCaptionsPromises) |
429 | } | 437 | } |
@@ -629,7 +637,14 @@ async function createVideo (videoObject: VideoObject, channel: MChannelAccountLi | |||
629 | 637 | ||
630 | // Process captions | 638 | // Process captions |
631 | const videoCaptionsPromises = videoObject.subtitleLanguage.map(c => { | 639 | const videoCaptionsPromises = videoObject.subtitleLanguage.map(c => { |
632 | return VideoCaptionModel.insertOrReplaceLanguage(videoCreated.id, c.identifier, c.url, t) | 640 | const caption = new VideoCaptionModel({ |
641 | videoId: videoCreated.id, | ||
642 | filename: VideoCaptionModel.generateCaptionName(c.identifier), | ||
643 | language: c.identifier, | ||
644 | fileUrl: c.url | ||
645 | }) as MVideoCaption | ||
646 | |||
647 | return VideoCaptionModel.insertOrReplaceLanguage(caption, t) | ||
633 | }) | 648 | }) |
634 | await Promise.all(videoCaptionsPromises) | 649 | await Promise.all(videoCaptionsPromises) |
635 | 650 | ||