CC-5844: Airtime Analyzer: Auto format the 'year' tag.
This commit is contained in:
parent
0040965222
commit
691841eba4
|
@ -221,6 +221,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
|
||||
$requestData = json_decode($this->getRequest()->getRawBody(), true);
|
||||
$whiteList = $this->removeBlacklistedFieldsFromRequestData($requestData);
|
||||
$whiteList = $this->stripTimeStampFromYearTag($whiteList);
|
||||
|
||||
if (!$this->validateRequestData($file, $whiteList)) {
|
||||
$file->save();
|
||||
|
@ -486,5 +487,21 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
exec("find $path -empty -type d -delete");
|
||||
}
|
||||
|
||||
/*
|
||||
* It's possible that the year tag will be a timestamp but Airtime doesn't support this.
|
||||
* The year field in cc_files can only be 16 chars max.
|
||||
*
|
||||
* This functions strips the year field of it's timestamp, if one, and leaves just the year
|
||||
*/
|
||||
private function stripTimeStampFromYearTag($metadata)
|
||||
{
|
||||
if (isset($metadata["year"])) {
|
||||
if (preg_match("/^(\d{4})-(\d{2})-(\d{2})(?:\s+(\d{2}):(\d{2}):(\d{2}))?$/", $metadata["year"])) {
|
||||
$metadata["year"] = substr($metadata["year"], 0, 4);
|
||||
}
|
||||
}
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue