CC-1665: Scheduled stream rebroadcasting and recording

-improve working with "webstreams"
This commit is contained in:
Martin Konecny 2012-07-30 21:48:04 -04:00
parent 142aa214b3
commit 7e433b61fb
15 changed files with 167 additions and 74 deletions

View File

@ -36,7 +36,7 @@
<actionMethod actionName="delete"/>
<actionMethod actionName="contents"/>
<actionMethod actionName="editFileMd"/>
<actionMethod actionName="getFileMetaData"/>
<actionMethod actionName="getFileMetadata"/>
</controllerFile>
<controllerFile controllerName="Plupload">
<actionMethod actionName="index"/>
@ -304,7 +304,7 @@
<viewScriptFile forActionName="update"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Library">
<viewScriptFile forActionName="getFileMetaData"/>
<viewScriptFile forActionName="getFileMetadata"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Nowplaying">
<viewScriptFile forActionName="dayView"/>

View File

@ -17,7 +17,7 @@ class LibraryController extends Zend_Controller_Action
->addActionContext('delete', 'json')
->addActionContext('delete-group', 'json')
->addActionContext('context-menu', 'json')
->addActionContext('get-file-meta-data', 'html')
->addActionContext('get-file-metadata', 'html')
->addActionContext('upload-file-soundcloud', 'json')
->addActionContext('get-upload-to-soundcloud-status', 'json')
->addActionContext('set-num-entries', 'json')
@ -91,6 +91,24 @@ class LibraryController extends Zend_Controller_Action
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
}
} else if ($type == "stream") {
$obj = new Application_Model_Webstream($id);
if (isset($this->obj_sess->id) && $screen == "playlist") {
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
if ($this->obj_sess->type === "playlist") {
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
} else {
$menu["pl_add"] = array("name"=> "Add to Smart Playlist", "icon" => "add-playlist", "icon" => "copy");
}
}
}
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");
}
}
//SOUNDCLOUD MENU OPTIONS
@ -132,6 +150,7 @@ class LibraryController extends Zend_Controller_Action
$files = array();
$playlists = array();
$blocks = array();
$streams = array();
$message = null;
@ -143,20 +162,32 @@ class LibraryController extends Zend_Controller_Action
$playlists[] = intval($media["id"]);
} elseif ($media["type"] === "block") {
$blocks[] = intval($media["id"]);
} elseif ($media["type"] === "stream") {
$streams[] = intval($media["id"]);
}
}
try {
if ($media["type"] === "playlist") {
Application_Model_Playlist::deletePlaylists($playlists, $user->getId());
} elseif ($media["type"] === "block") {
Application_Model_Block::deleteBlocks($blocks, $user->getId());
}
Application_Model_Playlist::deletePlaylists($playlists, $user->getId());
} catch (PlaylistNoPermissionException $e) {
$this->view->message = "You don't have permission to delete selected items.";
return;
}
try {
Application_Model_Block::deleteBlocks($blocks, $user->getId());
} catch (Exception $e) {
//TODO: warn user that not all blocks could be deleted.
}
try {
Application_Model_Webstream::deleteStreams($streams, $user->getId());
} catch (Exception $e) {
//TODO: warn user that not all streams could be deleted.
Logging::log($e);
}
foreach ($files as $id) {
$file = Application_Model_StoredFile::Recall($id);
@ -164,9 +195,8 @@ class LibraryController extends Zend_Controller_Action
if (isset($file)) {
try {
$res = $file->delete(true);
}
//could throw a scheduled in future exception.
catch (Exception $e) {
} catch (Exception $e) {
//could throw a scheduled in future exception.
$message = "Could not delete some scheduled files.";
}
}
@ -241,7 +271,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->form = $form;
}
public function getFileMetaDataAction()
public function getFileMetadataAction()
{
$id = $this->_getParam('id');
$type = $this->_getParam('type');
@ -270,7 +300,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->md = $md;
} elseif ($type == "playlist") {
} else if ($type == "playlist") {
$file = new Application_Model_Playlist($id);
$this->view->type = $type;
@ -281,6 +311,13 @@ class LibraryController extends Zend_Controller_Action
$this->view->md = $md;
$this->view->contents = $file->getContents();
} else if ($type == "stream") {
$file = new Application_Model_Webstream($id);
$md = $file->getMetadata();
$this->view->md = $md;
$this->view->type = $type;
}
} catch (Exception $e) {
Logging::log($e->getMessage());

View File

@ -29,19 +29,12 @@ class WebstreamController extends Zend_Controller_Action
*/
}
public function saveAction(){
public function saveAction()
{
$request = $this->getRequest();
Application_Model_Webstream::save($request);
$this->view->x = "hi";
//http://localhost/Library/contents-feed
// 1) Create Propel object and save these parameters
// 2) Make these appear in the library
// 3) Make Web streams + playlists draggable.
// 4)
}
}

View File

@ -178,7 +178,7 @@ class Application_Model_Playlist
JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} AND type = 0)
UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
ws.id as item_id, (ws.name || ': ' || ws.url) as title, ws.login as creator, 't'::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc
ws.id as item_id, (ws.name || ': ' || ws.url) as title, ws.creator_id as creator, 't'::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc
JOIN cc_webstream AS ws on pc.stream_id=ws.id WHERE pc.playlist_id = {$this->id} AND type = 1)
UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,

View File

@ -621,7 +621,7 @@ class Application_Model_StoredFile
$plSelect[] = "login AS ".$key;
$blSelect[] = "login AS ".$key;
$fileSelect[] = $key;
$streamSelect[] = "login AS ".$key;
$streamSelect[] = "creator_id AS ".$key;
}
//same columns in each table.
else if (in_array($key, array("length", "utime", "mtime"))) {

View File

@ -2,6 +2,13 @@
class Application_Model_Webstream{
private $id;
public function __construct($id)
{
$this->id = $id;
}
public static function getName()
{
return "Default";
@ -27,6 +34,48 @@ class Application_Model_Webstream{
return "desc";
}
public function getMetadata()
{
$webstream = CcWebstreamQuery::create()->findPK($this->id);
$subjs = CcSubjsQuery::create()->findPK($webstream->getDbCreatorId());
$username = $subjs->getDbLogin();
return array(
"name" => $webstream->getDbName(),
"length" => $webstream->getDbLength(),
"description" => $webstream->getDbDescription(),
"login"=> $username,
"url" => $webstream->getDbUrl(),
);
}
public static function deleteStreams($p_ids, $p_userId)
{
$leftOver = self::streamsNotOwnedByUser($p_ids, $p_userId);
if (count($leftOver) == 0) {
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
} else {
throw new Exception("Invalid user permissions");
}
}
// This function returns that are not owen by $p_user_id among $p_ids
private static function streamsNotOwnedByUser($p_ids, $p_userId)
{
$ownedByUser = CcWebstreamQuery::create()->filterByDbCreatorId($p_userId)->find()->getData();
$ownedStreams = array();
foreach ($ownedByUser as $pl) {
if (in_array($pl->getDbId(), $p_ids)) {
$ownedStreams[] = $pl->getDbId();
}
}
$leftOvers = array_diff($p_ids, $ownedStreams);
return $leftOvers;
}
public static function save($request)
{
Logging::log($request->getParams());
@ -47,7 +96,7 @@ class Application_Model_Webstream{
$webstream->setDbUrl($request->getParam("url"));
$webstream->setDbLength($dblength);
$webstream->setDbLogin($userInfo->id);
$webstream->setDbCreatorId($userInfo->id);
$webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC')));
$webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC')));
$webstream->save();

View File

@ -43,7 +43,7 @@ class CcWebstreamTableMap extends TableMap {
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', true, 255, null);
$this->addColumn('URL', 'DbUrl', 'VARCHAR', true, 255, null);
$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', true, null, '00:00:00');
$this->addColumn('LOGIN', 'DbLogin', 'VARCHAR', true, 255, null);
$this->addColumn('CREATOR_ID', 'DbCreatorId', 'VARCHAR', true, 255, null);
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', true, 6, null);
$this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', true, 6, null);
// validators

View File

@ -56,10 +56,10 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
protected $length;
/**
* The value for the login field.
* The value for the creator_id field.
* @var string
*/
protected $login;
protected $creator_id;
/**
* The value for the mtime field.
@ -164,13 +164,13 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
}
/**
* Get the [login] column value.
* Get the [creator_id] column value.
*
* @return string
*/
public function getDbLogin()
public function getDbCreatorId()
{
return $this->login;
return $this->creator_id;
}
/**
@ -340,24 +340,24 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
} // setDbLength()
/**
* Set the value of [login] column.
* Set the value of [creator_id] column.
*
* @param string $v new value
* @return CcWebstream The current object (for fluent API support)
*/
public function setDbLogin($v)
public function setDbCreatorId($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->login !== $v) {
$this->login = $v;
$this->modifiedColumns[] = CcWebstreamPeer::LOGIN;
if ($this->creator_id !== $v) {
$this->creator_id = $v;
$this->modifiedColumns[] = CcWebstreamPeer::CREATOR_ID;
}
return $this;
} // setDbLogin()
} // setDbCreatorId()
/**
* Sets the value of [mtime] column to a normalized version of the date/time value specified.
@ -498,7 +498,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->url = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->length = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->login = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
$this->creator_id = ($row[$startcol + 5] !== null) ? (string) $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->resetModified();
@ -842,7 +842,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
return $this->getDbLength();
break;
case 5:
return $this->getDbLogin();
return $this->getDbCreatorId();
break;
case 6:
return $this->getDbMtime();
@ -878,7 +878,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$keys[2] => $this->getDbDescription(),
$keys[3] => $this->getDbUrl(),
$keys[4] => $this->getDbLength(),
$keys[5] => $this->getDbLogin(),
$keys[5] => $this->getDbCreatorId(),
$keys[6] => $this->getDbMtime(),
$keys[7] => $this->getDbUtime(),
);
@ -928,7 +928,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->setDbLength($value);
break;
case 5:
$this->setDbLogin($value);
$this->setDbCreatorId($value);
break;
case 6:
$this->setDbMtime($value);
@ -965,7 +965,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
if (array_key_exists($keys[2], $arr)) $this->setDbDescription($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbUrl($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbLength($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbLogin($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[7], $arr)) $this->setDbUtime($arr[$keys[7]]);
}
@ -984,7 +984,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
if ($this->isColumnModified(CcWebstreamPeer::DESCRIPTION)) $criteria->add(CcWebstreamPeer::DESCRIPTION, $this->description);
if ($this->isColumnModified(CcWebstreamPeer::URL)) $criteria->add(CcWebstreamPeer::URL, $this->url);
if ($this->isColumnModified(CcWebstreamPeer::LENGTH)) $criteria->add(CcWebstreamPeer::LENGTH, $this->length);
if ($this->isColumnModified(CcWebstreamPeer::LOGIN)) $criteria->add(CcWebstreamPeer::LOGIN, $this->login);
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);
@ -1052,7 +1052,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$copyObj->setDbDescription($this->description);
$copyObj->setDbUrl($this->url);
$copyObj->setDbLength($this->length);
$copyObj->setDbLogin($this->login);
$copyObj->setDbCreatorId($this->creator_id);
$copyObj->setDbMtime($this->mtime);
$copyObj->setDbUtime($this->utime);
@ -1281,7 +1281,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->description = null;
$this->url = null;
$this->length = null;
$this->login = null;
$this->creator_id = null;
$this->mtime = null;
$this->utime = null;
$this->alreadyInSave = false;

View File

@ -46,8 +46,8 @@ abstract class BaseCcWebstreamPeer {
/** the column name for the LENGTH field */
const LENGTH = 'cc_webstream.LENGTH';
/** the column name for the LOGIN field */
const LOGIN = 'cc_webstream.LOGIN';
/** the column name for the CREATOR_ID field */
const CREATOR_ID = 'cc_webstream.CREATOR_ID';
/** the column name for the MTIME field */
const MTIME = 'cc_webstream.MTIME';
@ -71,11 +71,11 @@ 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', 'DbLogin', 'DbMtime', 'DbUtime', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbDescription', 'dbUrl', 'dbLength', 'dbLogin', 'dbMtime', 'dbUtime', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::URL, self::LENGTH, self::LOGIN, self::MTIME, self::UTIME, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'DESCRIPTION', 'URL', 'LENGTH', 'LOGIN', 'MTIME', 'UTIME', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'url', 'length', 'login', 'mtime', 'utime', ),
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbDescription', 'DbUrl', 'DbLength', 'DbCreatorId', 'DbMtime', 'DbUtime', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbDescription', 'dbUrl', 'dbLength', 'dbCreatorId', 'dbMtime', 'dbUtime', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::URL, self::LENGTH, self::CREATOR_ID, self::MTIME, self::UTIME, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'DESCRIPTION', 'URL', 'LENGTH', 'CREATOR_ID', 'MTIME', 'UTIME', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'url', 'length', 'creator_id', 'mtime', 'utime', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
);
@ -86,11 +86,11 @@ 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, 'DbLogin' => 5, 'DbMtime' => 6, 'DbUtime' => 7, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbDescription' => 2, 'dbUrl' => 3, 'dbLength' => 4, 'dbLogin' => 5, 'dbMtime' => 6, 'dbUtime' => 7, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::URL => 3, self::LENGTH => 4, self::LOGIN => 5, self::MTIME => 6, self::UTIME => 7, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'DESCRIPTION' => 2, 'URL' => 3, 'LENGTH' => 4, 'LOGIN' => 5, 'MTIME' => 6, 'UTIME' => 7, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'url' => 3, 'length' => 4, 'login' => 5, 'mtime' => 6, 'utime' => 7, ),
BasePeer::TYPE_PHPNAME => 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, ),
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_RAW_COLNAME => 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, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
);
@ -168,7 +168,7 @@ abstract class BaseCcWebstreamPeer {
$criteria->addSelectColumn(CcWebstreamPeer::DESCRIPTION);
$criteria->addSelectColumn(CcWebstreamPeer::URL);
$criteria->addSelectColumn(CcWebstreamPeer::LENGTH);
$criteria->addSelectColumn(CcWebstreamPeer::LOGIN);
$criteria->addSelectColumn(CcWebstreamPeer::CREATOR_ID);
$criteria->addSelectColumn(CcWebstreamPeer::MTIME);
$criteria->addSelectColumn(CcWebstreamPeer::UTIME);
} else {
@ -177,7 +177,7 @@ abstract class BaseCcWebstreamPeer {
$criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.URL');
$criteria->addSelectColumn($alias . '.LENGTH');
$criteria->addSelectColumn($alias . '.LOGIN');
$criteria->addSelectColumn($alias . '.CREATOR_ID');
$criteria->addSelectColumn($alias . '.MTIME');
$criteria->addSelectColumn($alias . '.UTIME');
}

View File

@ -11,7 +11,7 @@
* @method CcWebstreamQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
* @method CcWebstreamQuery orderByDbUrl($order = Criteria::ASC) Order by the url column
* @method CcWebstreamQuery orderByDbLength($order = Criteria::ASC) Order by the length column
* @method CcWebstreamQuery orderByDbLogin($order = Criteria::ASC) Order by the login 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 orderByDbUtime($order = Criteria::ASC) Order by the utime column
*
@ -20,7 +20,7 @@
* @method CcWebstreamQuery groupByDbDescription() Group by the description column
* @method CcWebstreamQuery groupByDbUrl() Group by the url column
* @method CcWebstreamQuery groupByDbLength() Group by the length column
* @method CcWebstreamQuery groupByDbLogin() Group by the login column
* @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
*
@ -40,7 +40,7 @@
* @method CcWebstream findOneByDbDescription(string $description) Return the first CcWebstream filtered by the description column
* @method CcWebstream findOneByDbUrl(string $url) Return the first CcWebstream filtered by the url column
* @method CcWebstream findOneByDbLength(string $length) Return the first CcWebstream filtered by the length column
* @method CcWebstream findOneByDbLogin(string $login) Return the first CcWebstream filtered by the login column
* @method CcWebstream findOneByDbCreatorId(string $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
*
@ -49,7 +49,7 @@
* @method array findByDbDescription(string $description) Return CcWebstream objects filtered by the description column
* @method array findByDbUrl(string $url) Return CcWebstream objects filtered by the url column
* @method array findByDbLength(string $length) Return CcWebstream objects filtered by the length column
* @method array findByDbLogin(string $login) Return CcWebstream objects filtered by the login column
* @method array findByDbCreatorId(string $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
*
@ -267,25 +267,25 @@ abstract class BaseCcWebstreamQuery extends ModelCriteria
}
/**
* Filter the query on the login column
* Filter the query on the creator_id column
*
* @param string $dbLogin The value to use as filter.
* @param string $dbCreatorId 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 filterByDbLogin($dbLogin = null, $comparison = null)
public function filterByDbCreatorId($dbCreatorId = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($dbLogin)) {
if (is_array($dbCreatorId)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbLogin)) {
$dbLogin = str_replace('*', '%', $dbLogin);
} elseif (preg_match('/[\%\*]/', $dbCreatorId)) {
$dbCreatorId = str_replace('*', '%', $dbCreatorId);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcWebstreamPeer::LOGIN, $dbLogin, $comparison);
return $this->addUsingAlias(CcWebstreamPeer::CREATOR_ID, $dbCreatorId, $comparison);
}
/**

View File

@ -37,3 +37,14 @@
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if ($this->type == "stream") : ?>
<div><span>Name:</span><span><?php echo ($this->md["name"]);?></span></div>
<div><span>Length:</span><span><?php echo ($this->md["length"]);?></span></div>
<div><span>Creator:</span><span><?php echo ($this->md["login"]);?></span></div>
<div><span>Description:</span><span><?php echo ($this->md["description"]);?></span></div>
<div><span>URL:</span><span><?php echo ($this->md["url"]);?></span></div>
<?php endif; ?>

View File

@ -419,7 +419,7 @@
<column name="description" phpName="DbDescription" type="VARCHAR" size="255" required="true" />
<column name="url" phpName="DbUrl" type="VARCHAR" size="255" required="true" />
<column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" required="true" defaultValue="00:00:00"/>
<column name="login" phpName="DbLogin" type="VARCHAR" size="255" required="true" />
<column name="creator_id" phpName="DbCreatorId" type="VARCHAR" size="255" required="true" />
<column name="mtime" phpName="DbMtime" type="TIMESTAMP" size="6" required="true" />
<column name="utime" phpName="DbUtime" type="TIMESTAMP" size="6" required="true" />
</table>

View File

@ -635,7 +635,7 @@ CREATE TABLE "cc_webstream"
"description" VARCHAR(255) NOT NULL,
"url" VARCHAR(255) NOT NULL,
"length" interval default '00:00:00' NOT NULL,
"login" VARCHAR(255) NOT NULL,
"creator_id" VARCHAR(255) NOT NULL,
"mtime" TIMESTAMP(6) NOT NULL,
"utime" TIMESTAMP(6) NOT NULL,
PRIMARY KEY ("id")

View File

@ -464,7 +464,7 @@ var AIRTIME = (function(AIRTIME) {
text: aData.track_title
},
ajax: {
url: "/Library/get-file-meta-data",
url: "/Library/get-file-metadata",
type: "get",
data: ({format: "html", id : aData.id, type: aData.ftype}),
success: function(data, status) {
@ -614,6 +614,7 @@ var AIRTIME = (function(AIRTIME) {
}
else {
callback = function() {
//TODO
AIRTIME.playlist.fnEdit(data.id, data.ftype);
};
}

View File

@ -503,7 +503,9 @@ var AIRTIME = (function(AIRTIME){
$.post(url,
{format: "json", description: description, url:streamurl, length: length, name: name},
function(json){
console.log(json);
$("#side_playlist")
.empty()
.append("WHAT SHOULD I PUT HERE??!?!! :)");
/*
if (json.error !== undefined){