mirror of https://github.com/calzoneman/sync.git
Save playlists with cached data
This commit is contained in:
parent
17c733be44
commit
fe2985e8dd
|
@ -900,6 +900,8 @@ function saveUserPlaylist(pl, user, name) {
|
||||||
for(var i = 0; i < pl.length; i++) {
|
for(var i = 0; i < pl.length; i++) {
|
||||||
var e = {
|
var e = {
|
||||||
id: pl[i].media.id,
|
id: pl[i].media.id,
|
||||||
|
title: pl[i].media.title,
|
||||||
|
seconds: pl[i].media.seconds,
|
||||||
type: pl[i].media.type
|
type: pl[i].media.type
|
||||||
};
|
};
|
||||||
time += pl[i].media.seconds;
|
time += pl[i].media.seconds;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "2.1.3",
|
"version": "2.1.4",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
13
playlist.js
13
playlist.js
|
@ -239,6 +239,19 @@ Playlist.prototype.addMedia = function(data, callback) {
|
||||||
};
|
};
|
||||||
this.queueAction(action);
|
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) {
|
InfoGetter.getMedia(data.id, data.type, function(err, media) {
|
||||||
if(err) {
|
if(err) {
|
||||||
action.expire = 0;
|
action.expire = 0;
|
||||||
|
|
|
@ -6,7 +6,7 @@ var Logger = require("./logger");
|
||||||
var Channel = require("./channel");
|
var Channel = require("./channel");
|
||||||
var User = require("./user");
|
var User = require("./user");
|
||||||
|
|
||||||
const VERSION = "2.1.3";
|
const VERSION = "2.1.4";
|
||||||
|
|
||||||
function getIP(req) {
|
function getIP(req) {
|
||||||
var raw = req.connection.remoteAddress;
|
var raw = req.connection.remoteAddress;
|
||||||
|
|
Loading…
Reference in New Issue