Bugfix youtube search

This commit is contained in:
calzoneman 2013-04-04 15:55:43 -05:00
parent 66dde5f337
commit fc1c5d4896
3 changed files with 33 additions and 12 deletions

View file

@ -180,7 +180,6 @@ exports.lookupChannelRank = function(channame, username) {
var query = "SELECT * FROM chan_{1}_ranks WHERE name='{2}'"
.replace("{1}", channame)
.replace("{2}", username);
console.log(query);
var results = db.querySync(query);
if(!results) {
return Rank.Guest;

View file

@ -302,8 +302,12 @@ function initCallbacks() {
var ul = $("#library")[0];
for(var i = 0; i < data.results.length; i++) {
var li = makeQueueEntry(data.results[i]);
if(RANK >= Rank.Moderator || OPENQUEUE || LEADER)
addLibraryButtons(li, data.results[i].id);
if(RANK >= Rank.Moderator || OPENQUEUE || LEADER) {
if(data.results[i].thumb)
addLibraryButtons(li, data.results[i].id, true);
else
addLibraryButtons(li, data.results[i].id);
}
$(li).appendTo(ul);
}
});

View file

@ -265,7 +265,7 @@ function rebuildPlaylist() {
}
// Add buttons to a list entry for the library search results
function addLibraryButtons(li, id) {
function addLibraryButtons(li, id, yt) {
var btnstrip = $("<div />").attr("class", "btn-group qe_buttons").prependTo(li);
@ -281,17 +281,35 @@ function addLibraryButtons(li, id) {
// Callback time
$(btnNext).click(function() {
socket.emit("queue", {
id: id,
pos: "next"
});
if(yt) {
socket.emit("queue", {
id: id,
pos: "next",
type: "yt"
});
}
else {
socket.emit("queue", {
id: id,
pos: "next"
});
}
});
$(btnEnd).click(function() {
socket.emit("queue", {
id: id,
pos: "end"
});
if(yt) {
socket.emit("queue", {
id: id,
pos: "end",
type: "yt"
});
}
else {
socket.emit("queue", {
id: id,
pos: "end"
});
}
});
}