Show links that failed for queueFail
This commit is contained in:
parent
ce197d3d8a
commit
7d862cac60
4 changed files with 113 additions and 21 deletions
|
|
@ -1332,7 +1332,10 @@ Channel.prototype.tryQueue = function(user, data) {
|
|||
}
|
||||
|
||||
if (user.queueLimiter.throttle(limit)) {
|
||||
user.socket.emit("queueFail", "You are adding videos too quickly");
|
||||
user.socket.emit("queueFail", {
|
||||
msg: "You are adding videos too quickly",
|
||||
link: null
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1370,20 +1373,29 @@ Channel.prototype.addMedia = function(data, user) {
|
|||
var self = this;
|
||||
if(data.type === "yp" &&
|
||||
!self.hasPermission(user, "playlistaddlist")) {
|
||||
user.socket.emit("queueFail", "You don't have permission to add " +
|
||||
"playlists");
|
||||
user.socket.emit("queueFail", {
|
||||
msg: "You don't have permission to add " +
|
||||
"playlists",
|
||||
link: $util.formatLink(data.id, data.type)
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(data.type === "cu" &&
|
||||
!self.hasPermission(user, "playlistaddcustom")) {
|
||||
user.socket.emit("queueFail", "You don't have permission to add " +
|
||||
"custom embeds");
|
||||
user.socket.emit("queueFail", {
|
||||
msg: "You don't have permission to add " +
|
||||
"custom embeds",
|
||||
link: null
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(isLive(data.type) &&
|
||||
!self.hasPermission(user, "playlistaddlive")) {
|
||||
user.socket.emit("queueFail", "You don't have " +
|
||||
"permission to add livestreams");
|
||||
user.socket.emit("queueFail", {
|
||||
msg: "You don't have " +
|
||||
"permission to add livestreams",
|
||||
link: $util.formatLink(data.id, data.type)
|
||||
});
|
||||
return;
|
||||
}
|
||||
data.temp = data.temp || isLive(data.type);
|
||||
|
|
@ -1403,8 +1415,10 @@ Channel.prototype.addMedia = function(data, user) {
|
|||
|
||||
var afterData = function (q, c, m) {
|
||||
if (data.maxlength && m.seconds > data.maxlength) {
|
||||
user.socket.emit("queueFail",
|
||||
"Media is too long!");
|
||||
user.socket.emit("queueFail", {
|
||||
msg: "Media is too long!",
|
||||
link: $util.formatLink(m.id, m.type)
|
||||
});
|
||||
q.release();
|
||||
return;
|
||||
}
|
||||
|
|
@ -1414,7 +1428,10 @@ Channel.prototype.addMedia = function(data, user) {
|
|||
m.temp = data.temp;
|
||||
var res = self.playlist.addMedia(m);
|
||||
if (res.error) {
|
||||
user.socket.emit("queueFail", res.error);
|
||||
user.socket.emit("queueFail", {
|
||||
msg: res.error,
|
||||
link: $util.formatLink(m.id, m.type)
|
||||
});
|
||||
q.release();
|
||||
return;
|
||||
}
|
||||
|
|
@ -1449,7 +1466,10 @@ Channel.prototype.addMedia = function(data, user) {
|
|||
self.server.infogetter.getMedia(data.id, data.type,
|
||||
function (e, vids) {
|
||||
if (e) {
|
||||
user.socket.emit("queueFail", e);
|
||||
user.socket.emit("queueFail", {
|
||||
msg: e,
|
||||
link: $util.formatLink(data.id, data.type)
|
||||
});
|
||||
q.release();
|
||||
return;
|
||||
}
|
||||
|
|
@ -1483,7 +1503,10 @@ Channel.prototype.addMedia = function(data, user) {
|
|||
if (self.dead)
|
||||
return;
|
||||
if (e) {
|
||||
user.socket.emit("queueFail", e);
|
||||
user.socket.emit("queueFail", {
|
||||
msg: e,
|
||||
link: $util.formatLink(data.id, data.type)
|
||||
});
|
||||
q.release();
|
||||
return;
|
||||
}
|
||||
|
|
@ -1498,13 +1521,19 @@ Channel.prototype.addMedia = function(data, user) {
|
|||
return;
|
||||
|
||||
if (err) {
|
||||
user.socket.emit("queueFail", "Internal error: " + 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) {
|
||||
user.socket.emit("queueFail", "Media is too long!");
|
||||
user.socket.emit("queueFail", {
|
||||
msg: "Media is too long!",
|
||||
link: $util.formatLink(item.id, item.type)
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1522,7 +1551,10 @@ Channel.prototype.addMedia = function(data, user) {
|
|||
if (self.dead)
|
||||
return;
|
||||
if (e) {
|
||||
user.socket.emit("queueFail", e);
|
||||
user.socket.emit("queueFail", {
|
||||
msg: e,
|
||||
link: $util.formatLink(data.id, data.type)
|
||||
});
|
||||
q.release();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,5 +98,34 @@ module.exports = {
|
|||
return false;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
formatLink: function (id, type) {
|
||||
switch (type) {
|
||||
case "yt":
|
||||
return "http://youtu.be/" + id;
|
||||
case "vi":
|
||||
return "http://vimeo.com/" + id;
|
||||
case "dm":
|
||||
return "http://dailymotion.com/video/" + id;
|
||||
case "sc":
|
||||
return id;
|
||||
case "li":
|
||||
return "http://livestream.com/" + id;
|
||||
case "tw":
|
||||
return "http://twitch.tv/" + id;
|
||||
case "jt":
|
||||
return "http://justin.tv/" + id;
|
||||
case "rt":
|
||||
return id;
|
||||
case "jw":
|
||||
return id;
|
||||
case "im":
|
||||
return "http://imgur.com/a/" + id;
|
||||
case "us":
|
||||
return "http://ustream.tv/" + id;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue