mirror of https://github.com/calzoneman/sync.git
Add try-catch to playlist loading
This commit is contained in:
parent
af2ef83df8
commit
babeb01ebe
|
@ -1,3 +1,7 @@
|
|||
Sat Oct 12 15:53 2013 CDT
|
||||
* lib/channel.js: Add a try-catch to playlist loading to catch
|
||||
the mysterious error that's been coming up (corrupt pl?)
|
||||
|
||||
Mon Oct 07 19:00 2013 CDT
|
||||
* lib/channel.js: Rearrange the callback order to prevent database
|
||||
lookups from racing with the playlist queue.
|
||||
|
|
|
@ -1599,16 +1599,22 @@ Channel.prototype.tryQueuePlaylist = function(user, data) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (data.pos === "next") {
|
||||
pl.reverse();
|
||||
if (self.playlist.items.length === 0)
|
||||
pl.unshift(pl.pop());
|
||||
}
|
||||
try {
|
||||
if (data.pos === "next") {
|
||||
pl.reverse();
|
||||
if (pl.length > 0 && self.playlist.items.length === 0)
|
||||
pl.unshift(pl.pop());
|
||||
}
|
||||
|
||||
for (var i = 0; i < pl.length; i++) {
|
||||
pl[i].pos = data.pos;
|
||||
pl[i].temp = !self.hasPermission(user, "addnontemp");
|
||||
self.addMedia(pl[i], user);
|
||||
for (var i = 0; i < pl.length; i++) {
|
||||
pl[i].pos = data.pos;
|
||||
pl[i].temp = !self.hasPermission(user, "addnontemp");
|
||||
self.addMedia(pl[i], user);
|
||||
}
|
||||
} catch (e) {
|
||||
Logger.errlog.log("Loading user playlist failed!");
|
||||
Logger.errlog.log("PL: " + user.name + "-" + data.name);
|
||||
Logger.errlog.log(e.stack);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue