Fix clean; minor error message fixes

This commit is contained in:
calzoneman 2013-10-07 00:10:16 -05:00
parent 7d862cac60
commit 718a70bc60
4 changed files with 28 additions and 19 deletions

View File

@ -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

View File

@ -120,7 +120,7 @@ module.exports = function (Server) {
if(m === null)
m = buffer.match(/<code>([^<]+)<\/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;
}

View File

@ -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 {

View File

@ -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++) {