Fix the only thing I see that could possibly still cause #285

This commit is contained in:
calzoneman 2013-10-07 19:03:20 -05:00
parent f5cbdb2f24
commit a3153246ce
3 changed files with 40 additions and 27 deletions

View file

@ -1523,37 +1523,33 @@ Channel.prototype.addMedia = function(data, user) {
});
});
} else {
self.server.db.getLibraryItem(self.name, data.id,
function (err, item) {
self.plqueue.queue(function (q) {
if (self.dead)
return;
self.server.db.getLibraryItem(self.name, data.id,
function (err, item) {
if (self.dead)
return;
if (err) {
user.socket.emit("queueFail", {
msg: "Internal error: " + err,
link: $util.formatLink(data.id, data.type)
});
return;
}
if (item !== null) {
if (data.maxlength && item.seconds > data.maxlength) {
if (err) {
user.socket.emit("queueFail", {
msg: "Media is too long!",
link: $util.formatLink(item.id, item.type)
msg: "Internal error: " + err,
link: $util.formatLink(data.id, data.type)
});
return;
}
self.plqueue.queue(function (q) {
if (self.dead)
if (item !== null) {
if (data.maxlength && item.seconds > data.maxlength) {
user.socket.emit("queueFail", {
msg: "Media is too long!",
link: $util.formatLink(item.id, item.type)
});
return;
}
afterData.bind(self, q, true)(item);
});
} else {
self.plqueue.queue(function (q) {
if (self.dead)
return;
} else {
self.server.infogetter.getMedia(data.id, data.type,
function (e, m) {
if (self.dead)
@ -1569,8 +1565,8 @@ Channel.prototype.addMedia = function(data, user) {
afterData.bind(self, q, false)(m);
});
});
}
}
});
});
}
};