Fix for private, but embeddable soundcloud tracks

This commit is contained in:
calzoneman 2015-01-11 12:10:09 -06:00
parent 8630c5972c
commit 139825168f
5 changed files with 16 additions and 7 deletions

View File

@ -409,7 +409,8 @@ module.exports.saveUserPlaylist = function (pl, username, plname, callback) {
type: pl[i].media.type,
meta: {
codec: pl[i].media.meta.codec,
bitrate: pl[i].media.meta.bitrate
bitrate: pl[i].media.meta.bitrate,
scuri: pl[i].media.meta.scuri
}
};
time += pl[i].media.seconds || 0;

View File

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

View File

@ -552,7 +552,11 @@ var Getters = {
data = JSON.parse(data);
var seconds = data.duration / 1000;
var title = data.title;
var media = new Media(id, title, seconds, "sc");
var meta = {};
if (data.sharing === "private" && data.embeddable_by === "all") {
meta.scuri = data.uri;
}
var media = new Media(id, title, seconds, "sc", meta);
callback(false, media);
} catch(e) {
callback(e, null);

View File

@ -36,7 +36,8 @@ Media.prototype = {
gpdirect: this.meta.gpdirect,
restricted: this.meta.restricted,
codec: this.meta.codec,
bitrate: this.meta.bitrate
bitrate: this.meta.bitrate,
scuri: this.meta.scuri
}
};
},

View File

@ -441,6 +441,7 @@ var SoundcloudPlayer = function (data) {
// Go figure
self.soundcloudIsSeriouslyFuckingBroken = VOLUME;
self.videoId = data.id;
self.scuri = data.meta.scuri || self.videoId;
self.videoLength = data.seconds;
waitUntilDefined(window, "SC", function () {
unfixSoundcloudShit();
@ -449,7 +450,7 @@ var SoundcloudPlayer = function (data) {
iframe.appendTo($("#ytapiplayer"));
iframe.attr("id", "scplayer");
iframe.attr("src", "https://w.soundcloud.com/player/?url="+self.videoId);
iframe.attr("src", "https://w.soundcloud.com/player/?url="+self.scuri);
iframe.css("height", "166px");
iframe.css("border", "none");
@ -469,7 +470,7 @@ var SoundcloudPlayer = function (data) {
self.player = SC.Widget("scplayer");
self.player.bind(SC.Widget.Events.READY, function () {
self.player.load(self.videoId, { auto_play: true });
self.player.load(self.scuri, { auto_play: true });
self.player.bind(SC.Widget.Events.PAUSE, function () {
PLAYER.paused = true;
@ -500,9 +501,10 @@ var SoundcloudPlayer = function (data) {
self.load = function (data) {
self.videoId = data.id;
self.scuri = data.meta.scuri || self.videoId;
self.videoLength = data.seconds;
if(self.player && self.player.load) {
self.player.load(data.id, { auto_play: true });
self.player.load(self.scuri, { auto_play: true });
var soundcloudNeedsToFuckingFixTheirPlayer = function () {
self.setVolume(VOLUME);
self.player.unbind(SC.Widget.Events.PLAY_PROGRESS);