CC-1665: Scheduled stream rebroadcasting and recording

-capture stream mime type and store in db.
This commit is contained in:
Martin Konecny 2012-08-10 00:57:03 -04:00
parent 8eea34dc39
commit fe3f4ea678
10 changed files with 158 additions and 42 deletions

View file

@ -132,29 +132,19 @@ class ApiController extends Zend_Controller_Action
$file_base_name = substr($file_base_name, 1); $file_base_name = substr($file_base_name, 1);
} }
// possibly use fileinfo module here in the future.
// http://www.php.net/manual/en/book.fileinfo.php
$ext = pathinfo($file_base_name, PATHINFO_EXTENSION);
//Download user left clicks a track and selects Download. //Download user left clicks a track and selects Download.
if ("true" == $this->_getParam('download')) { if ("true" == $this->_getParam('download')) {
//path_info breaks up a file path into seperate pieces of informaiton. //path_info breaks up a file path into seperate pieces of informaiton.
//We just want the basename which is the file name with the path //We just want the basename which is the file name with the path
//information stripped away. We are using Content-Disposition to specify //information stripped away. We are using Content-Disposition to specify
//to the browser what name the file should be saved as. //to the browser what name the file should be saved as.
//
// By james.moon:
// I'm removing pathinfo() since it strips away UTF-8 characters.
// Using manualy parsing
header('Content-Disposition: attachment; filename="'.$file_base_name.'"'); header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
} else { } else {
//user clicks play button for track and downloads it. //user clicks play button for track and downloads it.
header('Content-Disposition: inline; filename="'.$file_base_name.'"'); header('Content-Disposition: inline; filename="'.$file_base_name.'"');
} }
if (strtolower($ext) === 'mp3') {
$this->smartReadFile($filepath, 'audio/mpeg'); $this->smartReadFile($filepath, $media->getPropelOrm()->getDbMime());
} else {
$this->smartReadFile($filepath, 'audio/'.$ext);
}
exit; exit;
} else { } else {
header ("HTTP/1.1 404 Not Found"); header ("HTTP/1.1 404 Not Found");

View file

@ -52,13 +52,8 @@ class WebstreamController extends Zend_Controller_Action
$hasPermission = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST)); $hasPermission = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST));
$id = $request->getParam("id"); $id = $request->getParam("id");
if ($id == -1) {
$webstream = new CcWebstream();
} else {
$webstream = CcWebstreamQuery::create()->findPK($id);
}
if ($id != -1) { if ($id != -1) {
$webstream = CcWebstreamQuery::create()->findPK($id);
//we are updating a playlist. Ensure that if the user is a host/dj, that he has the correct permission. //we are updating a playlist. Ensure that if the user is a host/dj, that he has the correct permission.
$user = Application_Model_User::getCurrentUser(); $user = Application_Model_User::getCurrentUser();
if ($webstream->getDbCreatorId() != $user->getId()) { if ($webstream->getDbCreatorId() != $user->getId()) {
@ -73,11 +68,14 @@ class WebstreamController extends Zend_Controller_Action
} }
$analysis = Application_Model_Webstream::analyzeFormData($request); $analysis = Application_Model_Webstream::analyzeFormData($request);
try {
if (Application_Model_Webstream::isValid($analysis)) { if (Application_Model_Webstream::isValid($analysis)) {
Application_Model_Webstream::save($request, $webstream); Application_Model_Webstream::save($request, $id);
$this->view->statusMessage = "<div class='success'>Webstream saved.</div>"; $this->view->statusMessage = "<div class='success'>Webstream saved.</div>";
} else { } else {
throw new Exception();
}
} catch (Exception $e) {
$this->view->statusMessage = "<div class='errors'>Invalid form values.</div>"; $this->view->statusMessage = "<div class='errors'>Invalid form values.</div>";
$this->view->analysis = $analysis; $this->view->analysis = $analysis;
} }

View file

@ -157,7 +157,7 @@ class Application_Model_Playlist
$files = array(); $files = array();
$sql = <<<SQL $sql = <<<SQL
(SELECT * SELECT *
FROM ( FROM (
(SELECT pc.id AS id, (SELECT pc.id AS id,
pc.type, pc.type,
@ -212,11 +212,11 @@ class Application_Model_Playlist
JOIN cc_subjs AS sbj ON bl.creator_id=sbj.id JOIN cc_subjs AS sbj ON bl.creator_id=sbj.id
WHERE pc.playlist_id = {$this->id} WHERE pc.playlist_id = {$this->id}
AND pc.TYPE = 2)) AS temp AND pc.TYPE = 2)) AS temp
ORDER BY temp.position); ORDER BY temp.position;
SQL; SQL;
$con = Propel::getConnection(); $con = Propel::getConnection();
$rows = $con->query($sql)->fetchAll(); $rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
$offset = 0; $offset = 0;
foreach ($rows as &$row) { foreach ($rows as &$row) {

View file

@ -22,6 +22,11 @@ class Application_Model_Webstream{
} }
} }
public function getOrm()
{
return $this->webstream;
}
public function getName() public function getName()
{ {
return $this->webstream->getDbName(); return $this->webstream->getDbName();
@ -151,7 +156,7 @@ class Application_Model_Webstream{
public static function isValid($analysis) public static function isValid($analysis)
{ {
foreach ($analysis as $k => $v) { foreach ($analysis as $k => $v) {
if ($v[0] == false) { if ($v[0] === false) {
return false; return false;
} }
} }
@ -159,7 +164,34 @@ class Application_Model_Webstream{
return true; return true;
} }
public static function save($request, $webstream) /*
* This function is a callback used by curl to let us work
* with the contents returned from an http request. We don't
* actually want to work with the contents however (we just want
* the response headers), so immediately return a -1 in this function
* which tells curl not to download the response body at all.
*/
private function writefn($ch, $chunk)
{
return -1;
}
private function discoverStreamMime()
{
Logging::log($this->webstream->getDbUrl());
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->webstream->getDbUrl());
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_WRITEFUNCTION, array($this, 'writefn'));
$result = curl_exec($ch);
$mime = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
curl_close($ch);
Logging::log($mime);
return $mime;
}
public static function save($request, $id)
{ {
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
@ -178,6 +210,10 @@ class Application_Model_Webstream{
} }
//$ws = new Application_Model_Webstream($id);
//$webstream = $ws->getOrm();
$webstream = new CcWebstream();
$webstream->setDbName($request->getParam("name")); $webstream->setDbName($request->getParam("name"));
$webstream->setDbDescription($request->getParam("description")); $webstream->setDbDescription($request->getParam("description"));
$webstream->setDbUrl($request->getParam("url")); $webstream->setDbUrl($request->getParam("url"));
@ -187,5 +223,15 @@ class Application_Model_Webstream{
$webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC'))); $webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC')));
$webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC'))); $webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC')));
$webstream->save(); $webstream->save();
$ws = new Application_Model_Webstream($webstream->getDbId());
$mime = $ws->discoverStreamMime();
if ($mime !== false) {
$webstream->setDbMime($mime);
} else {
throw new Exception("Couldn't get MIME type!");
}
$webstream->save();
} }
} }

View file

@ -46,6 +46,7 @@ class CcWebstreamTableMap extends TableMap {
$this->addColumn('CREATOR_ID', 'DbCreatorId', 'INTEGER', true, null, null); $this->addColumn('CREATOR_ID', 'DbCreatorId', 'INTEGER', true, null, null);
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', true, 6, null); $this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', true, 6, null);
$this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', true, 6, null); $this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', true, 6, null);
$this->addColumn('MIME', 'DbMime', 'VARCHAR', false, 255, null);
// validators // validators
} // initialize() } // initialize()

View file

@ -73,6 +73,12 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
*/ */
protected $utime; protected $utime;
/**
* The value for the mime field.
* @var string
*/
protected $mime;
/** /**
* @var array CcSchedule[] Collection to store aggregation of CcSchedule objects. * @var array CcSchedule[] Collection to store aggregation of CcSchedule objects.
*/ */
@ -239,6 +245,16 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
} }
} }
/**
* Get the [mime] column value.
*
* @return string
*/
public function getDbMime()
{
return $this->mime;
}
/** /**
* Set the value of [id] column. * Set the value of [id] column.
* *
@ -457,6 +473,26 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
return $this; return $this;
} // setDbUtime() } // setDbUtime()
/**
* Set the value of [mime] column.
*
* @param string $v new value
* @return CcWebstream The current object (for fluent API support)
*/
public function setDbMime($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->mime !== $v) {
$this->mime = $v;
$this->modifiedColumns[] = CcWebstreamPeer::MIME;
}
return $this;
} // setDbMime()
/** /**
* Indicates whether the columns in this object are only set to default values. * Indicates whether the columns in this object are only set to default values.
* *
@ -501,6 +537,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->creator_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; $this->creator_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
$this->mtime = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; $this->mtime = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
$this->utime = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; $this->utime = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$this->mime = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@ -509,7 +546,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 8; // 8 = CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS). return $startcol + 9; // 9 = CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating CcWebstream object", $e); throw new PropelException("Error populating CcWebstream object", $e);
@ -850,6 +887,9 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
case 7: case 7:
return $this->getDbUtime(); return $this->getDbUtime();
break; break;
case 8:
return $this->getDbMime();
break;
default: default:
return null; return null;
break; break;
@ -881,6 +921,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$keys[5] => $this->getDbCreatorId(), $keys[5] => $this->getDbCreatorId(),
$keys[6] => $this->getDbMtime(), $keys[6] => $this->getDbMtime(),
$keys[7] => $this->getDbUtime(), $keys[7] => $this->getDbUtime(),
$keys[8] => $this->getDbMime(),
); );
return $result; return $result;
} }
@ -936,6 +977,9 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
case 7: case 7:
$this->setDbUtime($value); $this->setDbUtime($value);
break; break;
case 8:
$this->setDbMime($value);
break;
} // switch() } // switch()
} }
@ -968,6 +1012,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
if (array_key_exists($keys[5], $arr)) $this->setDbCreatorId($arr[$keys[5]]); 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[6], $arr)) $this->setDbMtime($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setDbUtime($arr[$keys[7]]); if (array_key_exists($keys[7], $arr)) $this->setDbUtime($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setDbMime($arr[$keys[8]]);
} }
/** /**
@ -987,6 +1032,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::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::MTIME)) $criteria->add(CcWebstreamPeer::MTIME, $this->mtime);
if ($this->isColumnModified(CcWebstreamPeer::UTIME)) $criteria->add(CcWebstreamPeer::UTIME, $this->utime); if ($this->isColumnModified(CcWebstreamPeer::UTIME)) $criteria->add(CcWebstreamPeer::UTIME, $this->utime);
if ($this->isColumnModified(CcWebstreamPeer::MIME)) $criteria->add(CcWebstreamPeer::MIME, $this->mime);
return $criteria; return $criteria;
} }
@ -1055,6 +1101,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$copyObj->setDbCreatorId($this->creator_id); $copyObj->setDbCreatorId($this->creator_id);
$copyObj->setDbMtime($this->mtime); $copyObj->setDbMtime($this->mtime);
$copyObj->setDbUtime($this->utime); $copyObj->setDbUtime($this->utime);
$copyObj->setDbMime($this->mime);
if ($deepCopy) { if ($deepCopy) {
// important: temporarily setNew(false) because this affects the behavior of // important: temporarily setNew(false) because this affects the behavior of
@ -1284,6 +1331,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->creator_id = null; $this->creator_id = null;
$this->mtime = null; $this->mtime = null;
$this->utime = null; $this->utime = null;
$this->mime = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->alreadyInValidation = false; $this->alreadyInValidation = false;
$this->clearAllReferences(); $this->clearAllReferences();

View file

@ -26,7 +26,7 @@ abstract class BaseCcWebstreamPeer {
const TM_CLASS = 'CcWebstreamTableMap'; const TM_CLASS = 'CcWebstreamTableMap';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 8; const NUM_COLUMNS = 9;
/** The number of lazy-loaded columns. */ /** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0; const NUM_LAZY_LOAD_COLUMNS = 0;
@ -55,6 +55,9 @@ abstract class BaseCcWebstreamPeer {
/** the column name for the UTIME field */ /** the column name for the UTIME field */
const UTIME = 'cc_webstream.UTIME'; const UTIME = 'cc_webstream.UTIME';
/** the column name for the MIME field */
const MIME = 'cc_webstream.MIME';
/** /**
* An identiy map to hold any loaded instances of CcWebstream objects. * An identiy map to hold any loaded instances of CcWebstream objects.
* This must be public so that other peer classes can access this when hydrating from JOIN * This must be public so that other peer classes can access this when hydrating from JOIN
@ -71,12 +74,12 @@ abstract class BaseCcWebstreamPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
private static $fieldNames = array ( private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbDescription', 'DbUrl', 'DbLength', 'DbCreatorId', 'DbMtime', 'DbUtime', ), 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', ), 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, ), 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', ), 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', ), 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, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
); );
/** /**
@ -86,12 +89,12 @@ abstract class BaseCcWebstreamPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
private static $fieldKeys = array ( private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbDescription' => 2, 'DbUrl' => 3, 'DbLength' => 4, 'DbCreatorId' => 5, 'DbMtime' => 6, 'DbUtime' => 7, ), 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, ), 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, ), 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, ), 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, ), 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, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
); );
/** /**
@ -171,6 +174,7 @@ abstract class BaseCcWebstreamPeer {
$criteria->addSelectColumn(CcWebstreamPeer::CREATOR_ID); $criteria->addSelectColumn(CcWebstreamPeer::CREATOR_ID);
$criteria->addSelectColumn(CcWebstreamPeer::MTIME); $criteria->addSelectColumn(CcWebstreamPeer::MTIME);
$criteria->addSelectColumn(CcWebstreamPeer::UTIME); $criteria->addSelectColumn(CcWebstreamPeer::UTIME);
$criteria->addSelectColumn(CcWebstreamPeer::MIME);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.NAME'); $criteria->addSelectColumn($alias . '.NAME');
@ -180,6 +184,7 @@ abstract class BaseCcWebstreamPeer {
$criteria->addSelectColumn($alias . '.CREATOR_ID'); $criteria->addSelectColumn($alias . '.CREATOR_ID');
$criteria->addSelectColumn($alias . '.MTIME'); $criteria->addSelectColumn($alias . '.MTIME');
$criteria->addSelectColumn($alias . '.UTIME'); $criteria->addSelectColumn($alias . '.UTIME');
$criteria->addSelectColumn($alias . '.MIME');
} }
} }

View file

@ -14,6 +14,7 @@
* @method CcWebstreamQuery orderByDbCreatorId($order = Criteria::ASC) Order by the creator_id column * @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 orderByDbMtime($order = Criteria::ASC) Order by the mtime column
* @method CcWebstreamQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column * @method CcWebstreamQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
* @method CcWebstreamQuery orderByDbMime($order = Criteria::ASC) Order by the mime column
* *
* @method CcWebstreamQuery groupByDbId() Group by the id column * @method CcWebstreamQuery groupByDbId() Group by the id column
* @method CcWebstreamQuery groupByDbName() Group by the name column * @method CcWebstreamQuery groupByDbName() Group by the name column
@ -23,6 +24,7 @@
* @method CcWebstreamQuery groupByDbCreatorId() Group by the creator_id column * @method CcWebstreamQuery groupByDbCreatorId() Group by the creator_id column
* @method CcWebstreamQuery groupByDbMtime() Group by the mtime column * @method CcWebstreamQuery groupByDbMtime() Group by the mtime column
* @method CcWebstreamQuery groupByDbUtime() Group by the utime column * @method CcWebstreamQuery groupByDbUtime() Group by the utime column
* @method CcWebstreamQuery groupByDbMime() Group by the mime column
* *
* @method CcWebstreamQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcWebstreamQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcWebstreamQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method CcWebstreamQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@ -43,6 +45,7 @@
* @method CcWebstream findOneByDbCreatorId(int $creator_id) Return the first CcWebstream filtered by the creator_id column * @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 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 findOneByDbUtime(string $utime) Return the first CcWebstream filtered by the utime 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 * @method array findByDbId(int $id) Return CcWebstream objects filtered by the id column
* @method array findByDbName(string $name) Return CcWebstream objects filtered by the name column * @method array findByDbName(string $name) Return CcWebstream objects filtered by the name column
@ -52,6 +55,7 @@
* @method array findByDbCreatorId(int $creator_id) Return CcWebstream objects filtered by the creator_id column * @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 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 findByDbUtime(string $utime) Return CcWebstream objects filtered by the utime column
* @method array findByDbMime(string $mime) Return CcWebstream objects filtered by the mime column
* *
* @package propel.generator.airtime.om * @package propel.generator.airtime.om
*/ */
@ -359,6 +363,28 @@ abstract class BaseCcWebstreamQuery extends ModelCriteria
return $this->addUsingAlias(CcWebstreamPeer::UTIME, $dbUtime, $comparison); return $this->addUsingAlias(CcWebstreamPeer::UTIME, $dbUtime, $comparison);
} }
/**
* Filter the query on the mime column
*
* @param string $dbMime The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcWebstreamQuery The current query, for fluid interface
*/
public function filterByDbMime($dbMime = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($dbMime)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbMime)) {
$dbMime = str_replace('*', '%', $dbMime);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcWebstreamPeer::MIME, $dbMime, $comparison);
}
/** /**
* Filter the query by a related CcSchedule object * Filter the query by a related CcSchedule object
* *

View file

@ -422,5 +422,6 @@
<column name="creator_id" phpName="DbCreatorId" type="INTEGER" required="true" /> <column name="creator_id" phpName="DbCreatorId" type="INTEGER" required="true" />
<column name="mtime" phpName="DbMtime" type="TIMESTAMP" size="6" 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="utime" phpName="DbUtime" type="TIMESTAMP" size="6" required="true" />
<column name="mime" phpName="DbMime" type="VARCHAR" />
</table> </table>
</database> </database>

View file

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