diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index 4b6ff1695..f498e8628 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -97,6 +97,10 @@ define('PROVISIONING_STATUS_ACTIVE' , 'Active'); //TuneIn integration 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 define('CELERY_PENDING_STATUS', 'PENDING'); define('CELERY_SUCCESS_STATUS', 'SUCCESS'); diff --git a/airtime_mvc/application/forms/SoundCloudPreferences.php b/airtime_mvc/application/forms/SoundCloudPreferences.php index 591e811e8..987244ced 100644 --- a/airtime_mvc/application/forms/SoundCloudPreferences.php +++ b/airtime_mvc/application/forms/SoundCloudPreferences.php @@ -14,8 +14,8 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm $select->setLabel(_('Default License:')); $select->setAttrib('class', 'input_select'); $select->setMultiOptions(array( - "no-rights-reserved" => _("The work is in the public domain"), "all-rights-reserved" => _("All rights are reserved"), + "no-rights-reserved" => _("The work is in the public domain"), "cc-by" => _("Creative Commons Attribution"), "cc-by-nc" => _("Creative Commons Attribution Noncommercial"), "cc-by-nd" => _("Creative Commons Attribution No Derivative Works"), diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index bc5746b8e..cbcd0491e 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -1452,7 +1452,9 @@ class Application_Model_Preference // SoundCloud 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) { @@ -1460,7 +1462,9 @@ class Application_Model_Preference } 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) { diff --git a/airtime_mvc/application/services/SoundcloudService.php b/airtime_mvc/application/services/SoundcloudService.php index 494eeaf29..8e946375e 100644 --- a/airtime_mvc/application/services/SoundcloudService.php +++ b/airtime_mvc/application/services/SoundcloudService.php @@ -69,7 +69,6 @@ class SoundcloudService extends ThirdPartyCeleryService implements OAuth2 { */ protected function _getUploadData($file) { $file = $file->getPropelOrm(); - // TODO: Move this into a proper serializer $trackArray = $this->_serializeTrack($file); foreach (self::$_SOUNDCLOUD_PREF_FUNCTIONS as $func => $param) { $val = Application_Model_Preference::$func(); @@ -87,15 +86,18 @@ class SoundcloudService extends ThirdPartyCeleryService implements OAuth2 { * Ignores any null fields, as these will cause the upload to throw a 422 * Unprocessable Entity error * + * TODO: Move this into a proper serializer + * * @param $file CcFiles file object * * @return array the serialized data */ protected function _serializeTrack($file) { $fileData = array( - 'title' => $file->getDbTrackTitle(), - 'genre' => $file->getDbGenre(), - 'bpm' => $file->getDbBpm(), + 'title' => $file->getDbTrackTitle(), + 'genre' => $file->getDbGenre(), + 'bpm' => $file->getDbBpm(), + 'release_year' => $file->getDbYear(), ); $trackArray = array(); foreach ($fileData as $k => $v) { @@ -108,6 +110,7 @@ class SoundcloudService extends ThirdPartyCeleryService implements OAuth2 { /** * Update a ThirdPartyTrackReferences object for a completed upload + * * TODO: should we have a database layer class to handle Propel operations? * * @param $trackId int ThirdPartyTrackReferences identifier