|
@@ -241,9 +241,13 @@ Template.room.events({
|
|
var artist = $("#artist").val();
|
|
var artist = $("#artist").val();
|
|
var img = $("#img").val();
|
|
var img = $("#img").val();
|
|
var songData = {type: type, id: id, title: title, artist: artist, img: img};
|
|
var songData = {type: type, id: id, title: title, artist: artist, img: img};
|
|
- Meteor.call("addSongToQueue", genre, songData, function(err, res) {
|
|
|
|
- console.log(err, res);
|
|
|
|
- });
|
|
|
|
|
|
+ if(Playlists.find({type: songData.type, "songs.title": songData.title}, {songs: {$elemMatch: {title: songData.title}}}).count() === 0) {
|
|
|
|
+ $(".landing").prepend("<div class='alert alert-danger alert-dismissible' role='alert' style='margin-bottom: 0'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'><i class='fa fa-times'></i></span></button><strong>Song not added.</strong> This song is already is in the playlist.</div>");
|
|
|
|
+ } else{
|
|
|
|
+ Meteor.call("addSongToQueue", genre, songData, function(err, res) {
|
|
|
|
+ console.log(err, res);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
$("#close-modal-a").click();
|
|
$("#close-modal-a").click();
|
|
},
|
|
},
|
|
"click #toggle-video": function(e){
|
|
"click #toggle-video": function(e){
|