|
@@ -1,4 +1,5 @@
|
|
History = new Mongo.Collection("history");
|
|
History = new Mongo.Collection("history");
|
|
|
|
+Playlists = new Mongo.Collection("playlists");
|
|
|
|
|
|
if (Meteor.isClient) {
|
|
if (Meteor.isClient) {
|
|
Meteor.startup(function() {
|
|
Meteor.startup(function() {
|
|
@@ -189,7 +190,8 @@ if (Meteor.isClient) {
|
|
|
|
|
|
Template.playlist.helpers({
|
|
Template.playlist.helpers({
|
|
playlist_songs: function() {
|
|
playlist_songs: function() {
|
|
-
|
|
|
|
|
|
+ console.log(Playlists.find({type: "edm"}).fetch());
|
|
|
|
+ return Playlists.find({type: "edm"}).fetch()[0].songs;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -313,6 +315,7 @@ if (Meteor.isClient) {
|
|
}
|
|
}
|
|
|
|
|
|
Meteor.subscribe("history");
|
|
Meteor.subscribe("history");
|
|
|
|
+ Meteor.subscribe("playlists");
|
|
Meteor.setInterval(function() {
|
|
Meteor.setInterval(function() {
|
|
var data = undefined;
|
|
var data = undefined;
|
|
var dataCursor = History.find({type: "edm"});
|
|
var dataCursor = History.find({type: "edm"});
|
|
@@ -342,6 +345,10 @@ if (Meteor.isServer) {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ if (Playlists.find({type: "edm"}).fetch().length === 0) {
|
|
|
|
+ Playlists.insert({type: "edm", songs: [{id: "aE2GCa-_nyU", title: "Radioactive - Lindsey Stirling and Pentatonix", duration: 264, type: "youtube"}, {id: "aHjpOzsQ9YI", title: "Crystallize", artist: "Linsdey Stirling", duration: 300, type: "youtube"}]});
|
|
|
|
+ }
|
|
|
|
+
|
|
var duration = 226440;
|
|
var duration = 226440;
|
|
|
|
|
|
Meteor.users.deny({update: function () { return true; }});
|
|
Meteor.users.deny({update: function () { return true; }});
|
|
@@ -349,11 +356,7 @@ if (Meteor.isServer) {
|
|
Meteor.users.deny({remove: function () { return true; }});
|
|
Meteor.users.deny({remove: function () { return true; }});
|
|
|
|
|
|
var startedAt = Date.now();
|
|
var startedAt = Date.now();
|
|
- var songs = [
|
|
|
|
- {id: "aE2GCa-_nyU", title: "Radioactive - Lindsey Stirling and Pentatonix", duration: 264, type: "youtube"},
|
|
|
|
- {id: "aHjpOzsQ9YI", title: "Crystallize", artist: "Linsdey Stirling", duration: 300, type: "youtube"}
|
|
|
|
- // {id: 172055891, title: "Immortals", artist: "Fall Out Boy", duration: 244, type: "soundcloud"}
|
|
|
|
- ];
|
|
|
|
|
|
+ var songs = Playlists.find({type: "edm"}).fetch()[0].songs;
|
|
var currentSong = 0;
|
|
var currentSong = 0;
|
|
addToHistory(songs[currentSong], startedAt);
|
|
addToHistory(songs[currentSong], startedAt);
|
|
|
|
|
|
@@ -402,6 +405,10 @@ if (Meteor.isServer) {
|
|
return History.find({type: "edm"})
|
|
return History.find({type: "edm"})
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ Meteor.publish("playlists", function() {
|
|
|
|
+ return Playlists.find({type: "edm"})
|
|
|
|
+ });
|
|
|
|
+
|
|
Meteor.methods({
|
|
Meteor.methods({
|
|
createUserMethod: function(formData, captchaData) {
|
|
createUserMethod: function(formData, captchaData) {
|
|
var verifyCaptchaResponse = reCAPTCHA.verifyCaptcha(this.connection.clientAddress, captchaData);
|
|
var verifyCaptchaResponse = reCAPTCHA.verifyCaptcha(this.connection.clientAddress, captchaData);
|