mirror of https://github.com/calzoneman/sync.git
Fix for private, but embeddable soundcloud tracks
This commit is contained in:
parent
8630c5972c
commit
139825168f
|
@ -409,7 +409,8 @@ module.exports.saveUserPlaylist = function (pl, username, plname, callback) {
|
||||||
type: pl[i].media.type,
|
type: pl[i].media.type,
|
||||||
meta: {
|
meta: {
|
||||||
codec: pl[i].media.meta.codec,
|
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;
|
time += pl[i].media.seconds || 0;
|
||||||
|
|
|
@ -426,7 +426,8 @@ module.exports = {
|
||||||
|
|
||||||
var meta = JSON.stringify({
|
var meta = JSON.stringify({
|
||||||
bitrate: media.meta.bitrate,
|
bitrate: media.meta.bitrate,
|
||||||
codec: media.meta.codec
|
codec: media.meta.codec,
|
||||||
|
scuri: media.meta.scuri
|
||||||
});
|
});
|
||||||
|
|
||||||
db.query("INSERT INTO `channel_libraries` " +
|
db.query("INSERT INTO `channel_libraries` " +
|
||||||
|
|
|
@ -552,7 +552,11 @@ var Getters = {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
var seconds = data.duration / 1000;
|
var seconds = data.duration / 1000;
|
||||||
var title = data.title;
|
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);
|
callback(false, media);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
callback(e, null);
|
callback(e, null);
|
||||||
|
|
|
@ -36,7 +36,8 @@ Media.prototype = {
|
||||||
gpdirect: this.meta.gpdirect,
|
gpdirect: this.meta.gpdirect,
|
||||||
restricted: this.meta.restricted,
|
restricted: this.meta.restricted,
|
||||||
codec: this.meta.codec,
|
codec: this.meta.codec,
|
||||||
bitrate: this.meta.bitrate
|
bitrate: this.meta.bitrate,
|
||||||
|
scuri: this.meta.scuri
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -441,6 +441,7 @@ var SoundcloudPlayer = function (data) {
|
||||||
// Go figure
|
// Go figure
|
||||||
self.soundcloudIsSeriouslyFuckingBroken = VOLUME;
|
self.soundcloudIsSeriouslyFuckingBroken = VOLUME;
|
||||||
self.videoId = data.id;
|
self.videoId = data.id;
|
||||||
|
self.scuri = data.meta.scuri || self.videoId;
|
||||||
self.videoLength = data.seconds;
|
self.videoLength = data.seconds;
|
||||||
waitUntilDefined(window, "SC", function () {
|
waitUntilDefined(window, "SC", function () {
|
||||||
unfixSoundcloudShit();
|
unfixSoundcloudShit();
|
||||||
|
@ -449,7 +450,7 @@ var SoundcloudPlayer = function (data) {
|
||||||
iframe.appendTo($("#ytapiplayer"));
|
iframe.appendTo($("#ytapiplayer"));
|
||||||
|
|
||||||
iframe.attr("id", "scplayer");
|
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("height", "166px");
|
||||||
iframe.css("border", "none");
|
iframe.css("border", "none");
|
||||||
|
|
||||||
|
@ -469,7 +470,7 @@ var SoundcloudPlayer = function (data) {
|
||||||
self.player = SC.Widget("scplayer");
|
self.player = SC.Widget("scplayer");
|
||||||
|
|
||||||
self.player.bind(SC.Widget.Events.READY, function () {
|
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 () {
|
self.player.bind(SC.Widget.Events.PAUSE, function () {
|
||||||
PLAYER.paused = true;
|
PLAYER.paused = true;
|
||||||
|
@ -500,9 +501,10 @@ var SoundcloudPlayer = function (data) {
|
||||||
|
|
||||||
self.load = function (data) {
|
self.load = function (data) {
|
||||||
self.videoId = data.id;
|
self.videoId = data.id;
|
||||||
|
self.scuri = data.meta.scuri || self.videoId;
|
||||||
self.videoLength = data.seconds;
|
self.videoLength = data.seconds;
|
||||||
if(self.player && self.player.load) {
|
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 () {
|
var soundcloudNeedsToFuckingFixTheirPlayer = function () {
|
||||||
self.setVolume(VOLUME);
|
self.setVolume(VOLUME);
|
||||||
self.player.unbind(SC.Widget.Events.PLAY_PROGRESS);
|
self.player.unbind(SC.Widget.Events.PLAY_PROGRESS);
|
||||||
|
|
Loading…
Reference in New Issue