소스 검색

Made sure rooms that are paused don't skip songs.

KrisVos130 9 년 전
부모
커밋
9bf7e406cc
1개의 변경된 파일8개의 추가작업 그리고 11개의 파일을 삭제
  1. 8 11
      app/server/server.js

+ 8 - 11
app/server/server.js

@@ -145,7 +145,6 @@ function createRoom(display, tag, private, desc) {
 }
 
 function Station(type) {
-    console.log(type);
     if (Playlists.find({type: type}).count() === 0) {
         Playlists.insert({type: type, songs: [default_song.mid], lastSong: 0});
     }
@@ -247,14 +246,16 @@ function Station(type) {
     var timer;
 
     this.songTimer = function () {
-        startedAt = Date.now();
+        if (state !== "paused") {
+            startedAt = Date.now();
 
-        if (timer !== undefined) {
-            timer.pause();
+            if (timer !== undefined) {
+                timer.pause();
+            }
+            timer = new Timer(function () {
+                self.skipSong();
+            }, Songs.findOne({mid: songs[currentSong]}).duration * 1000);
         }
-        timer = new Timer(function () {
-            self.skipSong();
-        }, Songs.findOne({mid: songs[currentSong]}).duration * 1000);
     };
 
     var state = Rooms.findOne({type: type}).state;
@@ -500,10 +501,6 @@ Meteor.publish("userData", function (userId) {
     }
 });
 
-Meteor.publish("allAlerts", function () {
-    return Alerts.find({active: false})
-});
-
 Meteor.publish("playlists", function () {
     return Playlists.find({})
 });