SoundCloud - Add release_year metadata field and set default sharing and license types
This commit is contained in:
parent
67155b136a
commit
d91b05a0ae
4 changed files with 18 additions and 7 deletions
|
@ -97,6 +97,10 @@ define('PROVISIONING_STATUS_ACTIVE' , 'Active');
|
||||||
//TuneIn integration
|
//TuneIn integration
|
||||||
define("TUNEIN_API_URL", "http://air.radiotime.com/Playing.ashx");
|
define("TUNEIN_API_URL", "http://air.radiotime.com/Playing.ashx");
|
||||||
|
|
||||||
|
// SoundCloud
|
||||||
|
define('DEFAULT_SOUNDCLOUD_LICENSE_TYPE', 'all-rights-reserved');
|
||||||
|
define('DEFAULT_SOUNDCLOUD_SHARING_TYPE', 'public');
|
||||||
|
|
||||||
// Celery
|
// Celery
|
||||||
define('CELERY_PENDING_STATUS', 'PENDING');
|
define('CELERY_PENDING_STATUS', 'PENDING');
|
||||||
define('CELERY_SUCCESS_STATUS', 'SUCCESS');
|
define('CELERY_SUCCESS_STATUS', 'SUCCESS');
|
||||||
|
|
|
@ -14,8 +14,8 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
||||||
$select->setLabel(_('Default License:'));
|
$select->setLabel(_('Default License:'));
|
||||||
$select->setAttrib('class', 'input_select');
|
$select->setAttrib('class', 'input_select');
|
||||||
$select->setMultiOptions(array(
|
$select->setMultiOptions(array(
|
||||||
"no-rights-reserved" => _("The work is in the public domain"),
|
|
||||||
"all-rights-reserved" => _("All rights are reserved"),
|
"all-rights-reserved" => _("All rights are reserved"),
|
||||||
|
"no-rights-reserved" => _("The work is in the public domain"),
|
||||||
"cc-by" => _("Creative Commons Attribution"),
|
"cc-by" => _("Creative Commons Attribution"),
|
||||||
"cc-by-nc" => _("Creative Commons Attribution Noncommercial"),
|
"cc-by-nc" => _("Creative Commons Attribution Noncommercial"),
|
||||||
"cc-by-nd" => _("Creative Commons Attribution No Derivative Works"),
|
"cc-by-nd" => _("Creative Commons Attribution No Derivative Works"),
|
||||||
|
|
|
@ -1452,7 +1452,9 @@ class Application_Model_Preference
|
||||||
// SoundCloud
|
// SoundCloud
|
||||||
|
|
||||||
public static function getDefaultSoundCloudLicenseType() {
|
public static function getDefaultSoundCloudLicenseType() {
|
||||||
return self::getValue("soundcloud_license_type");
|
$val = self::getValue("soundcloud_license_type");
|
||||||
|
// If we don't have a value set, return all-rights-reserved by default
|
||||||
|
return empty($val) ? DEFAULT_SOUNDCLOUD_LICENSE_TYPE : $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setDefaultSoundCloudLicenseType($value) {
|
public static function setDefaultSoundCloudLicenseType($value) {
|
||||||
|
@ -1460,7 +1462,9 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDefaultSoundCloudSharingType() {
|
public static function getDefaultSoundCloudSharingType() {
|
||||||
return self::getValue("soundcloud_sharing_type");
|
$val = self::getValue("soundcloud_sharing_type");
|
||||||
|
// If we don't have a value set, return public by default
|
||||||
|
return empty($val) ? DEFAULT_SOUNDCLOUD_SHARING_TYPE : $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setDefaultSoundCloudSharingType($value) {
|
public static function setDefaultSoundCloudSharingType($value) {
|
||||||
|
|
|
@ -69,7 +69,6 @@ class SoundcloudService extends ThirdPartyCeleryService implements OAuth2 {
|
||||||
*/
|
*/
|
||||||
protected function _getUploadData($file) {
|
protected function _getUploadData($file) {
|
||||||
$file = $file->getPropelOrm();
|
$file = $file->getPropelOrm();
|
||||||
// TODO: Move this into a proper serializer
|
|
||||||
$trackArray = $this->_serializeTrack($file);
|
$trackArray = $this->_serializeTrack($file);
|
||||||
foreach (self::$_SOUNDCLOUD_PREF_FUNCTIONS as $func => $param) {
|
foreach (self::$_SOUNDCLOUD_PREF_FUNCTIONS as $func => $param) {
|
||||||
$val = Application_Model_Preference::$func();
|
$val = Application_Model_Preference::$func();
|
||||||
|
@ -87,6 +86,8 @@ class SoundcloudService extends ThirdPartyCeleryService implements OAuth2 {
|
||||||
* Ignores any null fields, as these will cause the upload to throw a 422
|
* Ignores any null fields, as these will cause the upload to throw a 422
|
||||||
* Unprocessable Entity error
|
* Unprocessable Entity error
|
||||||
*
|
*
|
||||||
|
* TODO: Move this into a proper serializer
|
||||||
|
*
|
||||||
* @param $file CcFiles file object
|
* @param $file CcFiles file object
|
||||||
*
|
*
|
||||||
* @return array the serialized data
|
* @return array the serialized data
|
||||||
|
@ -96,6 +97,7 @@ class SoundcloudService extends ThirdPartyCeleryService implements OAuth2 {
|
||||||
'title' => $file->getDbTrackTitle(),
|
'title' => $file->getDbTrackTitle(),
|
||||||
'genre' => $file->getDbGenre(),
|
'genre' => $file->getDbGenre(),
|
||||||
'bpm' => $file->getDbBpm(),
|
'bpm' => $file->getDbBpm(),
|
||||||
|
'release_year' => $file->getDbYear(),
|
||||||
);
|
);
|
||||||
$trackArray = array();
|
$trackArray = array();
|
||||||
foreach ($fileData as $k => $v) {
|
foreach ($fileData as $k => $v) {
|
||||||
|
@ -108,6 +110,7 @@ class SoundcloudService extends ThirdPartyCeleryService implements OAuth2 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a ThirdPartyTrackReferences object for a completed upload
|
* Update a ThirdPartyTrackReferences object for a completed upload
|
||||||
|
*
|
||||||
* TODO: should we have a database layer class to handle Propel operations?
|
* TODO: should we have a database layer class to handle Propel operations?
|
||||||
*
|
*
|
||||||
* @param $trackId int ThirdPartyTrackReferences identifier
|
* @param $trackId int ThirdPartyTrackReferences identifier
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue