aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/thumbnail.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/thumbnail.ts')
-rw-r--r--server/lib/thumbnail.ts18
1 files changed, 14 insertions, 4 deletions
diff --git a/server/lib/thumbnail.ts b/server/lib/thumbnail.ts
index dc86423f8..740b83acb 100644
--- a/server/lib/thumbnail.ts
+++ b/server/lib/thumbnail.ts
@@ -27,18 +27,28 @@ function createPlaylistMiniatureFromExisting (
27 return createThumbnailFromFunction({ thumbnailCreator, filename, height, width, type, automaticallyGenerated, existingThumbnail }) 27 return createThumbnailFromFunction({ thumbnailCreator, filename, height, width, type, automaticallyGenerated, existingThumbnail })
28} 28}
29 29
30function createPlaylistMiniatureFromUrl (fileUrl: string, playlist: MVideoPlaylistThumbnail, size?: ImageSize) { 30function createPlaylistMiniatureFromUrl (downloadUrl: string, playlist: MVideoPlaylistThumbnail, size?: ImageSize) {
31 const { filename, basePath, height, width, existingThumbnail } = buildMetadataFromPlaylist(playlist, size) 31 const { filename, basePath, height, width, existingThumbnail } = buildMetadataFromPlaylist(playlist, size)
32 const type = ThumbnailType.MINIATURE 32 const type = ThumbnailType.MINIATURE
33 33
34 const thumbnailCreator = () => downloadImage(fileUrl, basePath, filename, { width, height }) 34 // Only save the file URL if it is a remote playlist
35 const fileUrl = playlist.isOwned()
36 ? null
37 : downloadUrl
38
39 const thumbnailCreator = () => downloadImage(downloadUrl, basePath, filename, { width, height })
35 return createThumbnailFromFunction({ thumbnailCreator, filename, height, width, type, existingThumbnail, fileUrl }) 40 return createThumbnailFromFunction({ thumbnailCreator, filename, height, width, type, existingThumbnail, fileUrl })
36} 41}
37 42
38function createVideoMiniatureFromUrl (fileUrl: string, video: MVideoThumbnail, type: ThumbnailType, size?: ImageSize) { 43function createVideoMiniatureFromUrl (downloadUrl: string, video: MVideoThumbnail, type: ThumbnailType, size?: ImageSize) {
39 const { filename, basePath, height, width, existingThumbnail } = buildMetadataFromVideo(video, type, size) 44 const { filename, basePath, height, width, existingThumbnail } = buildMetadataFromVideo(video, type, size)
40 const thumbnailCreator = () => downloadImage(fileUrl, basePath, filename, { width, height })
41 45
46 // Only save the file URL if it is a remote video
47 const fileUrl = video.isOwned()
48 ? null
49 : downloadUrl
50
51 const thumbnailCreator = () => downloadImage(downloadUrl, basePath, filename, { width, height })
42 return createThumbnailFromFunction({ thumbnailCreator, filename, height, width, type, existingThumbnail, fileUrl }) 52 return createThumbnailFromFunction({ thumbnailCreator, filename, height, width, type, existingThumbnail, fileUrl })
43} 53}
44 54