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
|
Mon Oct 07 19:00 2013 CDT
|
||||||
* lib/channel.js: Rearrange the callback order to prevent database
|
* lib/channel.js: Rearrange the callback order to prevent database
|
||||||
lookups from racing with the playlist queue.
|
lookups from racing with the playlist queue.
|
||||||
|
|
|
@ -1599,16 +1599,22 @@ Channel.prototype.tryQueuePlaylist = function(user, data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.pos === "next") {
|
try {
|
||||||
pl.reverse();
|
if (data.pos === "next") {
|
||||||
if (self.playlist.items.length === 0)
|
pl.reverse();
|
||||||
pl.unshift(pl.pop());
|
if (pl.length > 0 && self.playlist.items.length === 0)
|
||||||
}
|
pl.unshift(pl.pop());
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < pl.length; i++) {
|
for (var i = 0; i < pl.length; i++) {
|
||||||
pl[i].pos = data.pos;
|
pl[i].pos = data.pos;
|
||||||
pl[i].temp = !self.hasPermission(user, "addnontemp");
|
pl[i].temp = !self.hasPermission(user, "addnontemp");
|
||||||
self.addMedia(pl[i], user);
|
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