Fix bad youtube callback crashing server

This commit is contained in:
calzoneman 2013-03-20 22:29:26 -05:00
parent 090eaa37c2
commit d68d0277bb
1 changed files with 16 additions and 11 deletions

View File

@ -332,17 +332,22 @@ Channel.prototype.enqueue = function(data) {
return; return;
} }
// Whoever decided on this variable name should be fired try {
var seconds = data.entry.media$group.yt$duration.seconds; // Whoever decided on this variable name should be fired
// This one's slightly better var seconds = data.entry.media$group.yt$duration.seconds;
var title = data.entry.title.$t; // This one's slightly better
var vid = new Media(id, title, seconds, "yt"); var title = data.entry.title.$t;
chan.queue.splice(idx, 0, vid); var vid = new Media(id, title, seconds, "yt");
chan.sendAll('queue', { chan.queue.splice(idx, 0, vid);
media: vid.pack(), chan.sendAll('queue', {
pos: idx media: vid.pack(),
}); pos: idx
chan.addToLibrary(vid); });
chan.addToLibrary(vid);
}
catch(e) {
console.log("YTQueue Fail: id=" + id);
}
}})(this, data.id); }})(this, data.id);
InfoGetter.getYTInfo(data.id, callback); InfoGetter.getYTInfo(data.id, callback);
} }