fix(soundcloud): remove broken integration
This commit is contained in:
parent
ecd302068c
commit
4c72403b9b
85 changed files with 133081 additions and 118229 deletions
|
@ -119,7 +119,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
if ($isAdminOrPM || $file->getFileOwnerId() == $user->getId()) {
|
||||
$menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."library/delete");
|
||||
$menu["edit"] = array("name"=> _("Edit..."), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}");
|
||||
$menu["publish"] = array("name"=> _("Publish..."), "icon" => "soundcloud", "url" => $baseUrl."library/publish/id/{$id}");
|
||||
$menu["publish"] = array("name"=> _("Publish..."), "url" => $baseUrl."library/publish/id/{$id}");
|
||||
}
|
||||
|
||||
// It's important that we always return the parent id (cc_files id)
|
||||
|
@ -129,27 +129,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
$url = $baseUrl."api/get-media/file/$id/download/true";
|
||||
$menu["download"] = array("name" => _("Download"), "icon" => "download", "url" => $url);
|
||||
|
||||
// SOUNDCLOUD MENU OPTION
|
||||
$ownerId = empty($obj) ? $file->getFileOwnerId() : $obj->getCreatorId();
|
||||
if ($isAdminOrPM || $ownerId == $user->getId()) {
|
||||
$soundcloudService = new Application_Service_SoundcloudService();
|
||||
if ($type === "audioclip" && $soundcloudService->hasAccessToken()) {
|
||||
$serviceId = $soundcloudService->getServiceId($id);
|
||||
if (!is_null($file) && $serviceId != 0) {
|
||||
$trackRef = ThirdPartyTrackReferencesQuery::create()
|
||||
->filterByDbService(SOUNDCLOUD_SERVICE_NAME)
|
||||
->findOneByDbFileId($id);
|
||||
|
||||
//create a menu separator
|
||||
$menu["sep1"] = "-----------";
|
||||
|
||||
//create a sub menu for Soundcloud actions.
|
||||
$menu["soundcloud"] = array("name" => _(SOUNDCLOUD), "icon" => "soundcloud", "items" => array());
|
||||
$menu["soundcloud"]["items"]["view"] = array("name" => _("View track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/view-on-sound-cloud/id/{$id}");
|
||||
$menu["soundcloud"]["items"]["update"] = array("name" => _("Update track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/update/id/{$trackRef->getDbForeignId()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($type === "playlist" || $type === "block") {
|
||||
if ($type === 'playlist') {
|
||||
$obj = new Application_Model_Playlist($id);
|
||||
|
|
|
@ -122,12 +122,6 @@ final class LocaleController extends Zend_Controller_Action
|
|||
"Import" => _("Import"),
|
||||
"Imported?" => _("Imported?"),
|
||||
"View" => _("View"),
|
||||
// SOUNDCLOUD
|
||||
"Are you sure? SoundCloud stats and comments for this track will be permanently removed." => "Are you sure? SoundCloud stats and comments for this track will be permanently removed.",
|
||||
"Your track is being deleted from SoundCloud" => "Your track is being deleted from SoundCloud",
|
||||
"Your track is being uploaded and will appear on SoundCloud in a couple of minutes" => "Your track is being uploaded and will appear on SoundCloud in a couple of minutes",
|
||||
"The soundcloud id for this file is: " => _("The soundcloud id for this file is: "),
|
||||
"There was an error while uploading to soundcloud." => _("There was an error while uploading to soundcloud."),
|
||||
"Error code: " => _("Error code: "),
|
||||
"Error msg: " => _("Error msg: "),
|
||||
"Input must be a positive number" => _("Input must be a positive number"),
|
||||
|
@ -229,11 +223,6 @@ final class LocaleController extends Zend_Controller_Action
|
|||
"60m" => _("60m"),
|
||||
"Uploading in progress..." => _("Uploading in progress..."),
|
||||
"Retreiving data from the server..." => _("Retreiving data from the server..."),
|
||||
//already in library/library.js
|
||||
//"The soundcloud id for this file is: " => _("The soundcloud id for this file is: "),
|
||||
//"There was error while uploading to soundcloud." => _("There was error while uploading to soundcloud."),
|
||||
//"Error code: " => _("Error code: "),
|
||||
//"Error msg: " => _("Error msg: "),
|
||||
"This show has no scheduled content." => _("This show has no scheduled content."),
|
||||
"This show is not completely filled with content." => _("This show is not completely filled with content."),
|
||||
//already in schedule/add-show.js
|
||||
|
|
|
@ -71,12 +71,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::setTuneinPartnerKey($values["tunein_partner_key"]);
|
||||
Application_Model_Preference::setTuneinPartnerId($values["tunein_partner_id"]);
|
||||
|
||||
// SoundCloud Preferences
|
||||
if (array_key_exists('SoundCloudLicense', $values)) {
|
||||
Application_Model_Preference::setDefaultSoundCloudLicenseType($values["SoundCloudLicense"]);
|
||||
Application_Model_Preference::setDefaultSoundCloudSharingType($values["SoundCloudSharing"]);
|
||||
}
|
||||
|
||||
$this->view->statusMsg = "<div class='success'>". _("Preferences updated.")."</div>";
|
||||
$form = new Application_Form_Preferences();
|
||||
$this->view->form = $form;
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
<?php
|
||||
|
||||
class SoundcloudController extends ThirdPartyController implements OAuth2Controller {
|
||||
|
||||
/**
|
||||
* @var Application_Service_SoundcloudService
|
||||
*/
|
||||
protected $_service;
|
||||
|
||||
/**
|
||||
* Set up SoundCloud access variables.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
parent::init();
|
||||
$this->_service = new Application_Service_SoundcloudService();
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload the file with the given id to SoundCloud
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if upload fails for any reason
|
||||
*/
|
||||
public function uploadAction() {
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$this->_service->upload($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the file with the given id on SoundCloud
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if upload fails for any reason
|
||||
*/
|
||||
public function updateAction() {
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$this->_service->update($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the file with the given id from SoundCloud
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if download fails for any reason
|
||||
*/
|
||||
public function downloadAction() {
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$this->_service->download($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the file with the given id from SoundCloud
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Zend_Controller_Response_Exception thrown if deletion fails for any reason
|
||||
*/
|
||||
public function deleteAction() {
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$this->_service->delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send user to SoundCloud to authorize before being redirected
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function authorizeAction() {
|
||||
$auth_url = $this->_service->getAuthorizeUrl();
|
||||
header('Location: ' . $auth_url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the previously saved request token from preferences
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deauthorizeAction() {
|
||||
Application_Model_Preference::setSoundCloudRequestToken("");
|
||||
header('Location: ' . $this->_baseUrl . 'preference'); // Redirect back to the preference page
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when user successfully completes SoundCloud authorization
|
||||
* Store the returned request token for future requests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function redirectAction() {
|
||||
$code = $_GET['code'];
|
||||
$this->_service->requestNewAccessToken($code);
|
||||
header('Location: ' . $this->_baseUrl . 'preference'); // Redirect back to the preference page
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the permalink to a file on SoundCloud and redirect to it.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function viewOnSoundCloudAction() {
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
try {
|
||||
$soundcloudLink = $this->_service->getLinkToFile($id);
|
||||
header('Location: ' . $soundcloudLink);
|
||||
} catch (Soundcloud\Exception\InvalidHttpResponseCodeException $e) {
|
||||
// Redirect to a 404 so the user knows something went wrong
|
||||
header('Location: ' . $this->_baseUrl . 'error/error-404');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
-- we can restore the schema here but you'll need to restore data from a backup
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_id INTEGER;
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_error_code INTEGER;
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_error_msg VARCHAR(512);
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_link_to_file VARCHAR(4096);
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_upload_time TIMESTAMP(6);
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE cc_files DROP COLUMN soundcloud_id;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_error_code;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_error_msg;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_link_to_file;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_upload_time;
|
Loading…
Add table
Add a link
Reference in a new issue