CC-4005: Tag files with Last Played date and number of times played

- done for files and webstreams
This commit is contained in:
James 2012-09-10 18:01:36 -04:00
parent dfb1ffed79
commit ba37bb4327
11 changed files with 219 additions and 35 deletions

View File

@ -346,7 +346,6 @@ class ApiController extends Zend_Controller_Action
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$schedule_group_id = $this->_getParam("schedule_id");
$media_id = $this->_getParam("media_id");
Logging::debug("Received notification of new media item start: $media_id");
$result = Application_Model_Schedule::UpdateMediaPlayedStatus($media_id);
@ -354,12 +353,26 @@ class ApiController extends Zend_Controller_Action
//set a 'last played' timestamp for media item
//needed for smart blocks
try {
$file_id = Application_Model_Schedule::GetFileId($media_id);
if (!is_null($file_id)) {
//we are dealing with a file not a stream
$file = Application_Model_StoredFile::Recall($file_id);
$now = new DateTime("now", new DateTimeZone("UTC"));
$file->setLastPlayedTime($now);
$mediaType = Application_Model_Schedule::GetType($media_id);
var_dump($mediaType);
if ($mediaType == 'file') {
$file_id = Application_Model_Schedule::GetFileId($media_id);
if (!is_null($file_id)) {
//we are dealing with a file not a stream
$file = Application_Model_StoredFile::Recall($file_id);
$now = new DateTime("now", new DateTimeZone("UTC"));
$file->setLastPlayedTime($now);
}
} else {
// webstream
$stream_id = Application_Model_Schedule::GetStreamId($media_id);
var_dump($stream_id);
if (!is_null($stream_id)) {
$webStream = new Application_Model_Webstream($stream_id);
var_dump($webStream);
$now = new DateTime("now", new DateTimeZone("UTC"));
$webStream->setLastPlayed($now);
}
}
} catch (Exception $e) {
Logging::info($e);
@ -689,7 +702,7 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$dir_id = $request->getParam('dir_id');
$this->view->files =
$this->view->files =
Application_Model_StoredFile::listAllFiles($dir_id,$all=true);
}

View File

@ -894,7 +894,7 @@ SQL;
new DateTimeZone(date_default_timezone_get()));
$start_dt->setTimezone(new DateTimeZone('UTC'));
$end_dt = new DateTime($data['add_show_end_date_no_repeat']." ".$data['add_show_end_time'],
$end_dt = new DateTime($data['add_show_end_date_no_repeat']." ".$data['add_show_end_time'],
new DateTimeZone(date_default_timezone_get()));
$end_dt->setTimezone(new DateTimeZone('UTC'));
@ -1159,10 +1159,26 @@ SQL;
return $overlapping;
}
public static function GetType($p_scheduleId){
$scheduledItem = CcScheduleQuery::create()->findPK($p_scheduleId);
if ($scheduledItem->getDbFileId() == null) {
return 'webstream';
} else {
return 'file';
}
}
public static function GetFileId($p_scheduleId)
{
$scheduledItem = CcScheduleQuery::create()->findPK($p_scheduleId);
return $scheduledItem->getDbFileId();
}
public static function GetStreamId($p_scheduleId)
{
$scheduledItem = CcScheduleQuery::create()->findPK($p_scheduleId);
return $scheduledItem->getDbStreamId();
}
}

View File

@ -652,7 +652,7 @@ class Application_Model_StoredFile
$displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length",
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
"bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime",
"language", "filepath", "owner", "conductor", "replay_gain"
"language", "filepath", "owner", "conductor", "replay_gain", "lptime"
);
//Logging::info($datatables);
@ -691,8 +691,13 @@ class Application_Model_StoredFile
} elseif ($key === "replay_gain") {
$plSelect[] = "NULL::NUMERIC AS ".$key;
$blSelect[] = "NULL::NUMERIC AS ".$key;
$fileSelect[] = "replay_gain AS $key";
$fileSelect[] = $key;
$streamSelect[] = "NULL::NUMERIC AS ".$key;
} elseif ($key === "lptime") {
$plSelect[] = "NULL::TIMESTAMP AS ".$key;
$blSelect[] = "NULL::TIMESTAMP AS ".$key;
$fileSelect[] = $key;
$streamSelect[] = $key;
}
//same columns in each table.
else if (in_array($key, array("length", "utime", "mtime"))) {

View File

@ -170,7 +170,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$valid['url'][1] = 'URL should be of form "http://domain"';
} elseif (strlen($url) > 512) {
$valid['url'][0] = false;
$valid['url'][1] = 'URL should be 512 characters or less';
$valid['url'][1] = 'URL should be 512 characters or less';
} else {
try {
@ -220,6 +220,12 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
{
}
public function setLastPlayed($timestamp)
{
$this->webstream->setDbLPtime($timestamp);
$this->webstream->save();
}
private static function getUrlData($url)
{
@ -242,7 +248,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
private static function getXspfUrl($url)
{
$content = self::getUrlData($url);
$content = self::getUrlData($url);
$dom = new DOMDocument;
//TODO: What if invalid xml?
@ -261,9 +267,9 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
private static function getPlsUrl($url)
{
$content = self::getUrlData($url);
$content = self::getUrlData($url);
$ini = parse_ini_string($content, true);
$ini = parse_ini_string($content, true);
if ($ini !== false && isset($ini["playlist"]) && isset($ini["playlist"]["File1"])) {
return $ini["playlist"]["File1"];
@ -274,7 +280,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
private static function getM3uUrl($url)
{
$content = self::getUrlData($url);
$content = self::getUrlData($url);
//split into lines:
$delim = "\n";

View File

@ -41,11 +41,12 @@ class CcWebstreamTableMap extends TableMap {
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, null);
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', true, 255, null);
$this->addColumn('URL', 'DbUrl', 'VARCHAR', true, 255, null);
$this->addColumn('URL', 'DbUrl', 'VARCHAR', true, 512, null);
$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', true, null, '00:00:00');
$this->addColumn('CREATOR_ID', 'DbCreatorId', 'INTEGER', true, null, null);
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', true, 6, null);
$this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', true, 6, null);
$this->addColumn('LPTIME', 'DbLPtime', 'TIMESTAMP', false, 6, null);
$this->addColumn('MIME', 'DbMime', 'VARCHAR', false, 255, null);
// validators
} // initialize()

View File

@ -73,6 +73,12 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
*/
protected $utime;
/**
* The value for the lptime field.
* @var string
*/
protected $lptime;
/**
* The value for the mime field.
* @var string
@ -245,6 +251,39 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
}
}
/**
* Get the [optionally formatted] temporal [lptime] column value.
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getDbLPtime($format = 'Y-m-d H:i:s')
{
if ($this->lptime === null) {
return null;
}
try {
$dt = new DateTime($this->lptime);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->lptime, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
}
/**
* Get the [mime] column value.
*
@ -473,6 +512,55 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
return $this;
} // setDbUtime()
/**
* Sets the value of [lptime] column to a normalized version of the date/time value specified.
*
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
* be treated as NULL for temporal objects.
* @return CcWebstream The current object (for fluent API support)
*/
public function setDbLPtime($v)
{
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
// -- which is unexpected, to say the least.
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
}
if ( $this->lptime !== null || $dt !== null ) {
// (nested ifs are a little easier to read in this case)
$currNorm = ($this->lptime !== null && $tmpDt = new DateTime($this->lptime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null;
$newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
)
{
$this->lptime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
$this->modifiedColumns[] = CcWebstreamPeer::LPTIME;
}
} // if either are not null
return $this;
} // setDbLPtime()
/**
* Set the value of [mime] column.
*
@ -537,7 +625,8 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->creator_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
$this->mtime = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
$this->utime = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$this->mime = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->lptime = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->mime = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
$this->resetModified();
$this->setNew(false);
@ -546,7 +635,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->ensureConsistency();
}
return $startcol + 9; // 9 = CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 10; // 10 = CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcWebstream object", $e);
@ -888,6 +977,9 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
return $this->getDbUtime();
break;
case 8:
return $this->getDbLPtime();
break;
case 9:
return $this->getDbMime();
break;
default:
@ -921,7 +1013,8 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$keys[5] => $this->getDbCreatorId(),
$keys[6] => $this->getDbMtime(),
$keys[7] => $this->getDbUtime(),
$keys[8] => $this->getDbMime(),
$keys[8] => $this->getDbLPtime(),
$keys[9] => $this->getDbMime(),
);
return $result;
}
@ -978,6 +1071,9 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->setDbUtime($value);
break;
case 8:
$this->setDbLPtime($value);
break;
case 9:
$this->setDbMime($value);
break;
} // switch()
@ -1012,7 +1108,8 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
if (array_key_exists($keys[5], $arr)) $this->setDbCreatorId($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setDbMtime($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setDbUtime($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setDbMime($arr[$keys[8]]);
if (array_key_exists($keys[8], $arr)) $this->setDbLPtime($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setDbMime($arr[$keys[9]]);
}
/**
@ -1032,6 +1129,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
if ($this->isColumnModified(CcWebstreamPeer::CREATOR_ID)) $criteria->add(CcWebstreamPeer::CREATOR_ID, $this->creator_id);
if ($this->isColumnModified(CcWebstreamPeer::MTIME)) $criteria->add(CcWebstreamPeer::MTIME, $this->mtime);
if ($this->isColumnModified(CcWebstreamPeer::UTIME)) $criteria->add(CcWebstreamPeer::UTIME, $this->utime);
if ($this->isColumnModified(CcWebstreamPeer::LPTIME)) $criteria->add(CcWebstreamPeer::LPTIME, $this->lptime);
if ($this->isColumnModified(CcWebstreamPeer::MIME)) $criteria->add(CcWebstreamPeer::MIME, $this->mime);
return $criteria;
@ -1101,6 +1199,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$copyObj->setDbCreatorId($this->creator_id);
$copyObj->setDbMtime($this->mtime);
$copyObj->setDbUtime($this->utime);
$copyObj->setDbLPtime($this->lptime);
$copyObj->setDbMime($this->mime);
if ($deepCopy) {
@ -1331,6 +1430,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->creator_id = null;
$this->mtime = null;
$this->utime = null;
$this->lptime = null;
$this->mime = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;

View File

@ -26,7 +26,7 @@ abstract class BaseCcWebstreamPeer {
const TM_CLASS = 'CcWebstreamTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 9;
const NUM_COLUMNS = 10;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@ -55,6 +55,9 @@ abstract class BaseCcWebstreamPeer {
/** the column name for the UTIME field */
const UTIME = 'cc_webstream.UTIME';
/** the column name for the LPTIME field */
const LPTIME = 'cc_webstream.LPTIME';
/** the column name for the MIME field */
const MIME = 'cc_webstream.MIME';
@ -74,12 +77,12 @@ abstract class BaseCcWebstreamPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbDescription', 'DbUrl', 'DbLength', 'DbCreatorId', 'DbMtime', 'DbUtime', 'DbMime', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbDescription', 'dbUrl', 'dbLength', 'dbCreatorId', 'dbMtime', 'dbUtime', 'dbMime', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::URL, self::LENGTH, self::CREATOR_ID, self::MTIME, self::UTIME, self::MIME, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'DESCRIPTION', 'URL', 'LENGTH', 'CREATOR_ID', 'MTIME', 'UTIME', 'MIME', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'url', 'length', 'creator_id', 'mtime', 'utime', 'mime', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbDescription', 'DbUrl', 'DbLength', 'DbCreatorId', 'DbMtime', 'DbUtime', 'DbLPtime', 'DbMime', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbDescription', 'dbUrl', 'dbLength', 'dbCreatorId', 'dbMtime', 'dbUtime', 'dbLPtime', 'dbMime', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::URL, self::LENGTH, self::CREATOR_ID, self::MTIME, self::UTIME, self::LPTIME, self::MIME, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'DESCRIPTION', 'URL', 'LENGTH', 'CREATOR_ID', 'MTIME', 'UTIME', 'LPTIME', 'MIME', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'url', 'length', 'creator_id', 'mtime', 'utime', 'lptime', 'mime', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
);
/**
@ -89,12 +92,12 @@ abstract class BaseCcWebstreamPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbDescription' => 2, 'DbUrl' => 3, 'DbLength' => 4, 'DbCreatorId' => 5, 'DbMtime' => 6, 'DbUtime' => 7, 'DbMime' => 8, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbDescription' => 2, 'dbUrl' => 3, 'dbLength' => 4, 'dbCreatorId' => 5, 'dbMtime' => 6, 'dbUtime' => 7, 'dbMime' => 8, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::URL => 3, self::LENGTH => 4, self::CREATOR_ID => 5, self::MTIME => 6, self::UTIME => 7, self::MIME => 8, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'DESCRIPTION' => 2, 'URL' => 3, 'LENGTH' => 4, 'CREATOR_ID' => 5, 'MTIME' => 6, 'UTIME' => 7, 'MIME' => 8, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'url' => 3, 'length' => 4, 'creator_id' => 5, 'mtime' => 6, 'utime' => 7, 'mime' => 8, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbDescription' => 2, 'DbUrl' => 3, 'DbLength' => 4, 'DbCreatorId' => 5, 'DbMtime' => 6, 'DbUtime' => 7, 'DbLPtime' => 8, 'DbMime' => 9, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbDescription' => 2, 'dbUrl' => 3, 'dbLength' => 4, 'dbCreatorId' => 5, 'dbMtime' => 6, 'dbUtime' => 7, 'dbLPtime' => 8, 'dbMime' => 9, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::URL => 3, self::LENGTH => 4, self::CREATOR_ID => 5, self::MTIME => 6, self::UTIME => 7, self::LPTIME => 8, self::MIME => 9, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'DESCRIPTION' => 2, 'URL' => 3, 'LENGTH' => 4, 'CREATOR_ID' => 5, 'MTIME' => 6, 'UTIME' => 7, 'LPTIME' => 8, 'MIME' => 9, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'url' => 3, 'length' => 4, 'creator_id' => 5, 'mtime' => 6, 'utime' => 7, 'lptime' => 8, 'mime' => 9, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
);
/**
@ -174,6 +177,7 @@ abstract class BaseCcWebstreamPeer {
$criteria->addSelectColumn(CcWebstreamPeer::CREATOR_ID);
$criteria->addSelectColumn(CcWebstreamPeer::MTIME);
$criteria->addSelectColumn(CcWebstreamPeer::UTIME);
$criteria->addSelectColumn(CcWebstreamPeer::LPTIME);
$criteria->addSelectColumn(CcWebstreamPeer::MIME);
} else {
$criteria->addSelectColumn($alias . '.ID');
@ -184,6 +188,7 @@ abstract class BaseCcWebstreamPeer {
$criteria->addSelectColumn($alias . '.CREATOR_ID');
$criteria->addSelectColumn($alias . '.MTIME');
$criteria->addSelectColumn($alias . '.UTIME');
$criteria->addSelectColumn($alias . '.LPTIME');
$criteria->addSelectColumn($alias . '.MIME');
}
}

View File

@ -14,6 +14,7 @@
* @method CcWebstreamQuery orderByDbCreatorId($order = Criteria::ASC) Order by the creator_id column
* @method CcWebstreamQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column
* @method CcWebstreamQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
* @method CcWebstreamQuery orderByDbLPtime($order = Criteria::ASC) Order by the lptime column
* @method CcWebstreamQuery orderByDbMime($order = Criteria::ASC) Order by the mime column
*
* @method CcWebstreamQuery groupByDbId() Group by the id column
@ -24,6 +25,7 @@
* @method CcWebstreamQuery groupByDbCreatorId() Group by the creator_id column
* @method CcWebstreamQuery groupByDbMtime() Group by the mtime column
* @method CcWebstreamQuery groupByDbUtime() Group by the utime column
* @method CcWebstreamQuery groupByDbLPtime() Group by the lptime column
* @method CcWebstreamQuery groupByDbMime() Group by the mime column
*
* @method CcWebstreamQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
@ -45,6 +47,7 @@
* @method CcWebstream findOneByDbCreatorId(int $creator_id) Return the first CcWebstream filtered by the creator_id column
* @method CcWebstream findOneByDbMtime(string $mtime) Return the first CcWebstream filtered by the mtime column
* @method CcWebstream findOneByDbUtime(string $utime) Return the first CcWebstream filtered by the utime column
* @method CcWebstream findOneByDbLPtime(string $lptime) Return the first CcWebstream filtered by the lptime column
* @method CcWebstream findOneByDbMime(string $mime) Return the first CcWebstream filtered by the mime column
*
* @method array findByDbId(int $id) Return CcWebstream objects filtered by the id column
@ -55,6 +58,7 @@
* @method array findByDbCreatorId(int $creator_id) Return CcWebstream objects filtered by the creator_id column
* @method array findByDbMtime(string $mtime) Return CcWebstream objects filtered by the mtime column
* @method array findByDbUtime(string $utime) Return CcWebstream objects filtered by the utime column
* @method array findByDbLPtime(string $lptime) Return CcWebstream objects filtered by the lptime column
* @method array findByDbMime(string $mime) Return CcWebstream objects filtered by the mime column
*
* @package propel.generator.airtime.om
@ -363,6 +367,37 @@ abstract class BaseCcWebstreamQuery extends ModelCriteria
return $this->addUsingAlias(CcWebstreamPeer::UTIME, $dbUtime, $comparison);
}
/**
* Filter the query on the lptime column
*
* @param string|array $dbLPtime The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcWebstreamQuery The current query, for fluid interface
*/
public function filterByDbLPtime($dbLPtime = null, $comparison = null)
{
if (is_array($dbLPtime)) {
$useMinMax = false;
if (isset($dbLPtime['min'])) {
$this->addUsingAlias(CcWebstreamPeer::LPTIME, $dbLPtime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbLPtime['max'])) {
$this->addUsingAlias(CcWebstreamPeer::LPTIME, $dbLPtime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcWebstreamPeer::LPTIME, $dbLPtime, $comparison);
}
/**
* Filter the query on the mime column
*

View File

@ -425,6 +425,7 @@
<column name="creator_id" phpName="DbCreatorId" type="INTEGER" required="true" />
<column name="mtime" phpName="DbMtime" type="TIMESTAMP" size="6" required="true" />
<column name="utime" phpName="DbUtime" type="TIMESTAMP" size="6" required="true" />
<column name="lptime" phpName="DbLPtime" type="TIMESTAMP" size="6" required="false"/>
<column name="mime" phpName="DbMime" type="VARCHAR" />
</table>
<table name="cc_webstream_metadata" phpName="CcWebstreamMetadata">

View File

@ -638,6 +638,7 @@ CREATE TABLE "cc_webstream"
"creator_id" INTEGER NOT NULL,
"mtime" TIMESTAMP(6) NOT NULL,
"utime" TIMESTAMP(6) NOT NULL,
"lptime" TIMESTAMP(6),
"mime" VARCHAR(255),
PRIMARY KEY ("id")
);

View File

@ -400,7 +400,8 @@ var AIRTIME = (function(AIRTIME) {
/* Year */ { "sTitle" : "Year" , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" } ,
/* Length */ { "sTitle" : "Length" , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" } ,
/* Upload Time */ { "sTitle" : "Uploaded" , "mDataProp" : "utime" , "sClass" : "library_upload_time" , "sWidth" : "125px" } ,
/* Last Modified */ { "sTitle" : "Last Modified" , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" } ,
/* Last Modified */ { "sTitle" : "Last Modified" , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" } ,
/* Last Played */ { "sTitle" : "Last Played " , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" } ,
/* Track Number */ { "sTitle" : "Track" , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "65px" } ,
/* Mood */ { "sTitle" : "Mood" , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" } ,
/* BPM */ { "sTitle" : "BPM" , "mDataProp" : "bpm" , "bVisible" : false , "sClass" : "library_bpm" , "sWidth" : "50px" } ,