Auto unpause after leader is removed

This commit is contained in:
calzoneman 2014-10-07 23:01:36 -05:00
parent e13e695077
commit 4505ca19da
1 changed files with 10 additions and 4 deletions

View File

@ -235,6 +235,7 @@ PlaylistModule.prototype.onUserPart = function (user) {
if (!this._leadInterval) { if (!this._leadInterval) {
this._lastUpdate = Date.now(); this._lastUpdate = Date.now();
this._leadInterval = setInterval(this._leadLoop.bind(this), 1000); this._leadInterval = setInterval(this._leadLoop.bind(this), 1000);
this._leadLoop();
} }
} }
} }
@ -720,17 +721,22 @@ PlaylistModule.prototype.handleAssignLeader = function (user, data) {
name: old.getName(), name: old.getName(),
rank: old.account.effectiveRank rank: old.account.effectiveRank
}); });
this.channel.logger.log("[mod] " + user.getName() + " removed leader from " + old.getName());
} }
if (!name) { if (!name) {
this.channel.broadcastAll("setLeader", ""); this.channel.broadcastAll("setLeader", "");
this.channel.logger.log("[playlist] Resuming autolead"); this.channel.logger.log("[playlist] Resuming autolead");
if (!this._leadInterval) { if (this.current !== null) {
this._lastUpdate = Date.now(); this.current.media.paused = false;
this._leadInterval = setInterval(this._leadLoop.bind(this), 1000);
}
if (!this._leadInterval) {
this._lastUpdate = Date.now();
this._leadInterval = setInterval(this._leadLoop.bind(this), 1000);
this._leadLoop();
}
}
return; return;
} }