Merge branch 'master' of dev.sourcefabric.org:airtime

This commit is contained in:
Martin Konecny 2013-05-14 15:10:13 -04:00
commit a59fc69d17
47 changed files with 37387 additions and 36090 deletions
airtime_mvc
application
locale
cs_CZ/LC_MESSAGES
de_AT/LC_MESSAGES
de_DE/LC_MESSAGES
el_GR/LC_MESSAGES
en_CA/LC_MESSAGES
en_GB/LC_MESSAGES
en_US/LC_MESSAGES
es_ES/LC_MESSAGES
fr_FR/LC_MESSAGES
it_IT/LC_MESSAGES
ko_KR/LC_MESSAGES
pl_PL/LC_MESSAGES
pt_BR/LC_MESSAGES
ru_RU/LC_MESSAGES
template
zh_CN/LC_MESSAGES
public
css
js
airtime/library
datatables/i18n
plupload/i18n
waveformplaylist
python_apps/pypo

View File

@ -49,6 +49,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/waveform.css?'.$CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');

View File

@ -284,6 +284,11 @@ class LocaleController extends Zend_Controller_Action
"Cannot schedule outside a show." => _("Cannot schedule outside a show."),
"Moving 1 Item" => _("Moving 1 Item"),
"Moving %s Items" => _("Moving %s Items"),
"Save" => _("Save"),
"Cancel" => _("Cancel"),
"Fade Editor" => _("Fade Editor"),
"Cue Editor" => _("Cue Editor"),
"Waveform features are available in a browser supporting the Web Audio API" => _("Waveform features are available in a browser supporting the Web Audio API"),
//already in library/library.js
//"Select" => _("Select"),
"Select all" => _("Select all"),

View File

@ -108,6 +108,9 @@ class LoginController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$request = $this->getRequest();
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA'));
if (!Application_Model_Preference::GetEnableSystemEmail()) {
$this->_redirect('login');
} else {
@ -149,6 +152,9 @@ class LoginController extends Zend_Controller_Action
public function passwordRestoreAfterAction()
{
$request = $this->getRequest();
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA'));
//uses separate layout without a navigation.
$this->_helper->layout->setLayout('login');
}
@ -166,6 +172,8 @@ class LoginController extends Zend_Controller_Action
$auth = new Application_Model_Auth();
$user = CcSubjsQuery::create()->findPK($user_id);
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA'));
//check validity of token
if (!$auth->checkToken($user_id, $token, 'password.restore')) {
Logging::debug("token not valid");

View File

@ -421,8 +421,8 @@ class PlaylistController extends Zend_Controller_Action
public function setCrossfadeAction()
{
$id1 = $this->_getParam('id1');
$id2 = $this->_getParam('id2');
$id1 = $this->_getParam('id1', null);
$id2 = $this->_getParam('id2', null);
$type = $this->_getParam('type');
$fadeIn = $this->_getParam('fadeIn', 0);
$fadeOut = $this->_getParam('fadeOut', 0);

View File

@ -38,22 +38,22 @@
<div class="waveform-cues">
<div class="playlist-tracks"></div>
<div class="playlist-controls">
<span class="btn_play ui-state-default">Play</span>
<span class="btn_stop ui-state-default">Stop</span>
<a class="btn btn-small btn_play"><i class="icon-play icon-white"></i><?php echo _("Play"); ?></a>
<a class="btn btn-small btn_stop"><i class="icon-stop icon-white"></i><?php echo _("Stop"); ?></a>
<label class="audio audio_pos">00:00:00.0</label>
</div>
<div>
<div class="set-cue">
<label for="editor-cue-in"><?php echo _("Cue In"); ?></label>
<input type="text" class="audio_start">
<input type="button" class="set-cue-in" value="Set Cue In">
<input type="text" class="audio_end">
<input type="button" class="set-cue-out" value="Set Cue Out">
<input type="text" class="audio_pos">
<input type="button" class="btn btn-small set-cue-in" value="<?php echo _("Set Cue In"); ?>">
<label class="audio editor-cue-in">00:00:00.0</label>
<span style="display:none" class="cue-in-error"></span>
</div>
<div>
<label for="editor-cue-in">Cue In</label>
<input type="text" id="editor-cue-in" class="editor-cue-in">
<span style="display:none" class="cue-in-error"></span>
<label for="editor-cue-out">Cue Out</label>
<input type="text" id="editor-cue-out" class="editor-cue-out">
<div class="set-cue">
<label for="editor-cue-out"><?php echo _("Cue Out"); ?></label>
<input type="text" class="audio_end">
<input type="button" class="btn btn-small set-cue-out" value="<?php echo _("Set Cue Out"); ?>">
<label class="audio editor-cue-out">00:00:00.0</label>
<span style="display:none" class="cue-out-error"></span>
</div>
</div>
@ -62,14 +62,14 @@
<script id="tmpl-pl-fades" type="text/template">
<div class="waveform-fades">
<div class="playlist-tracks"></div>
<div>
<span class="btn_play ui-state-default">Play</span>
<span class="btn_stop ui-state-default">Stop</span>
<div class="playlist-controls left-floated">
<a class="btn btn-small btn_play"><i class="icon-play icon-white"></i><?php echo _("Play"); ?></a>
<a class="btn btn-small btn_stop"><i class="icon-stop icon-white"></i><?php echo _("Stop"); ?></a>
</div>
<div>
<span class="btn_select ui-state-default" data-state="cursor">Cursor</span>
<span class="btn_fadein ui-state-default" data-state="fadein">Fade In</span>
<span class="btn_fadeout ui-state-default" data-state="fadeout">Fade Out</span>
<div class="set-fade left-floated">
<a type="button" class="btn btn-small btn_cursor" data-state="cursor"><?php echo _("Cursor"); ?></a>
<a type="button" class="btn btn-small btn_fadein" data-state="fadein"><?php echo _("Fade In"); ?></a>
<a type="button" class="btn btn-small btn_fadeout" data-state="fadeout"><?php echo _("Fade Out"); ?></a>
</div>
</div>
</script>

View File

@ -688,8 +688,12 @@ SQL;
$this->con->beginTransaction();
try {
$this->changeFadeInfo($id1, null, $fadeOut);
$this->changeFadeInfo($id2, $fadeIn, null, $offset);
if (isset($id1)) {
$this->changeFadeInfo($id1, null, $fadeOut);
}
if (isset($id2)) {
$this->changeFadeInfo($id2, $fadeIn, null, $offset);
}
$this->con->commit();

View File

@ -670,8 +670,12 @@ SQL;
$this->con->beginTransaction();
try {
$this->changeFadeInfo($id1, null, $fadeOut);
$this->changeFadeInfo($id2, $fadeIn, null, $offset);
if (isset($id1)) {
$this->changeFadeInfo($id1, null, $fadeOut);
}
if (isset($id2)) {
$this->changeFadeInfo($id2, $fadeIn, null, $offset);
}
$this->con->commit();

View File

@ -106,43 +106,44 @@ class Application_Model_Preference
private static function getValue($key, $isUserValue = false)
{
try {
$con = Propel::getConnection();
//Check if key already exists
$sql = "SELECT COUNT(*) FROM cc_pref"
." WHERE keystr = '$key'";
/*." WHERE keystr = :key";
." WHERE keystr = :key";
$paramMap = array();
$paramMap[':key'] = $key;*/
$paramMap[':key'] = $key;
//For user specific preference, check if id matches as well
if ($isUserValue) {
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$id = $auth->getIdentity()->id;
$sql .= " AND subjid = '$id'";
/*$sql .= " AND subjid = :id";
$paramMap[':id'] = $id;*/
$sql .= " AND subjid = :id";
$paramMap[':id'] = $id;
}
}
$result = $con->query($sql)->fetchColumn(0);
//$result = Application_Common_Database::prepareAndExecute($sql, $paramMap, 'column');
$result = Application_Common_Database::prepareAndExecute($sql, $paramMap, Application_Common_Database::COLUMN);
if ($result == 0) {
return "";
} else {
}
else {
$sql = "SELECT valstr FROM cc_pref"
." WHERE keystr = '$key'";
/*." WHERE keystr = :key";
." WHERE keystr = :key";
$paramMap = array();
$paramMap[':key'] = $key;*/
$paramMap[':key'] = $key;
//For user specific preference, check if id matches as well
if ($isUserValue && $auth->hasIdentity()) {
$sql .= " AND subjid = '$id'";
/*$sql .= " AND subjid = :id";
$paramMap[':id'] = $id;*/
$sql .= " AND subjid = :id";
$paramMap[':id'] = $id;
}
$result = $con->query($sql)->fetchColumn(0);
//$result = Application_Common_Database::prepareAndExecute($sql, $paramMap, 'column');
$result = Application_Common_Database::prepareAndExecute($sql, $paramMap, Application_Common_Database::COLUMN);
return ($result !== false) ? $result : "";
}
@ -609,9 +610,10 @@ class Application_Model_Preference
public static function GetCountryList()
{
$con = Propel::getConnection();
$sql = "SELECT * FROM cc_country";
$res = $con->query($sql)->fetchAll();
$res = Application_Common_Database::prepareAndExecute($sql, array());
$out = array();
$out[""] = _("Select Country");
foreach ($res as $r) {

View File

@ -20,7 +20,7 @@ SQL;
return (is_numeric($count) && ($count != '0'));
}
public static function getAllFutureScheduledFiles()
public static function getAllFutureScheduledFiles($instanceId=null)
{
$sql = <<<SQL
SELECT distinct(file_id)
@ -29,6 +29,24 @@ WHERE ends > now() AT TIME ZONE 'UTC'
AND file_id is not null
SQL;
/* If an instance id gets passed into this function we need to check
* if it is a repeating show. If it is a repeating show, we need to
* check for any files scheduled in the future in the linked instances
* as well
*/
if (!is_null($instanceId)) {
$excludeIds = array();
$ccShow = CcShowInstancesQuery::create()
->findPk($instanceId)
->getCcShow();
if ($ccShow->isLinked()) {
foreach ($ccShow->getOtherInstances($instanceId) as $instance) {
$excludeIds[] = $instance->getDbId();
}
$sql .= " AND instance_id IN (".implode(",", $excludeIds).")";
}
}
$files = Application_Common_Database::prepareAndExecute( $sql, array());
$real_files = array();

View File

@ -326,73 +326,6 @@ SQL;
Application_Model_RabbitMq::PushSchedule();
}
/**
* This function is called when a repeating show is edited and the
* days that is repeats on have changed. More specifically, a day
* that the show originally repeated on has been "unchecked".
*
* Removes Show Instances that occur on days of the week specified
* by input array. For example, if array contains one value of "0",
* (0 = Sunday, 1=Monday) then all show instances that occur on
* Sunday are removed.
*
* @param array p_uncheckedDays
* An array specifying which days should be removed. (in the local timezone)
*/
public function removeUncheckedDaysInstances($p_uncheckedDays)
{
//need to convert local doftw to UTC doftw (change made for 2.0 since shows are stored in UTC)
$daysRemovedUTC = array();
$showDays = CcShowDaysQuery::create()
->filterByDbShowId($this->getId())
->find();
Logging::info("Unchecked days:");
foreach ($p_uncheckedDays as $day) {
Logging::info($day);
}
foreach ($showDays as $showDay) {
//Logging::info("Local show day is: {$showDay->getDbDay()}");
//Logging::info("First show day is: {$showDay->getDbFirstShow()}");
//Logging::info("Id show days is: {$showDay->getDbId()}");
if (in_array($showDay->getDbDay(), $p_uncheckedDays)) {
$showDay->reload();
//Logging::info("Local show day is: {$showDay->getDbDay()}");
//Logging::info("First show day is: {$showDay->getDbFirstShow()}");
//Logging::info("Id show days is: {$showDay->getDbId()}");
$startDay = new DateTime("{$showDay->getDbFirstShow()} {$showDay->getDbStartTime()}", new DateTimeZone($showDay->getDbTimezone()));
//Logging::info("Show start day: {$startDay->format('Y-m-d H:i:s')}");
$startDay->setTimezone(new DateTimeZone("UTC"));
//Logging::info("Show start day UTC: {$startDay->format('Y-m-d H:i:s')}");
$daysRemovedUTC[] = $startDay->format('w');
//Logging::info("UTC show day is: {$startDay->format('w')}");
}
}
$uncheckedDaysImploded = implode(",", $daysRemovedUTC);
$showId = $this->getId();
$esc_uncheckedDays = pg_escape_string($uncheckedDaysImploded);
$timestamp = gmdate("Y-m-d H:i:s");
$sql = <<<SQL
DELETE
FROM cc_show_instances
WHERE EXTRACT(DOW FROM starts) IN ($esc_uncheckedDays)
AND starts > :timestamp::TIMESTAMP
AND show_id = :showId
SQL;
Application_Common_Database::prepareAndExecute( $sql,
array(
":timestamp" => $timestamp,
":showId" => $showId,
), "execute");
}
/**
* Check whether the current show originated
* from a recording.
@ -604,92 +537,6 @@ SQL;
':timestamp' => gmdate("Y-m-d H:i:s")), 'execute');
}
/**
* Deletes all show instances of current show after a
* certain date. Note that although not enforced, $p_date
* should never be in the past, as we never want to allow
* deletion of shows that have already occured.
*
* @param string $p_date
* The date which to delete after, if null deletes from the current timestamp.
*/
public function removeAllInstancesFromDate($p_date=null)
{
$timestamp = gmdate("Y-m-d H:i:s");
if (is_null($p_date)) {
$date = new Application_Common_DateHelper;
$p_date = $date->getDate();
}
$showId = $this->getId();
$sql = "DELETE FROM cc_show_instances "
." WHERE date(starts) >= :date::date"
." AND starts > :timestamp::timestamp"
." AND show_id = :showId";
$map = array(":date"=>$p_date,
':timestamp'=>$timestamp,
':showId'=>$showId);
$res = Application_Common_Database::prepareAndExecute($sql, $map,
Application_Common_Database::EXECUTE);
}
/**
* Deletes all show instances of current show before a
* certain date.
*
* This function is used in the case where a repeating show is being
* edited and the start date of the first show has been changed more
* into the future. In this case, delete any show instances that
* exist before the new start date.
*
* @param string $p_date
* The date which to delete before
*/
public function removeAllInstancesBeforeDate($p_date)
{
$timestamp = gmdate("Y-m-d H:i:s");
$showId = $this->getId();
$sql = "DELETE FROM cc_show_instances "
." WHERE date(starts) < :date::date"
." AND starts > :timestamp::timestamp"
." AND show_id = :showId";
$map = array(":date"=>$p_date,
":timestamp"=>$timestamp,
":showId"=>$showId);
$res = Application_Common_Database::prepareAndExecute($sql, $map,
Application_Common_Database::EXECUTE);
}
public function getNextFutureRepeatShowTime()
{
$sql = <<<SQL
SELECT starts, ends FROM cc_show_instances
WHERE ends > now() at time zone 'UTC'
AND show_id = :showId
ORDER BY starts
LIMIT 1
SQL;
$result = Application_Common_Database::prepareAndExecute( $sql,
array( 'showId' => $this->getId() ), 'all' );
foreach ($result as $r) {
$show["starts"] = new DateTime($r["starts"], new DateTimeZone('UTC'));
$show["ends"] = new DateTime($r["ends"], new DateTimeZone('UTC'));
}
$currentUser = Application_Model_User::getCurrentUser();
$currentUserId = $currentUser->getId();
$userTimezone = Application_Model_Preference::GetUserTimezone($currentUserId);
$show["starts"]->setTimezone(new DateTimeZone($userTimezone));
$show["ends"]->setTimezone(new DateTimeZone($userTimezone));
return $show;
}
/**
* Get the start date of the current show in UTC timezone.
*
@ -1040,635 +887,6 @@ SQL;
}
public function deletePossiblyInvalidInstances($p_data, $p_endDate, $isRecorded, $repeatType)
{
if ($p_data['add_show_repeats'] != $this->isRepeating()) {
//repeat option was toggled
$this->deleteAllInstances();
}
if ($p_data['add_show_duration'] != $this->getDuration()) {
//duration has changed
$this->updateDurationTime($p_data);
}
if ($p_data['add_show_repeats']) {
if (($repeatType == 1 || $repeatType == 2) &&
$p_data['add_show_start_date'] != $this->getStartDate()){
//start date has changed when repeat type is bi-weekly or monthly.
//This screws up the repeating positions of show instances, so lets
//just delete them for now. (CC-2351)
$this->deleteAllInstances();
}
if ($repeatType != $this->getRepeatType()) {
//repeat type changed.
$this->deleteAllInstances();
} else {
//repeat type is the same, check if the days of the week are the same
$repeatingDaysChanged = false;
$showDaysArray = $this->getShowDays();
if (count($p_data['add_show_day_check']) == count($showDaysArray)) {
//same number of days checked, lets see if they are the same numbers
$intersect = array_intersect($p_data['add_show_day_check'], $showDaysArray);
if (count($intersect) != count($p_data['add_show_day_check'])) {
$repeatingDaysChanged = true;
}
} else {
$repeatingDaysChanged = true;
}
if ($repeatingDaysChanged) {
$daysRemoved = array_diff($showDaysArray, $p_data['add_show_day_check']);
if (count($daysRemoved) > 0) {
$this->removeUncheckedDaysInstances($daysRemoved);
}
}
if ($p_data['add_show_start_date'] != $this->getStartDate()
|| $p_data['add_show_start_time'] != $this->getStartTime()){
//start date/time has changed
$newDate = strtotime($p_data['add_show_start_date']);
$oldDate = strtotime($this->getStartDate());
if ($newDate > $oldDate) {
$this->removeAllInstancesBeforeDate($p_data['add_show_start_date']);
}
$this->updateStartDateTime($p_data, $p_endDate);
}
}
//Check if end date for the repeat option has changed. If so, need to take care
//of deleting possible invalid Show Instances.
if ((strlen($this->getRepeatingEndDate()) == 0) == $p_data['add_show_no_end']) {
//show "Never Ends" option was toggled.
if ($p_data['add_show_no_end']) {
} else {
$this->removeAllInstancesFromDate($p_endDate);
}
}
if ($this->getRepeatingEndDate() != $p_data['add_show_end_date']) {
//end date was changed.
$newDate = strtotime($p_data['add_show_end_date']);
$oldDate = strtotime($this->getRepeatingEndDate());
if ($newDate < $oldDate) {
$this->removeAllInstancesFromDate($p_endDate);
}
}
}
}
/**
* Create a show.
*
* Note: end dates are non inclusive.
*
* @param array $data
* @return int
* Show ID
*/
public static function create($data)
{
/*$startDateTime = new DateTime($data['add_show_start_date']." ".$data['add_show_start_time']);*/
// these are not used
/*$utcStartDateTime = clone $startDateTime;
$utcStartDateTime->setTimezone(new DateTimeZone('UTC'));*/
/*if ($data['add_show_no_end']) {
$endDate = NULL;
} elseif ($data['add_show_repeats']) {
$endDateTime = new DateTime($data['add_show_end_date']);
//$endDateTime->setTimezone(new DateTimeZone('UTC'));
$endDateTime->add(new DateInterval("P1D"));
$endDate = $endDateTime->format("Y-m-d");
} else {
$endDateTime = new DateTime($data['add_show_start_date']);
//$endDateTime->setTimezone(new DateTimeZone('UTC'));
$endDateTime->add(new DateInterval("P1D"));
$endDate = $endDateTime->format("Y-m-d");
}*/
//What we are doing here is checking if the show repeats or if
//any repeating days have been checked. If not, then by default
//the "selected" DOW is the initial day.
//DOW in local time.
/*$startDow = date("w", $startDateTime->getTimestamp());
if (!$data['add_show_repeats']) {
$data['add_show_day_check'] = array($startDow);
} elseif ($data['add_show_repeats'] && $data['add_show_day_check'] == "") {
$data['add_show_day_check'] = array($startDow);
}*/
//find repeat type or set to a non repeating show.
/*$repeatType = ($data['add_show_repeats']) ? $data['add_show_repeat_type'] : -1;*/
/*if ($data['add_show_id'] == -1) {
$ccShow = new CcShow();
} else {
$ccShow = CcShowQuery::create()->findPK($data['add_show_id']);
}*/
/*$ccShow->setDbName($data['add_show_name']);
$ccShow->setDbDescription($data['add_show_description']);
$ccShow->setDbUrl($data['add_show_url']);
$ccShow->setDbGenre($data['add_show_genre']);
$ccShow->setDbColor($data['add_show_color']);
$ccShow->setDbBackgroundColor($data['add_show_background_color']);
$ccShow->setDbLiveStreamUsingAirtimeAuth($data['cb_airtime_auth'] == 1);
$ccShow->setDbLiveStreamUsingCustomAuth($data['cb_custom_auth'] == 1);
$ccShow->setDbLiveStreamUser($data['custom_username']);
$ccShow->setDbLiveStreamPass($data['custom_password']);
$ccShow->save();*/
/*$showId = $ccShow->getDbId();*/
/*$isRecorded = (isset($data['add_show_record']) && $data['add_show_record']) ? 1 : 0;*/
/*if ($data['add_show_id'] != -1) {
$show = new Application_Model_Show($showId);
//CC-4150 CULPRIT
$show->deletePossiblyInvalidInstances($data, $endDate, $isRecorded, $repeatType);
}*/
//check if we are adding or updating a show, and if updating
//erase all the show's show_days information first.
/*if ($data['add_show_id'] != -1) {
CcShowDaysQuery::create()->filterByDbShowId($data['add_show_id'])->delete();
}*/
//don't set day for monthly repeat type, it's invalid.
/*if ($data['add_show_repeats'] && $data['add_show_repeat_type'] == 2) {
$showDay = new CcShowDays();
$showDay->setDbFirstShow($startDateTime->format("Y-m-d"));
$showDay->setDbLastShow($endDate);
$showDay->setDbStartTime($startDateTime->format("H:i:s"));
$showDay->setDbTimezone(date_default_timezone_get());
$showDay->setDbDuration($data['add_show_duration']);
$showDay->setDbRepeatType($repeatType);
$showDay->setDbShowId($showId);
$showDay->setDbRecord($isRecorded);
$showDay->save();
} else {
foreach ($data['add_show_day_check'] as $day) {
$daysAdd=0;
$startDateTimeClone = clone $startDateTime;
if ($startDow !== $day) {
if ($startDow > $day)
$daysAdd = 6 - $startDow + 1 + $day;
else
$daysAdd = $day - $startDow;
$startDateTimeClone->add(new DateInterval("P".$daysAdd."D"));
}
if (is_null($endDate) || $startDateTimeClone->getTimestamp() <= $endDateTime->getTimestamp()) {
$showDay = new CcShowDays();
$showDay->setDbFirstShow($startDateTimeClone->format("Y-m-d"));
$showDay->setDbLastShow($endDate);
$showDay->setDbStartTime($startDateTimeClone->format("H:i"));
$showDay->setDbTimezone(date_default_timezone_get());
$showDay->setDbDuration($data['add_show_duration']);
$showDay->setDbDay($day);
$showDay->setDbRepeatType($repeatType);
$showDay->setDbShowId($showId);
$showDay->setDbRecord($isRecorded);
$showDay->save();
}
}
}*/
//check if we are adding or updating a show, and if updating
//erase all the show's future show_rebroadcast information first.
/*if (($data['add_show_id'] != -1) && isset($data['add_show_rebroadcast']) && $data['add_show_rebroadcast']) {
CcShowRebroadcastQuery::create()
->filterByDbShowId($data['add_show_id'])
->delete();
}*/
//adding rows to cc_show_rebroadcast
/* TODO: Document magic constant 10 and define it properly somewhere
--RG */
/*if (($isRecorded && $data['add_show_rebroadcast']) && ($repeatType != -1)) {
for ($i=1; $i<=10; $i++) {
if ($data['add_show_rebroadcast_date_'.$i]) {
$showRebroad = new CcShowRebroadcast();
$showRebroad->setDbDayOffset($data['add_show_rebroadcast_date_'.$i]);
$showRebroad->setDbStartTime($data['add_show_rebroadcast_time_'.$i]);
$showRebroad->setDbShowId($showId);
$showRebroad->save();
}
}
} elseif ($isRecorded && $data['add_show_rebroadcast'] && ($repeatType == -1)) {
for ($i=1; $i<=10; $i++) {
if ($data['add_show_rebroadcast_date_absolute_'.$i]) {
//$con = Propel::getConnection(CcShowPeer::DATABASE_NAME);
//$sql = "SELECT date '{$data['add_show_rebroadcast_date_absolute_'.$i]}' - date '{$data['add_show_start_date']}' ";
$sql = <<<SQL
SELECT :rebroadcast::date - :start::date
SQL;
$offset_days =
Application_Common_Database::prepareAndExecute($sql,
array(
'rebroadcast' =>
$data["add_show_rebroadcast_date_absolute_$i"],
'start' =>
$data['add_show_start_date']), "column" );
//$r = $con->query($sql);
//$offset_days = $r->fetchColumn(0);
$showRebroad = new CcShowRebroadcast();
$showRebroad->setDbDayOffset($offset_days." days");
$showRebroad->setDbStartTime($data['add_show_rebroadcast_time_absolute_'.$i]);
$showRebroad->setDbShowId($showId);
$showRebroad->save();
}
}
}*/
//check if we are adding or updating a show, and if updating
//erase all the show's show_rebroadcast information first.
/*if ($data['add_show_id'] != -1) {
CcShowHostsQuery::create()->filterByDbShow($data['add_show_id'])->delete();
}*/
/*if (is_array($data['add_show_hosts'])) {
//add selected hosts to cc_show_hosts table.
foreach ($data['add_show_hosts'] as $host) {
$showHost = new CcShowHosts();
$showHost->setDbShow($showId);
$showHost->setDbHost($host);
$showHost->save();
}
}*/
/*if ($data['add_show_id'] != -1) {
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
$con->beginTransaction();
//current timesamp in UTC.
$current_timestamp = gmdate("Y-m-d H:i:s");
try {
//update the status flag in cc_schedule.
$instances = CcShowInstancesQuery::create()
->filterByDbEnds($current_timestamp, Criteria::GREATER_THAN)
->filterByDbShowId($data['add_show_id'])
->find($con);
foreach ($instances as $instance) {
$instance->updateScheduleStatus($con);
}
$con->commit();
} catch (Exception $e) {
$con->rollback();
Logging::info("Couldn't update schedule status.");
Logging::info($e->getMessage());
}
}*/
/*Application_Model_Show::populateShowUntil($showId);
Application_Model_RabbitMq::PushSchedule();*/
/*return $showId;*/
}
/**
* Generate repeating show instances for a single show up to the given date.
* It will always try to use enddate from DB but if that's empty, it will use
* time now.
*
* @param int $p_showId
*/
/*public static function populateShowUntil($p_showId)
{
$con = Propel::getConnection();
$date = Application_Model_Preference::GetShowsPopulatedUntil();
if (is_null($date)) {
$p_populateUntilDateTime = new DateTime("now", new DateTimeZone('UTC'));
Application_Model_Preference::SetShowsPopulatedUntil($p_populateUntilDateTime);
} else {
$p_populateUntilDateTime = $date;
}
$stmt = $con->prepare("SELECT * FROM cc_show_days WHERE show_id = :show_id");
$stmt->bindParam(':show_id', $p_showId);
$stmt->execute();
$res = $stmt->fetchAll();
foreach ($res as $showDaysRow) {
Application_Model_Show::populateShow($showDaysRow, $p_populateUntilDateTime);
}
}*/
/**
* We are going to use cc_show_days as a template, to generate Show Instances. This function
* is basically a dispatcher that looks at the show template, and sends it to the correct function
* so that Show Instance generation can begin. After the all show instances have been created, pushes
* the schedule to Pypo.
*
* @param array $p_showRow
* A row from cc_show_days table
* @param DateTime $p_populateUntilDateTime
* DateTime object in UTC time.
*/
/*private static function populateShow($p_showDaysRow, $p_populateUntilDateTime)
{
// TODO : use constants instead of int values here? or maybe php will
// get enum types by the time somebody gets around to fix this. -- RG
if ($p_showDaysRow["repeat_type"] == -1) {
Application_Model_Show::populateNonRepeatingShow($p_showDaysRow, $p_populateUntilDateTime);
} elseif ($p_showDaysRow["repeat_type"] == 0) {
Application_Model_Show::populateRepeatingShow($p_showDaysRow, $p_populateUntilDateTime, 'P7D');
} elseif ($p_showDaysRow["repeat_type"] == 1) {
Application_Model_Show::populateRepeatingShow($p_showDaysRow, $p_populateUntilDateTime, 'P14D');
} elseif ($p_showDaysRow["repeat_type"] == 2) {
Application_Model_Show::populateRepeatingShow($p_showDaysRow, $p_populateUntilDateTime, 'P1M');
}
Application_Model_RabbitMq::PushSchedule();
}*/
/**
* Creates a single show instance. If the show is recorded, it may have multiple
* rebroadcast dates, and so this function will create those as well.
*
* @param array $p_showRow
* A row from cc_show_days table
* @param DateTime $p_populateUntilDateTime
* DateTime object in UTC time.
*/
private static function populateNonRepeatingShow($p_showRow, $p_populateUntilDateTime)
{
/*$show_id = $p_showRow["show_id"];
$first_show = $p_showRow["first_show"]; //non-UTC
$start_time = $p_showRow["start_time"]; //non-UTC
$duration = $p_showRow["duration"];
$record = $p_showRow["record"];
$timezone = $p_showRow["timezone"];
$start = $first_show." ".$start_time;
//start & end UTC DateTimes for the show.
list($utcStartDateTime, $utcEndDateTime) = Application_Model_Show::createUTCStartEndDateTime($start, $duration, $timezone);
if ($utcStartDateTime->getTimestamp() < $p_populateUntilDateTime->getTimestamp()) {
$currentUtcTimestamp = gmdate("Y-m-d H:i:s");*/
/*$show = new Application_Model_Show($show_id);
if ($show->hasInstance()) {
$ccShowInstance = $show->getInstance();
$newInstance = false;
}*/ /*else {
$ccShowInstance = new CcShowInstances();
$newInstance = true;
}*/
/*if ($newInstance || $ccShowInstance->getDbStarts() > $currentUtcTimestamp) {
$ccShowInstance->setDbShowId($show_id);
$ccShowInstance->setDbStarts($utcStartDateTime);
$ccShowInstance->setDbEnds($utcEndDateTime);
$ccShowInstance->setDbRecord($record);
$ccShowInstance->save();
}*/
/* $show_instance_id = $ccShowInstance->getDbId();
$showInstance = new Application_Model_ShowInstance($show_instance_id);*/
/*if (!$newInstance) {
$showInstance->correctScheduleStartTimes();
}*/
/*$sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id=:show_id";
$rebroadcasts = Application_Common_Database::prepareAndExecute($sql,
array( ':show_id' => $show_id ), 'all');*/
/*if ($showInstance->isRecorded()) {
//only do this for editing
$showInstance->deleteRebroadcasts();
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
}*/
/*}*/
}
/**
* Creates a 1 or more than 1 show instances (user has stated this show repeats). If the show
* is recorded, it may have multiple rebroadcast dates, and so this function will create
* those as well.
*
* @param array $p_showRow
* A row from cc_show_days table
* @param DateTime $p_populateUntilDateTime
* DateTime object in UTC time. "shows_populated_until" date YY-mm-dd in cc_pref
* @param string $p_interval
* Period of time between repeating shows (in php DateInterval notation 'P7D')
*/
private static function populateRepeatingShow($p_showDaysRow, $p_populateUntilDateTime, $p_interval)
{
/*$show_id = $p_showDaysRow["show_id"];
$next_pop_date = $p_showDaysRow["next_pop_date"];
$first_show = $p_showDaysRow["first_show"]; //non-UTC
$last_show = $p_showDaysRow["last_show"]; //non-UTC
$start_time = $p_showDaysRow["start_time"]; //non-UTC
$duration = $p_showDaysRow["duration"];
$day = $p_showDaysRow["day"];
$record = $p_showDaysRow["record"];
$timezone = $p_showDaysRow["timezone"];
$currentUtcTimestamp = gmdate("Y-m-d H:i:s");
if (isset($next_pop_date)) {
$start = $next_pop_date." ".$start_time;
} else {
$start = $first_show." ".$start_time;
}
$utcStartDateTime = Application_Common_DateHelper::ConvertToUtcDateTime($start, $timezone);
//convert $last_show into a UTC DateTime object, or null if there is no last show.
$utcLastShowDateTime = $last_show ? Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null;*/
/*$sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id=:show_id";
$rebroadcasts = Application_Common_Database::prepareAndExecute( $sql,
array( ':show_id' => $show_id ), 'all');
$show = new Application_Model_Show($show_id);*/
/*while ($utcStartDateTime->getTimestamp() <= $p_populateUntilDateTime->getTimestamp()
&& (is_null($utcLastShowDateTime) || $utcStartDateTime->getTimestamp() < $utcLastShowDateTime->getTimestamp())){*/
/*list($utcStartDateTime, $utcEndDateTime) = self::createUTCStartEndDateTime($start, $duration, $timezone);*/
//determine if we are adding a new show
//or editing a show
/* if ($show->hasInstanceOnDate($utcStartDateTime)) {
$ccShowInstance = $show->getInstanceOnDate($utcStartDateTime);
if ($ccShowInstance->getDbModifiedInstance()) {
//show instance on this date has been deleted.
list($start, $utcStartDateTime) = self::advanceRepeatingDate($p_interval, $start, $timezone);
continue;
}
$newInstance = false;
} else {
$ccShowInstance = new CcShowInstances();
$newInstance = true;
}*/
/* When editing the start/end time of a repeating show, we don't want to
* change shows that started in the past. So check the start time.
*/
/*if ($newInstance || $ccShowInstance->getDbStarts() > $currentUtcTimestamp) {
$ccShowInstance->setDbShowId($show_id);
$ccShowInstance->setDbStarts($utcStartDateTime);
$ccShowInstance->setDbEnds($utcEndDateTime);
$ccShowInstance->setDbRecord($record);
$ccShowInstance->save();
}
$show_instance_id = $ccShowInstance->getDbId();
$showInstance = new Application_Model_ShowInstance($show_instance_id);*/
/* If we are updating a show then make sure that the scheduled content within
* the show is updated to the correct time. */
// don't we already do this in deletePossiblyInvalidInstances???
/*if (!$newInstance) {
$showInstance->correctScheduleStartTimes();
}*/
/*$showInstance->deleteRebroadcasts();
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
list($start, $utcStartDateTime) = self::advanceRepeatingDate($p_interval, $start, $timezone);*/
/*}*/
/*Application_Model_Show::setNextPop($start, $show_id, $day);*/
}
private static function advanceRepeatingDate($p_interval, $start, $timezone)
{
$startDt = new DateTime($start, new DateTimeZone($timezone));
if ($p_interval == 'P1M') {
/* When adding months, there is a problem if we are on January 31st and add one month with PHP.
* What ends up happening is that since February 31st doesn't exist, the date returned is
* March 3rd. For now let's ignore the day and assume we are always working with the
* first of each month, and use PHP to add 1 month to this (this will take care of rolling
* over the years 2011->2012, etc.). Then let's append the actual day, and use the php
* checkdate() function, to see if it is valid. If not, then we'll just skip this month. */
/* pass in only the year and month (not the day) */
$dt = new DateTime($startDt->format("Y-m"), new DateTimeZone($timezone));
/* Keep adding 1 month, until we find the next month that contains the day
* we are looking for (31st day for example) */
do {
$dt->add(new DateInterval($p_interval));
} while (!checkdate($dt->format("m"), $startDt->format("d"), $dt->format("Y")));
$dt->setDate($dt->format("Y"), $dt->format("m"), $startDt->format("d"));
} else {
$dt = new DateTime($start, new DateTimeZone($timezone));
$dt->add(new DateInterval($p_interval));
}
$start = $dt->format("Y-m-d H:i:s");
$dt->setTimezone(new DateTimeZone('UTC'));
$utcStartDateTime = $dt;
return array($start, $utcStartDateTime);
}
/*
* @param $p_start
* timestring format "Y-m-d H:i:s" (not UTC)
* @param $p_duration
* string time interval (h)h:(m)m(:ss)
* @param $p_timezone
* string "Europe/Prague"
* @param $p_offset
* array (days, hours, mins) used for rebroadcast shows.
*
* @return
* array of 2 DateTime objects, start/end time of the show in UTC.
*/
private static function createUTCStartEndDateTime($p_start, $p_duration, $p_timezone=null, $p_offset=null)
{
/*$timezone = $p_timezone ? $p_timezone : date_default_timezone_get();
$startDateTime = new DateTime($p_start, new DateTimeZone($timezone));
if (isset($p_offset)) {
$startDateTime->add(new DateInterval("P{$p_offset["days"]}DT{$p_offset["hours"]}H{$p_offset["mins"]}M"));
}
//convert time to UTC
$startDateTime->setTimezone(new DateTimeZone('UTC'));
$endDateTime = clone $startDateTime;
$duration = explode(":", $p_duration);
list($hours, $mins) = array_slice($duration, 0, 2);
$endDateTime->add(new DateInterval("PT{$hours}H{$mins}M"));
return array($startDateTime, $endDateTime);*/
}
/* Create rebroadcast instances for a created show marked for recording
*
* @param $p_rebroadcasts
* rows gotten from the db table cc_show_rebroadcasts, tells airtime when to schedule the rebroadcasts.
* @param $p_currentUtcTimestamp
* a timestring in format "Y-m-d H:i:s", current UTC time.
* @param $p_showId
* int of the show it belongs to (from cc_show)
* @param $p_showInstanceId
* the instance id of the created recorded show instance
* (from cc_show_instances), used to associate rebroadcasts to this show.
* @param $p_startTime
* a timestring in format "Y-m-d H:i:s" in the timezone, not UTC of the rebroadcasts' parent recorded show.
* @param $p_duration
* string time interval (h)h:(m)m:(ss) length of the show.
* @param $p_timezone
* string of user's timezone "Europe/Prague"
*
*/
private static function createRebroadcastInstances($p_rebroadcasts, $p_currentUtcTimestamp, $p_showId, $p_showInstanceId, $p_startTime, $p_duration, $p_timezone=null)
{
//Y-m-d
//use only the date part of the show start time stamp for the offsets to work properly.
/*$date = explode(" ", $p_startTime);
$start_date = $date[0];
foreach ($p_rebroadcasts as $rebroadcast) {
$days = explode(" ", $rebroadcast["day_offset"]);
$time = explode(":", $rebroadcast["start_time"]);
$offset = array("days"=>$days[0], "hours"=>$time[0], "mins"=>$time[1]);
list($utcStartDateTime, $utcEndDateTime) = Application_Model_Show::createUTCStartEndDateTime($start_date, $p_duration, $p_timezone, $offset);
if ($utcStartDateTime->format("Y-m-d H:i:s") > $p_currentUtcTimestamp) {
$newRebroadcastInstance = new CcShowInstances();
$newRebroadcastInstance->setDbShowId($p_showId);
$newRebroadcastInstance->setDbStarts($utcStartDateTime);
$newRebroadcastInstance->setDbEnds($utcEndDateTime);
$newRebroadcastInstance->setDbRecord(0);
$newRebroadcastInstance->setDbRebroadcast(1);
$newRebroadcastInstance->setDbOriginalShow($p_showInstanceId);
$newRebroadcastInstance->save();
}
}*/
}
/**
* Get all the show instances in the given time range (inclusive).
*
@ -1895,39 +1113,6 @@ SQL;
return $percent;
}
/* private static function &makeFullCalendarEvent(&$show, $options=array(), $startDateTime, $endDateTime, $startsEpoch, $endsEpoch)
{
$event = array();
$event["id"] = intval($show["instance_id"]);
$event["title"] = $show["name"];
$event["start"] = $startDateTime->format("Y-m-d H:i:s");
$event["startUnix"] = $startsEpoch;
$event["end"] = $endDateTime->format("Y-m-d H:i:s");
$event["endUnix"] = $endsEpoch;
$event["allDay"] = false;
$event["showId"] = intval($show["show_id"]);
$event["record"] = intval($show["record"]);
$event["rebroadcast"] = intval($show["rebroadcast"]);
$event["soundcloud_id"] = is_null($show["soundcloud_id"])
? -1 : $show["soundcloud_id"];
//event colouring
if ($show["color"] != "") {
$event["textColor"] = "#".$show["color"];
}
if ($show["background_color"] != "") {
$event["color"] = "#".$show["background_color"];
}
foreach ($options as $key => $value) {
$event[$key] = $value;
}
return $event;
}*/
/* Takes in a UTC DateTime object.
* Converts this to local time, since cc_show days
* requires local time. */

View File

@ -1322,7 +1322,9 @@ SQL;
}
}
public static function setIsScheduled($p_scheduleItem, $p_status, $p_fileId=null) {
public static function setIsScheduled($p_scheduleItem, $p_status,
$p_fileId=null, $instanceId=null) {
if (is_null($p_fileId)) {
$fileId = Application_Model_Schedule::GetFileId($p_scheduleItem);
} else {
@ -1331,7 +1333,8 @@ SQL;
$file = self::RecallById($fileId);
$updateIsScheduled = false;
if (!is_null($fileId) && !in_array($fileId, Application_Model_Schedule::getAllFutureScheduledFiles())) {
if (!is_null($fileId) && !in_array($fileId,
Application_Model_Schedule::getAllFutureScheduledFiles($instanceId))) {
$file->_file->setDbIsScheduled($p_status)->save();
$updateIsScheduled = true;
}
@ -1341,15 +1344,23 @@ SQL;
public static function updatePastFilesIsScheduled()
{
/* Retrieve files that are scheduled in the past OR that belong
* to a show that has ended. We need to check if the show has
* ended incase a track is overbooked, since that alone will
* indicate the show is still scheduled in the future
*/
$sql = <<<SQL
SELECT file_id FROM cc_schedule
WHERE ends < now() at time zone 'UTC'
SELECT s.file_id, s.instance_id FROM cc_schedule AS s
LEFT JOIN cc_show_instances AS i
ON s.instance_id = i.id
WHERE s.ends < now() at time zone 'UTC'
OR i.ends < now() at time zone 'UTC'
SQL;
$files = Application_Common_Database::prepareAndExecute($sql);
foreach ($files as $file) {
if (!is_null($file['file_id'])) {
self::setIsScheduled(null, false, $file['file_id']);
self::setIsScheduled(null, false, $file['file_id'], $file['instance_id']);
}
}

View File

@ -189,4 +189,12 @@ class CcShow extends BaseCcShow {
}
return $instanceIds;
}
public function getOtherInstances($instanceId)
{
return CcShowInstancesQuery::create()
->filterByCcShow($this)
->filterByDbId($instanceId, Criteria::NOT_IN)
->find();
}
} // CcShow

View File

@ -41,8 +41,11 @@ class Application_Service_SchedulerService
/**
*
* Enter description here ...
* @param array $instanceIds
* Applies the show start difference to any scheduled items
*
* @param $instanceIds
* @param $diff
* @param $newStart
*/
public static function updateScheduleStartTime($instanceIds, $diff=null, $newStart=null)
{

View File

@ -158,11 +158,6 @@ class Application_Service_ShowService
//create new ccShowInstances
$this->delegateInstanceCreation($daysAdded);
if ($this->isUpdate) {
$service_scheduler = new Application_Service_SchedulerService();
$service_scheduler->removeGaps($this->ccShow->getDbId());
}
$con->commit();
Application_Model_RabbitMq::PushSchedule();
} catch (Exception $e) {

View File

@ -5,7 +5,7 @@
<div id="date_form" style="float:left; margin:0px 50px 0px 50px"><?php echo $this->date_form; ?></div>
<div id="errorStatus" style="float:right; width: 400px">
<fieldset class="padded stream-setting-global">
<legend>Status</legend>
<legend><?php echo _("Status")?></legend>
<?php foreach ($this->errorStatus as $k=>$v) {?>
<div class='stream-status <?php echo ($v == 'OK')? 'status-good' : 'status-error' ?>'><h3><?php echo $k?>: <?php echo $v?></h3></div>
<?php }?>

View File

@ -1,17 +1,21 @@
<dl id="spl_cue_editor" class="inline-list">
<dd data-uri="<?php echo $this->uri; ?>">
<input type="button" class="pl-waveform-cues-btn" value="Show Waveform"></input>
<input type="button" class="pl-waveform-cues-btn" value="<?php echo _("Show Waveform")?>"></input>
</dd>
<dt><? echo _("Cue In: "); ?><span class='spl_cue_hint'><? echo _("(hh:mm:ss.t)")?></span></dt>
<dd id="spl_cue_in_<?php echo $this->id; ?>" class="spl_cue_in" data-cue-in="<?php echo $this->cueIn; ?>" data-cue-sec="<?php echo $this->cueInSec; ?>">
<dt><?php echo _("Cue In: "); ?><span class='spl_cue_hint'><?php echo _("(hh:mm:ss.t)")?></span></dt>
<dd id="spl_cue_in_<?php echo $this->id; ?>" class="spl_cue_in"
data-cue-in="<?php echo $this->cueIn; ?>"
data-cue-sec="<?php echo $this->cueInSec; ?>">
<span contenteditable="true" class="spl_text_input"><?php echo $this->cueIn; ?></span>
</dd>
<dd class="edit-error"></dd>
<dt><? echo _("Cue Out: "); ?><span class='spl_cue_hint'><? echo _("(hh:mm:ss.t)")?></span></dt>
<dd id="spl_cue_out_<?php echo $this->id; ?>" class="spl_cue_out" data-cue-out="<?php echo $this->cueOut; ?>" data-cue-sec="<?php echo $this->cueOutSec; ?>">
<dt><?php echo _("Cue Out: "); ?><span class='spl_cue_hint'><?php echo _("(hh:mm:ss.t)")?></span></dt>
<dd id="spl_cue_out_<?php echo $this->id; ?>" class="spl_cue_out"
data-cue-out="<?php echo $this->cueOut; ?>"
data-cue-sec="<?php echo $this->cueOutSec; ?>">
<span contenteditable="true" class="spl_text_input"><?php echo $this->cueOut; ?></span>
</dd>
<dd class="edit-error"></dd>
<dt><? echo _("Original Length:"); ?></dt>
<dt><?php echo _("Original Length:"); ?></dt>
<dd id="spl_original"><span><?php echo $this->origLength; ?></span></dd>
</dl>

View File

@ -1,21 +1,29 @@
<dl id="spl_editor" class="inline-list">
<dd>
<input type="button" class="pl-waveform-fades-btn" value="Show Waveform"></input>
<input type="button" class="pl-waveform-fades-btn" value="<?php echo _("Show Waveform")?>"></input>
</dd>
<?php if ($this->item1Type == 0) {?>
<dt><? echo _("Fade out: "); ?><span class='spl_cue_hint'><? echo _("(ss.t)")?></span></dt>
<dd id="spl_fade_out_<?php echo $this->item1; ?>" class="spl_fade_out" data-fadeout="<?php echo $this->item1Url; ?>"
data-cuein="<?php echo $this->cueIn1; ?>" data-cueout="<?php echo $this->cueOut1; ?>" data-length="<?php echo $this->fadeOut; ?>"
data-type="logarithmic" data-item="<?php echo $this->item1; ?>">
<dd id="spl_fade_out_<?php echo $this->item1; ?>" class="spl_fade_out"
data-fadeout="<?php echo $this->item1Url; ?>"
data-cuein="<?php echo $this->cueIn1; ?>"
data-cueout="<?php echo $this->cueOut1; ?>"
data-length="<?php echo $this->fadeOut; ?>"
data-type="logarithmic"
data-item="<?php echo $this->item1; ?>">
<span contenteditable="true" class="spl_text_input"><?php echo $this->fadeOut; ?></span>
</dd>
<dd class="edit-error"></dd>
<?php }
if ($this->item2Type == 0) {?>
if (isset($this->item2Url)) {?>
<dt><? echo _("Fade in: "); ?><span class='spl_cue_hint'><? echo _("(ss.t)")?></span></dt>
<dd id="spl_fade_in_<?php echo $this->item2; ?>" class="spl_fade_in" data-fadein="<?php echo $this->item2Url; ?>" data-offset="<?php if ($this->item1Type == 0) { echo $this->offset; } else { echo 0; } ?>"
data-cuein="<?php echo $this->cueIn2; ?>" data-cueout="<?php echo $this->cueOut2; ?>" data-length="<?php echo $this->fadeIn; ?>"
data-type="logarithmic" data-item="<?php echo $this->item2; ?>">
<dd id="spl_fade_in_<?php echo $this->item2; ?>" class="spl_fade_in"
data-fadein="<?php echo $this->item2Url; ?>"
data-offset="<?php if ($this->item1Type == 0) { echo $this->offset; } else { echo 0; } ?>"
data-cuein="<?php echo $this->cueIn2; ?>"
data-cueout="<?php echo $this->cueOut2; ?>" data-length="<?php echo $this->fadeIn; ?>"
data-type="logarithmic"
data-item="<?php echo $this->item2; ?>">
<span contenteditable="true" class="spl_text_input"><?php echo $this->fadeIn; ?></span>
</dd>
<dd class="edit-error"></dd>

View File

@ -4,6 +4,7 @@ if (count($items)) : ?>
<?php $i = 0; ?>
<?php foreach($items as $item) :
$staticBlock = null;
$nextFileUrl = null;
if ($item['type'] == 2) {
$bl= new Application_Model_Block($item['item_id']);
$staticBlock = $bl->isStatic();
@ -87,21 +88,33 @@ if (($i < count($items) -1) && ($items[$i+1]['type'] == 0)) {
if(($i < count($items) -1) && !($items[$i]['type'] == 2 && $items[$i+1]['type'])):
?>
<div id="crossfade_<?php echo $i ?>-<?php echo $i+1 ?>" class="crossfade clearfix" style="display: none">
<?php echo $this->partial('playlist/set-fade.phtml', array(
<?php
$vars = array(
'item1' => $items[$i]['id'],
'item2' => $items[$i+1]['id'],
'fadeOut' => $items[$i]['fadeout'],
'fadeIn' => $items[$i+1]['fadein'],
'item1Type' => $items[$i]['type'],
'item2Type' => $items[$i+1]['type'],
'item1Url' => $fileUrl,
'item2Url' => $nextFileUrl,
'fadeOut' => $items[$i]['fadeout'],
'fadeIn' => $items[$i+1]['fadein'],
'offset' => $items[$i]['trackSec'] - $items[$i+1]['trackoffset'],
'cueIn1' => $items[$i]['cueInSec'],
'cueIn1' => $items[$i]['cueInSec'],
'cueOut1' => $items[$i]['cueOutSec'],
'item1Url' => $fileUrl
);
$item2 = array(
'item2Url' => $nextFileUrl,
'item2' => $items[$i+1]['id'],
'item2Type' => $items[$i+1]['type'],
'offset' => $items[$i]['trackSec'] - $items[$i+1]['trackoffset'],
'cueIn2' => $items[$i+1]['cueInSec'],
'cueOut2' => $items[$i+1]['cueOutSec'])
); ?>
'cueOut2' => $items[$i+1]['cueOutSec']
);
if (isset($nextFileUrl)) {
$vars = $vars + $item2;
}
echo $this->partial('playlist/set-fade.phtml', $vars);
?>
</div>
<?php endif; ?>
<?php if ($item['type'] == 2) {?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -190,13 +190,15 @@ a.badge:hover {
}
.btn.active,
.btn:active {
background-color: #494949;
background-color: #494949 \9;
background-color: #434343;
background-color: #434343 \9;
background-image: none;
outline: 0;
-webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);
-moz-box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);
box-shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);
-webkit-box-shadow: inset 0 2px 3px rgba(0,0,0,.25), 0 1px 0 rgba(200,200,200,1);
-moz-box-shadow: inset 0 2px 3px rgba(0,0,0,.25), 0 1px 0 rgba(200,200,200,1);
box-shadow: inset 0 2px 3px rgba(0,0,0,.25), 0 1px 0 rgba(220,220,220,1);
border: 1px solid #131313;
color: #a5a5a5 !important ;
}
.btn.disabled,
.btn[disabled],

View File

@ -584,29 +584,4 @@ li.spl_empty {
}
.expand-block-separate {
border-top: 1px solid #5B5B5B;
}
.channel-wrapper {
position: relative;
}
.channel {
position: absolute;
margin: 0;
padding: 0;
}
.state-select {
cursor: text;
}
.playlist-tracks {
overflow-x: auto;
overflow-y: hidden;
}
.playlist-fade {
position: absolute;
background-color: rgba(0,0,0,0.1);
z-index: 1000;
}

View File

@ -0,0 +1,74 @@
.ui-dialog .ui-dialog-content {
padding: 0px;
}
.ui-dialog .ui-dialog-buttonpane {
padding: 0.3em 0.2em 0 0.4em;
margin: 0 -0.4em 0;
}
.btn-small [class^="icon-"] {
margin: 1px 5px 0 -3px;
}
.btn {
margin-right: 3px;
}
.btn-small {
/*line-height: 20px;*/
}
.playlist-tracks {
margin: 8px 0;
}
.playlist-controls {
margin: 0 0 16px 0;
}
.channel-wrapper {
position: relative;
}
.channel {
position: absolute;
margin: 0;
padding: 0;
background: #3e3e3e;
}
.state-select {
cursor: text;
}
.playlist-tracks {
overflow-x: auto;
overflow-y: hidden;
}
.playlist-fade {
position: absolute;
background-color: rgba(0,0,0,0.1);
z-index: 1000;
}
.set-cue {
margin: 12px 0 16px 0;
}
.set-fade {
margin: 0 0 0 30px;
}
.set-cue input[type="text"] {
vertical-align: middle;
padding: 5px 3px 4px 3px;
}
.set-cue input[type="button"] {
min-width: 100px;
margin-top: 0px;
margin-left: 4px;
}
label {
color:#333;
padding: 0 5px 0 6px;
display: inline-block;
min-width: 50px;
text-align: right;
}
label.audio {
font-weight:bold;
vertical-align: middle;
}

View File

@ -598,7 +598,9 @@ var AIRTIME = (function(AIRTIME){
//remove show waveform buttons since web audio api is not supported.
if (!(window.AudioContext || window.webkitAudioContext)) {
temp.find('.pl-waveform-cues-btn').parent().remove();
temp.find('.pl-waveform-cues-btn')
.parent()
.html($.i18n._("Waveform features are available in a browser supporting the Web Audio API"));
}
}
@ -613,7 +615,9 @@ var AIRTIME = (function(AIRTIME){
//remove show waveform buttons since web audio api is not supported.
if (!(window.AudioContext || window.webkitAudioContext)) {
temp.find('.pl-waveform-fades-btn').parent().remove();
temp.find('.pl-waveform-fades-btn')
.parent()
.html($.i18n._("Waveform features are available in a browser supporting the Web Audio API"));
}
}
@ -1217,14 +1221,14 @@ var AIRTIME = (function(AIRTIME){
$html.dialog({
modal: true,
title: "Fade Editor",
title: $.i18n._("Fade Editor"),
show: 'clip',
hide: 'clip',
width: dim.width - 100,
height: dim.height - 100,
buttons: [
{text: "Cancel", click: removeDialog},
{text: "Save", click: function() {
{text: $.i18n._("Cancel"), class: "btn btn-small", click: removeDialog},
{text: $.i18n._("Save"), class: "btn btn-small btn-inverse", click: function() {
var json = playlistEditor.getJson(),
offset,
fadeIn, fadeOut,
@ -1254,7 +1258,10 @@ var AIRTIME = (function(AIRTIME){
fadeIn = fade["end"] - fade["start"];
}
changeCrossfade($html, id1, id2, fadeIn.toFixed(1), fadeOut.toFixed(1), offset);
fadeIn = (fadeIn === undefined) ? undefined : fadeIn.toFixed(1);
fadeOut = (fadeOut === undefined) ? undefined : fadeOut.toFixed(1);
changeCrossfade($html, id1, id2, fadeIn, fadeOut, offset);
}}
],
open: function (event, ui) {
@ -1305,33 +1312,33 @@ var AIRTIME = (function(AIRTIME){
$html.remove();
}
$html.find('.editor-cue-in').val(cueIn);
$html.find('.editor-cue-out').val(cueOut);
$html.find('.editor-cue-in').html(cueIn);
$html.find('.editor-cue-out').html(cueOut);
$html.on("click", ".set-cue-in", function(e) {
var cueIn = $html.find('.audio_start').val();
$html.find('.editor-cue-in').val(cueIn);
$html.find('.editor-cue-in').html(cueIn);
});
$html.on("click", ".set-cue-out", function(e) {
var cueOut = $html.find('.audio_end').val();
$html.find('.editor-cue-out').val(cueOut);
$html.find('.editor-cue-out').html(cueOut);
});
$html.dialog({
modal: true,
title: "Cue Editor",
title: $.i18n._("Cue Editor"),
show: 'clip',
hide: 'clip',
width: dim.width - 100,
height: dim.height - 100,
buttons: [
{text: "Cancel", click: removeDialog},
{text: "Save", click: function() {
var cueIn = $html.find('.editor-cue-in').val(),
cueOut = $html.find('.editor-cue-out').val();
{text: $.i18n._("Cancel"), class: "btn btn-small", click: removeDialog},
{text: $.i18n._("Save"), class: "btn btn-small btn-inverse", click: function() {
var cueIn = $html.find('.editor-cue-in').html(),
cueOut = $html.find('.editor-cue-out').html();
playlistEditor.stop();

View File

@ -0,0 +1,17 @@
{
"sProcessing": "Bitte warten...",
"sLengthMenu": "_MENU_ Einträge anzeigen",
"sZeroRecords": "Keine Einträge vorhanden.",
"sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen",
"sInfoEmpty": "0 bis 0 von 0 Einträgen",
"sInfoFiltered": "(gefiltert von _MAX_ Einträgen)",
"sInfoPostFix": "",
"sSearch": "",
"sUrl": "",
"oPaginate": {
"sFirst": "Erster",
"sPrevious": "Zurück",
"sNext": "Nächster",
"sLast": "Letzter"
}
}

View File

@ -0,0 +1,23 @@
{
"sEmptyTable": "No data available in table",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
"sInfoPostFix": "",
"sInfoThousands": ",",
"sLengthMenu": "Show _MENU_",
"sLoadingRecords": "Loading...",
"sProcessing": "Processing...",
"sSearch": "",
"sZeroRecords": "No matching records found",
"oPaginate": {
"sFirst": "First",
"sLast": "Last",
"sNext": "Next",
"sPrevious": "Previous"
},
"oAria": {
"sSortAscending": ": activate to sort column ascending",
"sSortDescending": ": activate to sort column descending"
}
}

View File

@ -0,0 +1,25 @@
// German - Austria
plupload.addI18n({
'Select files' : 'Dateien hochladen',
'Add files to the upload queue and click the start button.' : 'Dateien hinzuf&uuml;gen und auf \'Hochladen\' klicken.',
'Filename' : 'Dateiname',
'Status' : 'Status',
'Size' : 'Gr&ouml;&szlig;e',
'Add files' : 'Dateien', // hinzuf&uuml;gen',
'Stop current upload' : 'Aktuelles Hochladen stoppen',
'Start uploading queue' : 'Hochladen starten',
'Uploaded %d/%d files': '%d/%d Dateien sind hochgeladen',
'N/A' : 'Nicht verf&uuml;gbar',
'Drag files here.' : 'Ziehen Sie die Dateien hier hin',
'File extension error.': 'Fehler bei Dateiendung',
'File size error.': 'Fehler bei Dateigr&ouml;ße',
'Init error.': 'Initialisierungsfehler',
'HTTP Error.': 'HTTP-Fehler',
'Security error.': 'Sicherheitsfehler',
'Generic error.': 'Typischer Fehler',
'IO error.': 'Ein/Ausgabe-Fehler',
'Stop Upload': 'Hochladen stoppen',
'Start upload': 'Hochladen',
'%d files queued': '%d Dateien in der Warteschlange',
"Error: Invalid file extension: " : $.i18n._("Error: Invalid file extension: ")
});

View File

@ -0,0 +1,27 @@
// English - GB
plupload.addI18n({
'Select files' : 'Select files',
'Add files to the upload queue and click the start button.' : 'Add files to the upload queue and click the start button.',
'Filename' : 'Filename',
'Status' : 'Status',
'Size' : 'Size',
'Add files' : 'Add files',
'Stop current upload' : 'Stop current upload',
'Start uploading queue' : 'Start uploading queue',
'Uploaded %d/%d files': 'Uploaded %d/%d files',
'N/A' : 'N/A',
'Drag files here.' : 'Drag files here.',
'File extension error.': 'File extension error.',
'File size error.': 'File size error.',
'Init error.': 'Init error.',
'HTTP Error.': 'HTTP Error.',
'Security error.': 'Security error.',
'Generic error.': 'Generic error.',
'IO error.': 'IO error.',
'Stop Upload': 'Stop Upload',
'Add Files': 'Add Files',
'Start Upload': 'Start Upload',
'Start upload': 'Start upload',
'%d files queued': '%d files queued',
"Error: Invalid file extension: " : $.i18n._("Error: Invalid file extension: ")
});

View File

@ -556,7 +556,7 @@ AudioControls.prototype.onCursorSelection = function(args) {
*/
AudioControls.prototype.onAudioUpdate = function(args) {
if (this.ctrls["audio_pos"]) {
this.ctrls["audio_pos"].value = this.cueFormatters(this.timeFormat)(args.seconds);
this.ctrls["audio_pos"].innerHTML = this.cueFormatters(this.timeFormat)(args.seconds);
}
};

View File

@ -231,6 +231,7 @@ s = switch(id="schedule_noise_switch",
s = if dj_live_stream_port != 0 and dj_live_stream_mp != "" then
dj_live = mksafe(
id="dj_live_mksafe",
audio_to_stereo(
input.harbor(id="live_dj_harbor",
dj_live_stream_mp,
@ -253,14 +254,15 @@ end
s = if master_live_stream_port != 0 and master_live_stream_mp != "" then
master_dj = mksafe(
audio_to_stereo(
input.harbor(id="master_harbor",
master_live_stream_mp,
port=master_live_stream_port,
auth=check_master_dj_client,
max=40.,
on_connect=master_dj_connect,
on_disconnect=master_dj_disconnect)))
id="master_dj_mksafe",
audio_to_stereo(
input.harbor(id="master_harbor",
master_live_stream_mp,
port=master_live_stream_port,
auth=check_master_dj_client,
max=40.,
on_connect=master_dj_connect,
on_disconnect=master_dj_disconnect)))
ignore(output.dummy(master_dj, fallible=true))

7
python_apps/pypo/pure.py Normal file
View File

@ -0,0 +1,7 @@
import re
def version_cmp(version1, version2):
def normalize(v):
return [int(x) for x in re.sub(r'(\.0+)*$','', v).split(".")]
return cmp(normalize(version1), normalize(version2))

View File

@ -13,6 +13,7 @@ import signal
import logging
import locale
import os
import re
from Queue import Queue
from threading import Lock
@ -33,6 +34,7 @@ from configobj import ConfigObj
# custom imports
from api_clients import api_client
from std_err_override import LogWriter
import pure
# Set up command-line options
parser = OptionParser()
@ -71,6 +73,8 @@ parser.add_option("-c",
# parse options
(options, args) = parser.parse_args()
LIQUIDSOAP_MIN_VERSION = "1.1.1"
#need to wait for Python 2.7 for this..
#logging.captureWarnings(True)
@ -152,7 +156,7 @@ def keyboardInterruptHandler(signum, frame):
logger.info('\nKeyboard Interrupt\n')
sys.exit(0)
def liquidsoap_running_test(telnet_lock, host, port, logger):
def liquidsoap_get_info(telnet_lock, host, port, logger):
logger.debug("Checking to see if Liquidsoap is running")
try:
telnet_lock.acquire()
@ -161,14 +165,47 @@ def liquidsoap_running_test(telnet_lock, host, port, logger):
tn.write(msg)
tn.write("exit\n")
response = tn.read_all()
logger.info("Found: %s", response)
except Exception, e:
logger.error(str(e))
return False
return None
finally:
telnet_lock.release()
return "Liquidsoap" in response
return get_liquidsoap_version(response)
def get_liquidsoap_version(version_string):
m = re.match(r"Liquidsoap (\d+.\d+.\d+)", "Liquidsoap 1.1.1")
if m:
return m.group(1)
else:
return None
if m:
current_version = m.group(1)
return pure.version_cmp(current_version, LIQUIDSOAP_MIN_VERSION) >= 0
return False
def liquidsoap_startup_test():
liquidsoap_version_string = \
liquidsoap_get_info(telnet_lock, ls_host, ls_port, logger)
while not liquidsoap_version_string:
logger.warning("Liquidsoap doesn't appear to be running!, " + \
"Sleeping and trying again")
time.sleep(1)
liquidsoap_version_string = \
liquidsoap_get_info(telnet_lock, ls_host, ls_port, logger)
while pure.version_cmp(liquidsoap_version_string, LIQUIDSOAP_MIN_VERSION) < 0:
logger.warning("Liquidsoap is running but in incorrect version! " + \
"Make sure you have at least Liquidsoap %s installed" % LIQUIDSOAP_MIN_VERSION)
time.sleep(1)
liquidsoap_version_string = \
liquidsoap_get_info(telnet_lock, ls_host, ls_port, logger)
logger.info("Liquidsoap version string found %s" % liquidsoap_version_string)
if __name__ == '__main__':
@ -204,9 +241,8 @@ if __name__ == '__main__':
ls_host = config['ls_host']
ls_port = config['ls_port']
while not liquidsoap_running_test(telnet_lock, ls_host, ls_port, logger):
logger.warning("Liquidsoap not started yet. Sleeping one second and trying again")
time.sleep(1)
liquidsoap_startup_test()
if options.test:
g.test_api()

View File

@ -528,10 +528,6 @@ class PypoFetch(Thread):
def main(self):
# Bootstrap: since we are just starting up, we need to grab the
# most recent schedule. After that we can just wait for updates.
success = self.persistent_manual_schedule_fetch(max_attempts=5)
#Make sure all Liquidsoap queues are empty. This is important in the
#case where we've just restarted the pypo scheduler, but Liquidsoap still
#is playing tracks. In this case let's just restart everything from scratch
@ -539,6 +535,10 @@ class PypoFetch(Thread):
#Liquidsoap is playing much more easily.
self.pypo_liquidsoap.clear_all_queues()
# Bootstrap: since we are just starting up, we need to grab the
# most recent schedule. After that we can just wait for updates.
success = self.persistent_manual_schedule_fetch(max_attempts=5)
if success:
self.logger.info("Bootstrap schedule received: %s", self.schedule_data)
self.set_bootstrap_variables()