diff --git a/lib/channel/playlist.js b/lib/channel/playlist.js index 42fbf508..3a38b3f4 100644 --- a/lib/channel/playlist.js +++ b/lib/channel/playlist.js @@ -7,6 +7,7 @@ var Config = require("../config"); var Flags = require("../flags"); var db = require("../database"); var Logger = require("../logger"); +var CustomEmbedFilter = require("../customembed").filter; const MAX_ITEMS = Config.get("playlist.max-items"); @@ -109,6 +110,16 @@ PlaylistModule.prototype.load = function (data) { var i = 0; playlist.pos = parseInt(playlist.pos); playlist.pl.forEach(function (item) { + if (item.media.type === "cu" && item.media.id.indexOf("cu:") !== 0) { + try { + item.media = CustomEmbedFilter(item.media.id); + } catch (e) { + return; + } + } else if (item.media.type === "gd" || item.media.type === "gp") { + delete item.media.meta.gpdirect; + } + var m = new Media(item.media.id, item.media.title, item.media.seconds, item.media.type, item.media.meta || {}); var newitem = new PlaylistItem(m, { @@ -132,10 +143,8 @@ PlaylistModule.prototype.load = function (data) { PlaylistModule.prototype.save = function (data) { var arr = this.items.toArray().map(function (item) { - /* Clear Google Docs and Vimeo meta */ + /* Clear Google Docs/Google+ and Vimeo meta */ if (item.media && item.media.meta) { - delete item.media.meta.object; - delete item.media.meta.params; delete item.media.meta.direct; } return item;