Don't search library or cache media if not registered

This commit is contained in:
calzoneman 2013-08-21 16:25:01 -05:00
parent 6d47a94fe9
commit 3abc7ca0c6
1 changed files with 20 additions and 0 deletions

View File

@ -684,6 +684,10 @@ Channel.prototype.tryUnban = function(actor, data) {
Channel.prototype.search = function(query, callback) {
var self = this;
if(!self.registered) {
callback([]);
return;
}
self.server.db.searchLibrary(self.name, query, function (err, res) {
if(err) {
res = [];
@ -1280,6 +1284,22 @@ Channel.prototype.addMedia = function(data, user) {
});
return;
}
// Don't search library if the channel isn't registered
if(!self.registered) {
self.playlist.addMedia(data, function(err, item) {
if(err) {
if(err === true)
err = false;
if(user)
user.socket.emit("queueFail", err);
return;
} else {
postAdd(item, false);
}
});
return;
}
self.server.db.getLibraryItem(self.name, data.id,
function (err, item) {
if(err) {