diff --git a/changelog b/changelog index 4402b180..aea7cf8b 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,9 @@ +Mon Oct 07 00:08 2013 CDT + * lib/playlist.js: Fix /clean not behaving properly (actually was a + consequence of the remove() function) + * lib/get-info.js: Send more specific error messages + * www/assets/js/callbacks.js: Minor fix to the queueFail callback + Sun Oct 06 01:42 2013 CDT * lib/channel.js, www/assets/js/callbacks.js: Include the link that failed with the queueFail packet. Clicking the "+ n more" tag diff --git a/lib/get-info.js b/lib/get-info.js index 24faf05e..0b56e6d9 100644 --- a/lib/get-info.js +++ b/lib/get-info.js @@ -120,7 +120,7 @@ module.exports = function (Server) { if(m === null) m = buffer.match(/([^<]+)<\/code>/); - var err = true; + var err = e; if(m) { if(m[1] === "too_many_recent_calls") { err = "YouTube is throttling the server right "+ @@ -161,7 +161,7 @@ module.exports = function (Server) { urlRetrieve(https, options, function (status, data) { if(status !== 200) { - callback(true, null); + callback("YTv3: HTTP " + status, null); return; } @@ -170,7 +170,7 @@ module.exports = function (Server) { // I am a bit disappointed that the API v3 just doesn't // return anything in any error case if(data.pageInfo.totalResults !== 1) { - callback(true, null); + callback("Video not found", null); return; } @@ -185,7 +185,7 @@ module.exports = function (Server) { var media = new Media(id, title, seconds, "yt"); callback(false, media); } catch(e) { - callback(true, media); + callback(e, null); } }); }, @@ -231,7 +231,7 @@ module.exports = function (Server) { callback("API failure", null); return; } else if(status !== 200) { - callback(true, null); + callback("YTPlaylist HTTP " + status, null); } try { @@ -257,7 +257,7 @@ module.exports = function (Server) { Getters["yp"](id, callback, links[i].href); } } catch(e) { - callback(true, null); + callback(e, null); } }); @@ -286,7 +286,7 @@ module.exports = function (Server) { urlRetrieve(https, options, function (status, data) { if(status !== 200) { - callback(true, null); + callback("YTSearch HTTP " + status, null); return; } @@ -308,7 +308,7 @@ module.exports = function (Server) { callback(false, vids); } catch(e) { - callback(true, null); + callback(e, null); } }); }, @@ -342,7 +342,7 @@ module.exports = function (Server) { callback("API failure", null); return; } else if(status !== 200) { - callback(true, null); + callback("YTv2 HTTP " + status, null); return; } @@ -354,7 +354,7 @@ module.exports = function (Server) { var media = new Media(id, title, seconds, "vi"); callback(false, media); } catch(e) { - var err = true; + var err = e; if(buffer.match(/not found/)) err = "Video not found"; @@ -388,8 +388,11 @@ module.exports = function (Server) { }; urlRetrieve(https, options, function (status, data) { - if(status !== 200) { - callback(true, null); + if (status === 404) { + callback("Video not found", null); + return; + } else if (status !== 200) { + callback("DM HTTP " + status, null); return; } @@ -444,7 +447,7 @@ module.exports = function (Server) { callback("API failure", null); return; } else if(status !== 302) { - callback(true, null); + callback("SC HTTP " + status, null); return; } @@ -453,7 +456,7 @@ module.exports = function (Server) { data = JSON.parse(data); track = data.location; } catch(e) { - callback(true, null); + callback(e, null); return; } @@ -469,7 +472,7 @@ module.exports = function (Server) { // I want to get off async's wild ride urlRetrieve(https, options2, function (status, data) { if(status !== 200) { - callback(true, null); + callback("SC HTTP " + status, null); return; } @@ -481,7 +484,7 @@ module.exports = function (Server) { var media = new Media(id, title, seconds, "sc"); callback(false, media); } catch(e) { - callback(true, null); + callback(e, null); } }); @@ -554,7 +557,7 @@ module.exports = function (Server) { urlRetrieve(http, options, function (status, data) { if(status !== 200) { - callback(true, null); + callback("Ustream HTTP " + status, null); return; } diff --git a/lib/playlist.js b/lib/playlist.js index fe5154bf..0ae20894 100644 --- a/lib/playlist.js +++ b/lib/playlist.js @@ -222,7 +222,7 @@ Playlist.prototype.remove = function (uid) { var item = self.items.find(uid); if (item && self.items.remove(uid)) { if (item === self.current) { - setImmediate(function () { self._next(); }); + self._next(); } return true; } else { diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index 578acabf..72505b7d 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -806,7 +806,7 @@ Callbacks = { if (!data) data = { link: null }; if (!data.msg || data.msg === true) { - data = "Queue failed. Check your link to make sure it is valid."; + data.msg = "Queue failed. Check your link to make sure it is valid."; } var alerts = $(".qfalert"); for (var i = 0; i < alerts.length; i++) {