Change meta format so it persists in DB and on disk

This commit is contained in:
Calvin Montgomery 2014-07-11 20:42:13 -07:00
parent 8acffda8ec
commit 937ad04967
5 changed files with 17 additions and 4 deletions

View File

@ -426,7 +426,8 @@ module.exports = {
var meta = JSON.stringify({
bitrate: media.meta.bitrate,
codec: media.meta.codec
codec: media.meta.codec,
gpdirect: media.meta.gpdirect
});
db.query("INSERT INTO `channel_libraries` " +

View File

@ -892,7 +892,7 @@ var Getters = {
}
}
var media = new Media(id, title, duration, "gp", { direct: direct });
var media = new Media(id, title, duration, "gp", { gpdirect: direct });
cb(null, media);
});
}

View File

@ -35,6 +35,7 @@ Media.prototype = {
object: this.meta.object,
params: this.meta.params,
direct: this.meta.direct,
gpdirect: this.meta.gpdirect,
restricted: this.meta.restricted,
codec: this.meta.codec,
bitrate: this.meta.bitrate

View File

@ -1082,6 +1082,9 @@ function FilePlayer(data) {
self.initFlash = function (data) {
waitUntilDefined(window, "swfobject", function () {
if (!data.url) {
return;
}
self.volume = VOLUME;
self.videoId = data.id;
self.videoURL = data.url;
@ -1161,6 +1164,9 @@ function FilePlayer(data) {
};
self.init = function (data) {
if (!data.url) {
return;
}
self.videoId = data.id;
self.videoURL = data.url;
var isAudio = data.meta.codec && data.meta.codec.match(/^mp3$|^vorbis$/);

View File

@ -2742,6 +2742,11 @@ function googlePlusSimulator2014(data) {
data.forceFlash = true;
}
if (!data.meta.gpdirect) {
data.url = "";
return data;
}
/* Convert youtube-style quality key to vimeo workaround quality */
var q = USEROPTS.default_quality || "auto";
@ -2752,13 +2757,13 @@ function googlePlusSimulator2014(data) {
i = fallbacks.indexOf("medium");
}
while (!(q in data.meta.direct) && i < fallbacks.length) {
while (!(q in data.meta.gpdirect) && i < fallbacks.length) {
q = fallbacks[i++];
}
if (i === fallbacks.length) {
q = "medium";
}
data.url = data.meta.direct[q];
data.url = data.meta.gpdirect[q];
return data;
}