fix(soundcloud): remove broken integration

This commit is contained in:
Lucas Bickel 2021-01-06 12:20:23 +00:00 committed by GitHub
parent ecd302068c
commit 4c72403b9b
85 changed files with 133081 additions and 118229 deletions

View file

@ -236,16 +236,15 @@ var AIRTIME = (function(AIRTIME) {
"</div>"
);
if (onDashboard) {
$menu.append(
"<div class='btn-group' title=" + $.i18n._('Publish') + ">" +
"<button class='btn btn-small' id='publish-btn'>" +
"<i class='icon-soundcloud-white'></i>" +
"<span>" + $.i18n._('Publish') + "</span>" +
"</button>" +
"</div>"
);
}
if (onDashboard) {
$menu.append(
"<div class='btn-group' title=" + $.i18n._('Publish') + ">" +
"<button class='btn btn-small' id='publish-btn'>" +
"<span>" + $.i18n._('Publish') + "</span>" +
"</button>" +
"</div>"
);
}
};
mod.createToolbarDropDown = function() {
@ -1325,25 +1324,6 @@ var AIRTIME = (function(AIRTIME) {
};
oItems.download.callback = callback;
}
// add callbacks for Soundcloud menu items.
if (oItems.soundcloud !== undefined) {
var soundcloud = oItems.soundcloud.items;
if (soundcloud.update !== undefined) {
callback = function() {
$.post(soundcloud.update.url, function () {});
};
soundcloud.update.callback = callback;
}
// define a view on soundcloud callback
if (soundcloud.view !== undefined) {
callback = function() {
window.open(soundcloud.view.url);
};
soundcloud.view.callback = callback;
}
}
// add callbacks for duplicate menu items.
if (oItems.duplicate !== undefined) {
var url = oItems.duplicate.url;

View file

@ -16,15 +16,6 @@ var AIRTIME = (function (AIRTIME) {
var publishApp = angular.module(PUBLISH_APP_NAME, [])
.controller('Publish', function ($sce, $scope, $http, mediaId, tab) {
$scope.publishData = {};
var isAdmin = userType == 'A' || userType == 'S';
// Javascript enum containing source connection HTML strings (ie. Connect with SoundCloud button)
$scope.sourceConnectEnum = Object.freeze({
soundcloud: isAdmin ? $sce.trustAsHtml(
"<a href='" + baseUrl + "soundcloud/authorize' target='_blank'>" +
"<img src='http://connect.soundcloud.com/2/btn-connect-sc-l.png'>" +
"</a>"
) : $sce.trustAsHtml($.i18n._("Ask your station administrator to connect to SoundCloud."))
});
var sourceInterval;
tab.contents.on("click", "input[type='checkbox']", function () {
@ -84,11 +75,7 @@ var AIRTIME = (function (AIRTIME) {
var data = {};
jQuery.each($scope.publishData, function (k, v) {
if (v) {
if (k == "soundcloud") {
alert($.i18n._("Your track is being uploaded and will "
+ "appear on SoundCloud in a couple of minutes"));
}
data[k] = 'publish'; // FIXME: should be more robust
data[k] = 'publish'; // FIXME: should be more robust
}
});
@ -106,13 +93,10 @@ var AIRTIME = (function (AIRTIME) {
$scope.remove = function (source) {
var data = {};
data[source] = 'unpublish'; // FIXME: should be more robust
if (source != "soundcloud" || confirm($.i18n._("Are you sure? SoundCloud stats and comments "
+ "for this track will be permanently removed."))) {
$http.put(endpoint + mediaId + '/publish', {csrf_token: jQuery("#csrf").val(), sources: data})
.success(function () {
fetchSourceData();
});
}
$http.put(endpoint + mediaId + '/publish', {csrf_token: jQuery("#csrf").val(), sources: data})
.success(function () {
fetchSourceData();
});
};
$scope.discard = function () {

View file

@ -95,20 +95,6 @@ function setTuneInSettingsReadonly() {
}
}
function setSoundCloudSettingsListener() {
var connect = $("#SoundCloudConnect"),
disconnect = $("#SoundCloudDisconnect");
connect.click(function(e){
e.preventDefault();
window.location.replace(baseUrl + "soundcloud/authorize");
});
disconnect.click(function(e){
e.preventDefault();
window.location.replace(baseUrl + "soundcloud/deauthorize");
});
}
/*
* Enable/disable mail server authentication fields
*/
@ -208,5 +194,4 @@ $(document).ready(function() {
setEnableSystemEmailsListener();
setTuneInSettingsReadonly();
setTuneInSettingsListener();
setSoundCloudSettingsListener();
});

View file

@ -429,31 +429,6 @@ function getFullCalendarEvents(start, end, callback) {
//$("span.fc-button > :button").addClass("btn btn-small");
}
function checkSCUploadStatus() {
var url = baseUrl + 'Library/get-upload-to-soundcloud-status/format/json',
id;
$("span[class*=progress]").each(function () {
id = $(this).parents("div.fc-event").data("event").id;
$.post(url, { format: "json", id: id, type: "show" }, function (json) {
if (json.sc_id > 0) {
$(".fc-show-instance-" + id)
.find(".progress")
.removeClass("progress")
.addClass("soundcloud");
}
else if (json.sc_id == "-3") {
$(".fc-show-instance-" + id)
.find(".progress")
.removeClass("progress")
.addClass("sc-error");
}
setTimeout(checkSCUploadStatus, 5000);
});
});
}
/** This function adds and removes the current
* show icon
*/
@ -511,65 +486,6 @@ function addQtipsToIcons(ele, id) {
ready: true // Needed to make it show on first mouseover event
}
});
} else if ($(ele).hasClass("soundcloud")) {
$(ele).qtip({
content: {
text: $.i18n._("Retreiving data from the server..."),
ajax: {
url: baseUrl + "Library/get-upload-to-soundcloud-status",
type: "post",
data: ({ format: "json", id: id, type: "show" }),
success: function (json, status) {
this.set('content.text', $.i18n._("The soundcloud id for this file is: ") + json.sc_id);
}
}
},
position: {
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover event
}
});
} else if ($(ele).hasClass("sc-error")) {
$(ele).qtip({
content: {
text: $.i18n._("Retreiving data from the server..."),
ajax: {
url: baseUrl + "Library/get-upload-to-soundcloud-status",
type: "post",
data: ({ format: "json", id: id, type: "show" }),
success: function (json, status) {
this.set('content.text', $.i18n._("There was error while uploading to soundcloud.") + "<br>" + $.i18n._("Error code: ") + json.error_code +
"<br>" + $.i18n._("Error msg: ") + json.error_msg + "<br>");
}
}
},
position: {
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover event
}
});
} else if ($(ele).hasClass("show-empty")) {
$(ele).qtip({
content: {
@ -644,7 +560,6 @@ function alertShowErrorAndReload() {
$(document).ready(function () {
preloadEventFeed();
checkSCUploadStatus();
getCurrentShow();
});

View file

@ -48,34 +48,6 @@ function confirmCancelRecordedShow(show_instance_id){
}
}
function checkCalendarSCUploadStatus(){
var url = baseUrl+'Library/get-upload-to-soundcloud-status',
span,
id;
function checkSCUploadStatusCallback(json) {
if (json.sc_id > 0) {
span.removeClass("progress").addClass("soundcloud");
}
else if (json.sc_id == "-3") {
span.removeClass("progress").addClass("sc-error");
}
}
function checkSCUploadStatusRequest() {
span = $(this);
id = span.parents("div.fc-event").data("event").id;
$.post(url, {format: "json", id: id, type:"show"}, checkSCUploadStatusCallback);
}
$("#schedule_calendar span.progress").each(checkSCUploadStatusRequest);
setTimeout(checkCalendarSCUploadStatus, 5000);
}
function findViewportDimensions() {
var viewportwidth,
viewportheight;
@ -365,8 +337,6 @@ function alertShowErrorAndReload(){
$(document).ready(function() {
checkCalendarSCUploadStatus();
$.contextMenu({
selector: 'div.fc-event',
trigger: "left",