feat: configure cue points analysis per track type

This commit is contained in:
jo 2023-02-10 22:55:54 +01:00 committed by Kyle Robbertze
parent 3a9ca109c3
commit f5e46c6f3d
22 changed files with 246 additions and 42 deletions

View file

@ -92,7 +92,8 @@ class Application_Model_RabbitMq
$tmpFilePath,
$importedStorageDirectory,
$originalFilename,
$fileId
$fileId,
$fileTrackTypeId
) {
$config = Config::getConfig();
@ -114,6 +115,15 @@ class Application_Model_RabbitMq
$data['import_directory'] = $importedStorageDirectory;
$data['original_filename'] = $originalFilename;
$options = [];
if ($fileTrackTypeId) {
$fileTrackType = new Application_Model_Tracktype($fileTrackTypeId);
$options['analyze_cue_points'] = $fileTrackType->getAnalyzeCuePoints();
}
$data['options'] = $options;
$jsonData = json_encode($data);
// self::sendMessage($exchange, 'topic', false, $jsonData, 'airtime-uploads');

View file

@ -46,6 +46,12 @@ class Application_Model_Tracktype
$tracktype->setDbVisibility($visibility);
}
public function setAnalyzeCuePoints($value)
{
$tracktype = $this->_tracktypeInstance;
$tracktype->setDbAnalyzeCuePoints($value);
}
public function getCode()
{
$tracktype = $this->_tracktypeInstance;
@ -74,6 +80,13 @@ class Application_Model_Tracktype
return $tracktype->getDbVisibility();
}
public function getAnalyzeCuePoints()
{
$tracktype = $this->_tracktypeInstance;
return $tracktype->getDbAnalyzeCuePoints();
}
public function save()
{
$this->_tracktypeInstance->save();
@ -162,7 +175,7 @@ class Application_Model_Tracktype
public static function getTracktypeData($id)
{
$sql = <<<'SQL'
SELECT code, type_name, description, visibility, id
SELECT code, type_name, description, visibility, id, analyze_cue_points
FROM cc_track_types
WHERE id = :id
SQL;

View file

@ -170,9 +170,10 @@ class CcFiles extends BaseCcFiles
Application_Service_MediaService::importFileToLibrary(
$file->getPrimaryKey(),
$filePath,
$originalFilename,
self::getOwnerId(),
$file->getDbTrackTypeId(),
$originalFilename,
$filePath,
$copyFile
);

View file

@ -44,6 +44,7 @@ class CcTracktypesTableMap extends TableMap
$this->addColumn('visibility', 'DbVisibility', 'BOOLEAN', true, null, true);
$this->addColumn('type_name', 'DbTypeName', 'VARCHAR', true, 64, '');
$this->addColumn('description', 'DbDescription', 'VARCHAR', true, 255, '');
$this->addColumn('analyze_cue_points', 'DbAnalyzeCuePoints', 'BOOLEAN', true, null, true);
// validators
} // initialize()

View file

@ -63,6 +63,13 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
*/
protected $description;
/**
* The value for the analyze_cue_points field.
* Note: this column has a database default value of: true
* @var boolean
*/
protected $analyze_cue_points;
/**
* @var PropelObjectCollection|CcFiles[] Collection to store aggregation of CcFiles objects.
*/
@ -107,6 +114,7 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
$this->visibility = true;
$this->type_name = '';
$this->description = '';
$this->analyze_cue_points = true;
}
/**
@ -174,6 +182,17 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
return $this->description;
}
/**
* Get the [analyze_cue_points] column value.
*
* @return boolean
*/
public function getDbAnalyzeCuePoints()
{
return $this->analyze_cue_points;
}
/**
* Set the value of [id] column.
*
@ -287,6 +306,35 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
return $this;
} // setDbDescription()
/**
* Sets the value of the [analyze_cue_points] column.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
*
* @param boolean|integer|string $v The new value
* @return CcTracktypes The current object (for fluent API support)
*/
public function setDbAnalyzeCuePoints($v)
{
if ($v !== null) {
if (is_string($v)) {
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
} else {
$v = (boolean) $v;
}
}
if ($this->analyze_cue_points !== $v) {
$this->analyze_cue_points = $v;
$this->modifiedColumns[] = CcTracktypesPeer::ANALYZE_CUE_POINTS;
}
return $this;
} // setDbAnalyzeCuePoints()
/**
* Indicates whether the columns in this object are only set to default values.
*
@ -313,6 +361,10 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
return false;
}
if ($this->analyze_cue_points !== true) {
return false;
}
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
@ -340,6 +392,7 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
$this->visibility = ($row[$startcol + 2] !== null) ? (boolean) $row[$startcol + 2] : null;
$this->type_name = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->analyze_cue_points = ($row[$startcol + 5] !== null) ? (boolean) $row[$startcol + 5] : null;
$this->resetModified();
$this->setNew(false);
@ -349,7 +402,7 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 5; // 5 = CcTracktypesPeer::NUM_HYDRATE_COLUMNS.
return $startcol + 6; // 6 = CcTracktypesPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating CcTracktypes object", $e);
@ -606,6 +659,9 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
if ($this->isColumnModified(CcTracktypesPeer::DESCRIPTION)) {
$modifiedColumns[':p' . $index++] = '"description"';
}
if ($this->isColumnModified(CcTracktypesPeer::ANALYZE_CUE_POINTS)) {
$modifiedColumns[':p' . $index++] = '"analyze_cue_points"';
}
$sql = sprintf(
'INSERT INTO "cc_track_types" (%s) VALUES (%s)',
@ -632,6 +688,9 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
case '"description"':
$stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
break;
case '"analyze_cue_points"':
$stmt->bindValue($identifier, $this->analyze_cue_points, PDO::PARAM_BOOL);
break;
}
}
$stmt->execute();
@ -782,6 +841,9 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
case 4:
return $this->getDbDescription();
break;
case 5:
return $this->getDbAnalyzeCuePoints();
break;
default:
return null;
break;
@ -816,6 +878,7 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
$keys[2] => $this->getDbVisibility(),
$keys[3] => $this->getDbTypeName(),
$keys[4] => $this->getDbDescription(),
$keys[5] => $this->getDbAnalyzeCuePoints(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@ -875,6 +938,9 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
case 4:
$this->setDbDescription($value);
break;
case 5:
$this->setDbAnalyzeCuePoints($value);
break;
} // switch()
}
@ -904,6 +970,7 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
if (array_key_exists($keys[2], $arr)) $this->setDbVisibility($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbTypeName($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbDescription($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbAnalyzeCuePoints($arr[$keys[5]]);
}
/**
@ -920,6 +987,7 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
if ($this->isColumnModified(CcTracktypesPeer::VISIBILITY)) $criteria->add(CcTracktypesPeer::VISIBILITY, $this->visibility);
if ($this->isColumnModified(CcTracktypesPeer::TYPE_NAME)) $criteria->add(CcTracktypesPeer::TYPE_NAME, $this->type_name);
if ($this->isColumnModified(CcTracktypesPeer::DESCRIPTION)) $criteria->add(CcTracktypesPeer::DESCRIPTION, $this->description);
if ($this->isColumnModified(CcTracktypesPeer::ANALYZE_CUE_POINTS)) $criteria->add(CcTracktypesPeer::ANALYZE_CUE_POINTS, $this->analyze_cue_points);
return $criteria;
}
@ -987,6 +1055,7 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
$copyObj->setDbVisibility($this->getDbVisibility());
$copyObj->setDbTypeName($this->getDbTypeName());
$copyObj->setDbDescription($this->getDbDescription());
$copyObj->setDbAnalyzeCuePoints($this->getDbAnalyzeCuePoints());
if ($deepCopy && !$this->startCopy) {
// important: temporarily setNew(false) because this affects the behavior of
@ -1352,6 +1421,7 @@ abstract class BaseCcTracktypes extends BaseObject implements Persistent
$this->visibility = null;
$this->type_name = null;
$this->description = null;
$this->analyze_cue_points = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;

View file

@ -24,13 +24,13 @@ abstract class BaseCcTracktypesPeer
const TM_CLASS = 'CcTracktypesTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 5;
const NUM_COLUMNS = 6;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 5;
const NUM_HYDRATE_COLUMNS = 6;
/** the column name for the id field */
const ID = 'cc_track_types.id';
@ -47,6 +47,9 @@ abstract class BaseCcTracktypesPeer
/** the column name for the description field */
const DESCRIPTION = 'cc_track_types.description';
/** the column name for the analyze_cue_points field */
const ANALYZE_CUE_POINTS = 'cc_track_types.analyze_cue_points';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
@ -66,12 +69,12 @@ abstract class BaseCcTracktypesPeer
* e.g. CcTracktypesPeer::$fieldNames[CcTracktypesPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbCode', 'DbVisibility', 'DbTypeName', 'DbDescription', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbCode', 'dbVisibility', 'dbTypeName', 'dbDescription', ),
BasePeer::TYPE_COLNAME => array (CcTracktypesPeer::ID, CcTracktypesPeer::CODE, CcTracktypesPeer::VISIBILITY, CcTracktypesPeer::TYPE_NAME, CcTracktypesPeer::DESCRIPTION, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', 'VISIBILITY', 'TYPE_NAME', 'DESCRIPTION', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'code', 'visibility', 'type_name', 'description', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbCode', 'DbVisibility', 'DbTypeName', 'DbDescription', 'DbAnalyzeCuePoints', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbCode', 'dbVisibility', 'dbTypeName', 'dbDescription', 'dbAnalyzeCuePoints', ),
BasePeer::TYPE_COLNAME => array (CcTracktypesPeer::ID, CcTracktypesPeer::CODE, CcTracktypesPeer::VISIBILITY, CcTracktypesPeer::TYPE_NAME, CcTracktypesPeer::DESCRIPTION, CcTracktypesPeer::ANALYZE_CUE_POINTS, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', 'VISIBILITY', 'TYPE_NAME', 'DESCRIPTION', 'ANALYZE_CUE_POINTS', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'code', 'visibility', 'type_name', 'description', 'analyze_cue_points', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
);
/**
@ -81,12 +84,12 @@ abstract class BaseCcTracktypesPeer
* e.g. CcTracktypesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbCode' => 1, 'DbVisibility' => 2, 'DbTypeName' => 3, 'DbDescription' => 4, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbCode' => 1, 'dbVisibility' => 2, 'dbTypeName' => 3, 'dbDescription' => 4, ),
BasePeer::TYPE_COLNAME => array (CcTracktypesPeer::ID => 0, CcTracktypesPeer::CODE => 1, CcTracktypesPeer::VISIBILITY => 2, CcTracktypesPeer::TYPE_NAME => 3, CcTracktypesPeer::DESCRIPTION => 4, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, 'VISIBILITY' => 2, 'TYPE_NAME' => 3, 'DESCRIPTION' => 4, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, 'visibility' => 2, 'type_name' => 3, 'description' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbCode' => 1, 'DbVisibility' => 2, 'DbTypeName' => 3, 'DbDescription' => 4, 'DbAnalyzeCuePoints' => 5, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbCode' => 1, 'dbVisibility' => 2, 'dbTypeName' => 3, 'dbDescription' => 4, 'dbAnalyzeCuePoints' => 5, ),
BasePeer::TYPE_COLNAME => array (CcTracktypesPeer::ID => 0, CcTracktypesPeer::CODE => 1, CcTracktypesPeer::VISIBILITY => 2, CcTracktypesPeer::TYPE_NAME => 3, CcTracktypesPeer::DESCRIPTION => 4, CcTracktypesPeer::ANALYZE_CUE_POINTS => 5, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, 'VISIBILITY' => 2, 'TYPE_NAME' => 3, 'DESCRIPTION' => 4, 'ANALYZE_CUE_POINTS' => 5, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, 'visibility' => 2, 'type_name' => 3, 'description' => 4, 'analyze_cue_points' => 5, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
);
/**
@ -165,12 +168,14 @@ abstract class BaseCcTracktypesPeer
$criteria->addSelectColumn(CcTracktypesPeer::VISIBILITY);
$criteria->addSelectColumn(CcTracktypesPeer::TYPE_NAME);
$criteria->addSelectColumn(CcTracktypesPeer::DESCRIPTION);
$criteria->addSelectColumn(CcTracktypesPeer::ANALYZE_CUE_POINTS);
} else {
$criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.code');
$criteria->addSelectColumn($alias . '.visibility');
$criteria->addSelectColumn($alias . '.type_name');
$criteria->addSelectColumn($alias . '.description');
$criteria->addSelectColumn($alias . '.analyze_cue_points');
}
}

View file

@ -11,12 +11,14 @@
* @method CcTracktypesQuery orderByDbVisibility($order = Criteria::ASC) Order by the visibility column
* @method CcTracktypesQuery orderByDbTypeName($order = Criteria::ASC) Order by the type_name column
* @method CcTracktypesQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
* @method CcTracktypesQuery orderByDbAnalyzeCuePoints($order = Criteria::ASC) Order by the analyze_cue_points column
*
* @method CcTracktypesQuery groupByDbId() Group by the id column
* @method CcTracktypesQuery groupByDbCode() Group by the code column
* @method CcTracktypesQuery groupByDbVisibility() Group by the visibility column
* @method CcTracktypesQuery groupByDbTypeName() Group by the type_name column
* @method CcTracktypesQuery groupByDbDescription() Group by the description column
* @method CcTracktypesQuery groupByDbAnalyzeCuePoints() Group by the analyze_cue_points column
*
* @method CcTracktypesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcTracktypesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@ -33,12 +35,14 @@
* @method CcTracktypes findOneByDbVisibility(boolean $visibility) Return the first CcTracktypes filtered by the visibility column
* @method CcTracktypes findOneByDbTypeName(string $type_name) Return the first CcTracktypes filtered by the type_name column
* @method CcTracktypes findOneByDbDescription(string $description) Return the first CcTracktypes filtered by the description column
* @method CcTracktypes findOneByDbAnalyzeCuePoints(boolean $analyze_cue_points) Return the first CcTracktypes filtered by the analyze_cue_points column
*
* @method array findByDbId(int $id) Return CcTracktypes objects filtered by the id column
* @method array findByDbCode(string $code) Return CcTracktypes objects filtered by the code column
* @method array findByDbVisibility(boolean $visibility) Return CcTracktypes objects filtered by the visibility column
* @method array findByDbTypeName(string $type_name) Return CcTracktypes objects filtered by the type_name column
* @method array findByDbDescription(string $description) Return CcTracktypes objects filtered by the description column
* @method array findByDbAnalyzeCuePoints(boolean $analyze_cue_points) Return CcTracktypes objects filtered by the analyze_cue_points column
*
* @package propel.generator.airtime.om
*/
@ -146,7 +150,7 @@ abstract class BaseCcTracktypesQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT "id", "code", "visibility", "type_name", "description" FROM "cc_track_types" WHERE "id" = :p0';
$sql = 'SELECT "id", "code", "visibility", "type_name", "description", "analyze_cue_points" FROM "cc_track_types" WHERE "id" = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@ -391,6 +395,33 @@ abstract class BaseCcTracktypesQuery extends ModelCriteria
return $this->addUsingAlias(CcTracktypesPeer::DESCRIPTION, $dbDescription, $comparison);
}
/**
* Filter the query on the analyze_cue_points column
*
* Example usage:
* <code>
* $query->filterByDbAnalyzeCuePoints(true); // WHERE analyze_cue_points = true
* $query->filterByDbAnalyzeCuePoints('yes'); // WHERE analyze_cue_points = true
* </code>
*
* @param boolean|string $dbAnalyzeCuePoints The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcTracktypesQuery The current query, for fluid interface
*/
public function filterByDbAnalyzeCuePoints($dbAnalyzeCuePoints = null, $comparison = null)
{
if (is_string($dbAnalyzeCuePoints)) {
$dbAnalyzeCuePoints = in_array(strtolower($dbAnalyzeCuePoints), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(CcTracktypesPeer::ANALYZE_CUE_POINTS, $dbAnalyzeCuePoints, $comparison);
}
/**
* Filter the query by a related CcFiles object
*