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++) {
|
||||
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;
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
13
playlist.js
13
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;
|
||||
|
|
Loading…
Reference in New Issue