From 8432799b9a50e4221fd3fef4ee1b43980675d824 Mon Sep 17 00:00:00 2001 From: drigato Date: Thu, 22 May 2014 14:47:14 -0400 Subject: [PATCH 1/2] CC-5853: Tracks marked as 'hidden' won't be marked as unavailable in Now Playing page --- airtime_mvc/application/models/StoredFile.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 88bbf70c5..e30851e26 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -403,7 +403,8 @@ SQL; Logging::info("User ".$user->getLogin()." is deleting file: ".$this->_file->getDbTrackTitle()." - file id: ".$this->_file->getDbId()); // set hidden flag to true - $this->_file->setDbHidden(true); + //$this->_file->setDbHidden(true); + $this->_file->setDbFileExists(false); $this->_file->save(); // need to explicitly update any playlist's and block's length From 091be8cea31ec3c6f598a91fc1ad96c31ab01663 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Thu, 22 May 2014 18:40:05 -0400 Subject: [PATCH 2/2] SAAS-439: Genres longer than 64 characters cause Media API exception * Truncate the genre field in the Media API --- .../rest/controllers/MediaController.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/modules/rest/controllers/MediaController.php b/airtime_mvc/application/modules/rest/controllers/MediaController.php index dbe579606..7bbb3bc95 100644 --- a/airtime_mvc/application/modules/rest/controllers/MediaController.php +++ b/airtime_mvc/application/modules/rest/controllers/MediaController.php @@ -222,6 +222,7 @@ class Rest_MediaController extends Zend_Rest_Controller $requestData = json_decode($this->getRequest()->getRawBody(), true); $whiteList = $this->removeBlacklistedFieldsFromRequestData($requestData); $whiteList = $this->stripTimeStampFromYearTag($whiteList); + $whiteList = $this->truncateGenreTag($whiteList); if (!$this->validateRequestData($file, $whiteList)) { $file->save(); @@ -502,6 +503,20 @@ class Rest_MediaController extends Zend_Rest_Controller } return $metadata; } - + + /** The genre tag in our cc_files schema is currently a varchar(64). It's possible for MP3 genre tags + * to be longer than that, so we have to truncate longer genres. (We've seen ridiculously long genre tags.) + * @param string array $metadata + */ + private function truncateGenreTag($metadata) + { + if (isset($metadata["genre"])) + { + if (strlen($metadata["genre"]) >= 64) { + $metadata["genre"] = substr($metadata["genre"], 0, 64); + } + } + return $metadata; + } }