Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
4009ae741f
14 changed files with 213 additions and 166 deletions
|
@ -944,7 +944,7 @@ EOT;
|
|||
if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
|
||||
$error[] = "Limit cannot be empty or smaller than 0";
|
||||
} else {
|
||||
$mins = $data['etc']['sp_limit_value'] * $multiplier;
|
||||
$mins = floatval($data['etc']['sp_limit_value']) * $multiplier;
|
||||
if ($mins > 1440) {
|
||||
$error[] = "Limit cannot be more than 24 hrs";
|
||||
}
|
||||
|
@ -1335,7 +1335,7 @@ EOT;
|
|||
$limits['time'] = 1440 * 60;
|
||||
$limits['items'] = $storedCrit['limit']['value'];
|
||||
} else {
|
||||
$limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval($storedCrit['limit']['value']) * 60 * 60 : intval($storedCrit['limit']['value'] * 60);
|
||||
$limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval(floatval($storedCrit['limit']['value']) * 60 * 60) : intval($storedCrit['limit']['value'] * 60);
|
||||
$limits['items'] = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,40 +154,67 @@ class Application_Model_Playlist
|
|||
public function getContents($filterFiles=false)
|
||||
{
|
||||
Logging::log("Getting contents for playlist {$this->id}");
|
||||
|
||||
$files = array();
|
||||
/*
|
||||
$query = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id);
|
||||
|
||||
if ($filterFiles) {
|
||||
$query->useCcFilesQuery()
|
||||
->filterByDbFileExists(true)
|
||||
->endUse();
|
||||
}
|
||||
$query->orderByDbPosition()
|
||||
->filterByDbType(0)
|
||||
->leftJoinWith('CcFiles');
|
||||
$rows = $query->find($this->con);
|
||||
*/
|
||||
$sql = <<<"EOT"
|
||||
(SELECT * FROM
|
||||
((SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
|
||||
f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_playlistcontents AS pc
|
||||
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, sub.login 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
|
||||
LEFT JOIN cc_subjs as sub on sub.id = ws.creator_id
|
||||
WHERE pc.playlist_id = {$this->id} AND pc.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,
|
||||
bl.id as item_id, bl.name as title, sbj.login as creator, 't'::boolean as exists, NULL::text as path FROM cc_playlistcontents AS pc
|
||||
JOIN cc_block AS bl on pc.block_id=bl.id
|
||||
JOIN cc_subjs as sbj ON bl.creator_id=sbj.id WHERE pc.playlist_id = {$this->id} AND pc.type = 2)) as temp
|
||||
ORDER BY temp.position);
|
||||
EOT;
|
||||
$sql = <<<SQL
|
||||
(SELECT *
|
||||
FROM (
|
||||
(SELECT pc.id AS id,
|
||||
pc.type,
|
||||
pc.position,
|
||||
pc.cliplength AS LENGTH,
|
||||
pc.cuein,
|
||||
pc.cueout,
|
||||
pc.fadein,
|
||||
pc.fadeout,
|
||||
f.id AS item_id,
|
||||
f.track_title,
|
||||
f.artist_name AS creator,
|
||||
f.file_exists AS EXISTS,
|
||||
f.filepath AS path
|
||||
FROM cc_playlistcontents AS pc
|
||||
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,
|
||||
sub.login 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
|
||||
LEFT JOIN cc_subjs AS sub ON sub.id = ws.creator_id
|
||||
WHERE pc.playlist_id = {$this->id}
|
||||
AND pc.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,
|
||||
bl.id AS item_id,
|
||||
bl.name AS title,
|
||||
sbj.login AS creator,
|
||||
't'::boolean AS EXISTS,
|
||||
NULL::text AS path
|
||||
FROM cc_playlistcontents AS pc
|
||||
JOIN cc_block AS bl ON pc.block_id=bl.id
|
||||
JOIN cc_subjs AS sbj ON bl.creator_id=sbj.id
|
||||
WHERE pc.playlist_id = {$this->id}
|
||||
AND pc.TYPE = 2)) AS temp
|
||||
ORDER BY temp.position);
|
||||
SQL;
|
||||
|
||||
$con = Propel::getConnection();
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
|
||||
|
@ -198,7 +225,7 @@ EOT;
|
|||
$offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset);
|
||||
|
||||
//format the length for UI.
|
||||
if ($row['type'] == 2){
|
||||
if ($row['type'] == 2) {
|
||||
$bl = new Application_Model_Block($row['item_id']);
|
||||
$formatter = new LengthFormatter($bl->getFormattedLength());
|
||||
} else {
|
||||
|
@ -210,28 +237,6 @@ EOT;
|
|||
$row['offset'] = $formatter->format();
|
||||
}
|
||||
|
||||
/*
|
||||
$i = 0;
|
||||
$offset = 0;
|
||||
foreach ($rows as $row) {
|
||||
Logging::log($row);
|
||||
$files[$i] = $row->toArray(BasePeer::TYPE_FIELDNAME, true, true);
|
||||
|
||||
$clipSec = Application_Common_DateHelper::playlistTimeToSeconds($files[$i]['cliplength']);
|
||||
$offset += $clipSec;
|
||||
$offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset);
|
||||
|
||||
//format the length for UI.
|
||||
$formatter = new LengthFormatter($files[$i]['cliplength']);
|
||||
$files[$i]['cliplength'] = $formatter->format();
|
||||
|
||||
$formatter = new LengthFormatter($offset_cliplength);
|
||||
$files[$i]['offset'] = $formatter->format();
|
||||
|
||||
$i++;
|
||||
}
|
||||
*/
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
|
|
@ -648,14 +648,39 @@ class Application_Model_ShowInstance
|
|||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM (cc_schedule AS s LEFT JOIN cc_files AS f ON f.id = s.file_id)
|
||||
WHERE s.instance_id = '{$this->_instanceId}' AND s.playout_status >= 0
|
||||
ORDER BY starts";
|
||||
$sql = <<<SQL
|
||||
SELECT *
|
||||
FROM (
|
||||
(SELECT s.starts,
|
||||
0::INTEGER as type ,
|
||||
f.id AS item_id,
|
||||
f.track_title,
|
||||
f.artist_name AS creator,
|
||||
f.file_exists AS EXISTS,
|
||||
f.filepath AS filepath
|
||||
FROM cc_schedule AS s
|
||||
LEFT JOIN cc_files AS f ON f.id = s.file_id
|
||||
WHERE s.instance_id = '{$this->_instanceId}'
|
||||
AND s.playout_status >= 0
|
||||
AND s.file_id IS NOT NULL)
|
||||
UNION
|
||||
(SELECT s.starts,
|
||||
1::INTEGER as type,
|
||||
ws.id AS item_id,
|
||||
(ws.name || ': ' || ws.url) AS title,
|
||||
sub.login AS creator,
|
||||
't'::boolean AS EXISTS,
|
||||
ws.url AS filepath
|
||||
FROM cc_schedule AS s
|
||||
LEFT JOIN cc_webstream AS ws ON ws.id = s.stream_id
|
||||
LEFT JOIN cc_subjs AS sub ON ws.creator_id = sub.id
|
||||
WHERE s.instance_id = '{$this->_instanceId}'
|
||||
AND s.playout_status >= 0
|
||||
AND s.stream_id IS NOT NULL)) AS temp
|
||||
ORDER BY starts;
|
||||
SQL;
|
||||
|
||||
//Logging::log($sql);
|
||||
|
||||
$results = $con->query($sql)->fetchAll();
|
||||
$results = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($results as &$row) {
|
||||
|
||||
|
@ -682,7 +707,7 @@ class Application_Model_ShowInstance
|
|||
|
||||
$query = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
return ($query !== false) ? $query : NULL;
|
||||
return ($query !== false) ? $query : null;
|
||||
}
|
||||
|
||||
public function getShowEndGapTime()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue