mirror of https://github.com/calzoneman/sync.git
Don't search library or cache media if not registered
This commit is contained in:
parent
6d47a94fe9
commit
3abc7ca0c6
20
channel.js
20
channel.js
|
@ -684,6 +684,10 @@ Channel.prototype.tryUnban = function(actor, data) {
|
||||||
|
|
||||||
Channel.prototype.search = function(query, callback) {
|
Channel.prototype.search = function(query, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
if(!self.registered) {
|
||||||
|
callback([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
self.server.db.searchLibrary(self.name, query, function (err, res) {
|
self.server.db.searchLibrary(self.name, query, function (err, res) {
|
||||||
if(err) {
|
if(err) {
|
||||||
res = [];
|
res = [];
|
||||||
|
@ -1280,6 +1284,22 @@ Channel.prototype.addMedia = function(data, user) {
|
||||||
});
|
});
|
||||||
return;
|
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,
|
self.server.db.getLibraryItem(self.name, data.id,
|
||||||
function (err, item) {
|
function (err, item) {
|
||||||
if(err) {
|
if(err) {
|
||||||
|
|
Loading…
Reference in New Issue