Add default playlist image
authorChocobozzz <me@florianbigard.com>
Wed, 24 Apr 2019 09:10:42 +0000 (11:10 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 24 Apr 2019 14:26:23 +0000 (16:26 +0200)
client/src/app/shared/video-playlist/video-playlist.model.ts
client/src/assets/images/default-playlist.jpg [new file with mode: 0644]
server/controllers/api/video-playlist.ts

index ec8013e8902fa4a95d06e22907c1b452e7488782..7e311aa54b5eb29888eb394c3fcae2b7561e15e9 100644 (file)
@@ -51,7 +51,12 @@ export class VideoPlaylist implements ServerVideoPlaylist {
     this.privacy = hash.privacy
 
     this.thumbnailPath = hash.thumbnailPath
-    this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath
+
+    if (this.thumbnailPath) {
+      this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath
+    } else {
+      this.thumbnailUrl = window.location.origin + '/client/assets/images/default-playlist.jpg'
+    }
 
     this.videosLength = hash.videosLength
 
diff --git a/client/src/assets/images/default-playlist.jpg b/client/src/assets/images/default-playlist.jpg
new file mode 100644 (file)
index 0000000..978fb16
Binary files /dev/null and b/client/src/assets/images/default-playlist.jpg differ
index 6a1d23529d376a0054312aa7fed57ff61648ba88..a17136401095fa521e143477a6c9ccf08df60247 100644 (file)
@@ -304,7 +304,7 @@ async function addVideoInPlaylist (req: express.Request, res: express.Response)
   })
 
   // If the user did not set a thumbnail, automatically take the video thumbnail
-  if (playlistElement.position === 1 && videoPlaylist.hasThumbnail() === false) {
+  if (videoPlaylist.hasThumbnail() === false) {
     logger.info('Generating default thumbnail to playlist %s.', videoPlaylist.url)
 
     const inputPath = join(CONFIG.STORAGE.THUMBNAILS_DIR, video.getMiniature().filename)