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,9 +1599,10 @@ Channel.prototype.tryQueuePlaylist = function(user, data) {
|
|||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (data.pos === "next") {
|
||||
pl.reverse();
|
||||
if (self.playlist.items.length === 0)
|
||||
if (pl.length > 0 && self.playlist.items.length === 0)
|
||||
pl.unshift(pl.pop());
|
||||
}
|
||||
|
||||
|
@ -1610,6 +1611,11 @@ Channel.prototype.tryQueuePlaylist = function(user, data) {
|
|||
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