Quellcode durchsuchen

Fixed issue where top song wouldn't get moved to bottom when it couldn't be played.

KrisVos130 vor 7 Jahren
Ursprung
Commit
e0f6be4178
1 geänderte Dateien mit 22 neuen und 10 gelöschten Zeilen
  1. 22 10
      frontend/components/Station/Station.vue

+ 22 - 10
frontend/components/Station/Station.vue

@@ -450,16 +450,28 @@
 
 						_this.socket.emit('playlists.getFirstSong', _this.privatePlaylistQueueSelected, data => {
 							if (data.status === 'success') {
-								console.log(data.song);
-								let songId = data.song._id;
-								_this.automaticallyRequestedSongId = data.song.songId;
-								_this.socket.emit('stations.addToQueue', _this.station._id, data.song.songId, data2 => {
-									if (data2.status === 'success') {
-										_this.socket.emit('playlists.moveSongToBottom', _this.privatePlaylistQueueSelected, data.song.songId, data3 => {
-											if (data3.status === 'success') {}
-										});
-									}
-								});
+							    if (data.song.duration < 15 * 60) {
+									console.log(data.song);
+									let songId = data.song._id;
+									_this.automaticallyRequestedSongId = data.song.songId;
+									_this.socket.emit('stations.addToQueue', _this.station._id, data.song.songId, data2 => {
+										if (data2.status === 'success') {
+											_this.socket.emit('playlists.moveSongToBottom', _this.privatePlaylistQueueSelected, data.song.songId, data3 => {
+												if (data3.status === 'success') {
+												}
+											});
+										}
+									});
+								} else {
+									Toast.methods.addToast(`Top song in playlist was too long to be added.`, 3000);
+									_this.socket.emit('playlists.moveSongToBottom', _this.privatePlaylistQueueSelected, data.song.songId, data3 => {
+										if (data3.status === 'success') {
+										    setTimeout(() => {
+										        this.addFirstPrivatePlaylistSongToQueue();
+											}, 3000);
+										}
+									});
+								}
 							}
 						});
 					}