diff --git a/database.js b/database.js index 9bc4fb62..c57bebac 100644 --- a/database.js +++ b/database.js @@ -900,6 +900,8 @@ function saveUserPlaylist(pl, user, name) { for(var i = 0; i < pl.length; i++) { var e = { id: pl[i].media.id, + title: pl[i].media.title, + seconds: pl[i].media.seconds, type: pl[i].media.type }; time += pl[i].media.seconds; diff --git a/package.json b/package.json index a0814256..cc33e28a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "2.1.3", + "version": "2.1.4", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/playlist.js b/playlist.js index e6bfd727..f6f412f9 100644 --- a/playlist.js +++ b/playlist.js @@ -239,6 +239,19 @@ Playlist.prototype.addMedia = function(data, callback) { }; this.queueAction(action); + // Pre-cached data + if(typeof data.title === "string" && + typeof data.seconds === "number") { + if(data.maxlength && data.seconds > data.maxlength) { + action.expire = 0; + callback("Media is too long!", null); + return; + } + it.media = new Media(data.id, data.title, data.seconds, data.type); + action.waiting = false; + return; + } + InfoGetter.getMedia(data.id, data.type, function(err, media) { if(err) { action.expire = 0; diff --git a/server.js b/server.js index 4c82a298..f5ddbf14 100644 --- a/server.js +++ b/server.js @@ -6,7 +6,7 @@ var Logger = require("./logger"); var Channel = require("./channel"); var User = require("./user"); -const VERSION = "2.1.3"; +const VERSION = "2.1.4"; function getIP(req) { var raw = req.connection.remoteAddress;