|
@@ -899,7 +899,8 @@ export default {
|
|
beforeEditSongModalLocalPaused: null,
|
|
beforeEditSongModalLocalPaused: null,
|
|
socketConnected: null,
|
|
socketConnected: null,
|
|
persistentToastCheckerInterval: null,
|
|
persistentToastCheckerInterval: null,
|
|
- persistentToasts: []
|
|
|
|
|
|
+ persistentToasts: [],
|
|
|
|
+ partyPlaylistLock: false
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -929,6 +930,11 @@ export default {
|
|
aModalIsOpen() {
|
|
aModalIsOpen() {
|
|
return Object.keys(this.currentlyActive).length > 0;
|
|
return Object.keys(this.currentlyActive).length > 0;
|
|
},
|
|
},
|
|
|
|
+ currentUserQueueSongs() {
|
|
|
|
+ return this.songsList.filter(
|
|
|
|
+ queueSong => queueSong.requestedBy === this.userId
|
|
|
|
+ ).length;
|
|
|
|
+ },
|
|
...mapState("modalVisibility", {
|
|
...mapState("modalVisibility", {
|
|
modals: state => state.modals,
|
|
modals: state => state.modals,
|
|
currentlyActive: state => state.currentlyActive
|
|
currentlyActive: state => state.currentlyActive
|
|
@@ -1129,7 +1135,7 @@ export default {
|
|
|
|
|
|
this.updateNextSong(nextSong);
|
|
this.updateNextSong(nextSong);
|
|
|
|
|
|
- this.addPartyPlaylistSongToQueue();
|
|
|
|
|
|
+ if (res.data.queue.length < 50) this.addPartyPlaylistSongToQueue();
|
|
});
|
|
});
|
|
|
|
|
|
this.socket.on("event:station.queue.song.repositioned", res => {
|
|
this.socket.on("event:station.queue.song.repositioned", res => {
|
|
@@ -1905,43 +1911,37 @@ export default {
|
|
);
|
|
);
|
|
},
|
|
},
|
|
addPartyPlaylistSongToQueue() {
|
|
addPartyPlaylistSongToQueue() {
|
|
- let isInQueue = false;
|
|
|
|
if (
|
|
if (
|
|
|
|
+ !this.partyPlaylistLock &&
|
|
this.station.type === "community" &&
|
|
this.station.type === "community" &&
|
|
- this.station.partyMode === true
|
|
|
|
|
|
+ this.station.partyMode === true &&
|
|
|
|
+ this.songsList.length < 50 &&
|
|
|
|
+ this.currentUserQueueSongs < 3 &&
|
|
|
|
+ this.partyPlaylists.length > 0
|
|
) {
|
|
) {
|
|
- this.songsList.forEach(queueSong => {
|
|
|
|
- if (queueSong.requestedBy === this.userId) isInQueue = true;
|
|
|
|
- });
|
|
|
|
- if (!isInQueue && this.partyPlaylists.length > 0) {
|
|
|
|
- const selectedPlaylist =
|
|
|
|
- this.partyPlaylists[
|
|
|
|
|
|
+ const selectedPlaylist =
|
|
|
|
+ this.partyPlaylists[
|
|
|
|
+ Math.floor(Math.random() * this.partyPlaylists.length)
|
|
|
|
+ ];
|
|
|
|
+ if (selectedPlaylist._id && selectedPlaylist.songs.length > 0) {
|
|
|
|
+ const selectedSong =
|
|
|
|
+ selectedPlaylist.songs[
|
|
Math.floor(
|
|
Math.floor(
|
|
- Math.random() * this.partyPlaylists.length
|
|
|
|
|
|
+ Math.random() * selectedPlaylist.songs.length
|
|
)
|
|
)
|
|
];
|
|
];
|
|
- if (
|
|
|
|
- selectedPlaylist._id &&
|
|
|
|
- selectedPlaylist.songs.length > 0
|
|
|
|
- ) {
|
|
|
|
- const selectedSong =
|
|
|
|
- selectedPlaylist.songs[
|
|
|
|
- Math.floor(
|
|
|
|
- Math.random() *
|
|
|
|
- selectedPlaylist.songs.length
|
|
|
|
- )
|
|
|
|
- ];
|
|
|
|
- if (selectedSong.youtubeId) {
|
|
|
|
- this.socket.dispatch(
|
|
|
|
- "stations.addToQueue",
|
|
|
|
- this.station._id,
|
|
|
|
- selectedSong.youtubeId,
|
|
|
|
- data => {
|
|
|
|
- if (data.status !== "success")
|
|
|
|
- new Toast("Error auto queueing song");
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
|
|
+ if (selectedSong.youtubeId) {
|
|
|
|
+ this.partyPlaylistLock = true;
|
|
|
|
+ this.socket.dispatch(
|
|
|
|
+ "stations.addToQueue",
|
|
|
|
+ this.station._id,
|
|
|
|
+ selectedSong.youtubeId,
|
|
|
|
+ data => {
|
|
|
|
+ this.partyPlaylistLock = false;
|
|
|
|
+ if (data.status !== "success")
|
|
|
|
+ this.addPartyPlaylistSongToQueue();
|
|
|
|
+ }
|
|
|
|
+ );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|