Merge branch '2.2.x-saas' of dev.sourcefabric.org:airtime into 2.2.x-saas

This commit is contained in:
denise 2012-11-05 17:08:49 -05:00
commit 41cb6b2b0b
16 changed files with 124 additions and 48 deletions

View file

@ -95,7 +95,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
if (strpos($_SERVER['REQUEST_URI'], $baseUrl.'/Dashboard/stream-player') === false if (strpos($_SERVER['REQUEST_URI'], $baseUrl.'/Dashboard/stream-player') === false
&& strpos($_SERVER['REQUEST_URI'], $baseUrl.'/audiopreview/audio-preview') === false && strpos($_SERVER['REQUEST_URI'], $baseUrl.'/audiopreview/audio-preview') === false
&& strpos($_SERVER['REQUEST_URI'], $baseUrl.'/audiopreview/playlist-preview') === false) { && strpos($_SERVER['REQUEST_URI'], $baseUrl.'/audiopreview/playlist-preview') === false
&& strpos($_SERVER['REQUEST_URI'], $baseUrl.'/audiopreview/block-preview') === false) {
$client_id = Application_Model_Preference::GetClientId(); $client_id = Application_Model_Preference::GetClientId();
$view->headScript()->appendScript("var livechat_client_id = '$client_id';"); $view->headScript()->appendScript("var livechat_client_id = '$client_id';");
$view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');

View file

@ -686,6 +686,22 @@ class ApiController extends Zend_Controller_Action
Logging::info("Registered Component: ".$component."@".$remoteAddr); Logging::info("Registered Component: ".$component."@".$remoteAddr);
Application_Model_ServiceRegister::Register($component, $remoteAddr); Application_Model_ServiceRegister::Register($component, $remoteAddr);
//send ip, subdomain
if (Application_Model_Preference::GetPlanLevel() != 'disabled'){
if ($component == "pypo"){
$split = explode('.', $_SERVER['SERVER_NAME']);
if (count($split) > 0){
$subDomain = $split[0];
$md = array();
$md["sub_domain"] = $subDomain;
$md["pypo_ip"] = $remoteAddr;
Application_Model_RabbitMq::SendMessageToHaproxyConfigDaemon($md);
}
}
}
} }
public function updateLiquidsoapStatusAction() public function updateLiquidsoapStatusAction()

View file

@ -53,7 +53,6 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetMailServerRequiresAuth($values["preferences_email_server"]["msRequiresAuth"]); Application_Model_Preference::SetMailServerRequiresAuth($values["preferences_email_server"]["msRequiresAuth"]);
} }
Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]);
Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]); Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]);
Application_Model_Preference::SetSoundCloudDownloadbleOption($values["preferences_soundcloud"]["SoundCloudDownloadbleOption"]); Application_Model_Preference::SetSoundCloudDownloadbleOption($values["preferences_soundcloud"]["SoundCloudDownloadbleOption"]);
Application_Model_Preference::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]); Application_Model_Preference::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]);

View file

@ -18,7 +18,7 @@ class SystemstatusController extends Zend_Controller_Action
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(), "pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(), "liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
"media-monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus(), "media-monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus(),
"rabbitmq-server"=>Application_Model_Systemstatus::GetRabbitMqStatus() //"rabbitmq-server"=>Application_Model_Systemstatus::GetRabbitMqStatus()
); );
$partitions = Application_Model_Systemstatus::GetDiskInfo(); $partitions = Application_Model_Systemstatus::GetDiskInfo();

View file

@ -11,16 +11,6 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
array('ViewScript', array('viewScript' => 'form/preferences_soundcloud.phtml')) array('ViewScript', array('viewScript' => 'form/preferences_soundcloud.phtml'))
)); ));
//enable soundcloud uploads
$this->addElement('checkbox', 'UseSoundCloud', array(
'label' => 'Automatically Upload Recorded Shows',
'required' => false,
'value' => Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud(),
'decorators' => array(
'ViewHelper'
)
));
//enable soundcloud uploads option //enable soundcloud uploads option
$this->addElement('checkbox', 'UploadToSoundcloudOption', array( $this->addElement('checkbox', 'UploadToSoundcloudOption', array(
'label' => 'Enable SoundCloud Upload', 'label' => 'Enable SoundCloud Upload',

View file

@ -71,4 +71,46 @@ class Application_Model_RabbitMq
self::sendMessage($exchange, $data); self::sendMessage($exchange, $data);
} }
public static function SendMessageToHaproxyConfigDaemon($md){
$config = parse_ini_file("/etc/airtime-saas/rabbitmq.ini", true);
$conn = new AMQPConnection($config["rabbitmq"]["host"],
$config["rabbitmq"]["port"],
$config["rabbitmq"]["user"],
$config["rabbitmq"]["password"],
$config["rabbitmq"]["vhost"]);
$exchange = $config["rabbitmq"]["queue"];
$queue = $config["rabbitmq"]["queue"];
$ch = $conn->channel();
/*
name: $queue
passive: false
durable: true // the queue will survive server restarts
exclusive: false // the queue can be accessed in other channels
auto_delete: false //the queue won't be deleted once the channel is closed.
*/
$ch->queue_declare($queue, false, true, false, false);
/*
name: $exchange
type: direct
passive: false
durable: true // the exchange will survive server restarts
auto_delete: false //the exchange won't be deleted once the channel is closed.
*/
$ch->exchange_declare($exchange, 'direct', false, true, false);
$ch->queue_bind($queue, $exchange);
$data = json_encode($md).PHP_EOL;
$msg = new AMQPMessage($data, array('content_type' => 'application/json'));
$ch->basic_publish($msg, $exchange);
$ch->close();
$conn->close();
}
} }

View file

@ -263,6 +263,15 @@ SQL;
global $CC_CONFIG; global $CC_CONFIG;
$con = Propel::getConnection(); $con = Propel::getConnection();
$p_start_str = $p_start->format("Y-m-d H:i:s");
$p_end_str = $p_end->format("Y-m-d H:i:s");
//We need to search 24 hours before and after the show times so that that we
//capture all of the show's contents.
$p_track_start= $p_start->sub(new DateInterval("PT24H"))->format("Y-m-d H:i:s");
$p_track_end = $p_end->add(new DateInterval("PT24H"))->format("Y-m-d H:i:s");
$templateSql = <<<SQL $templateSql = <<<SQL
SELECT DISTINCT sched.starts AS sched_starts, SELECT DISTINCT sched.starts AS sched_starts,
sched.ends AS sched_ends, sched.ends AS sched_ends,
@ -288,12 +297,12 @@ SQL;
$filesJoin = <<<SQL $filesJoin = <<<SQL
cc_schedule AS sched cc_schedule AS sched
JOIN cc_files AS ft ON (sched.file_id = ft.id JOIN cc_files AS ft ON (sched.file_id = ft.id
AND ((sched.starts >= '{$p_start}' AND ((sched.starts >= '{$p_track_start}'
AND sched.starts < '{$p_end}') AND sched.starts < '{$p_track_end}')
OR (sched.ends > '{$p_start}' OR (sched.ends > '{$p_track_start}'
AND sched.ends <= '{$p_end}') AND sched.ends <= '{$p_track_end}')
OR (sched.starts <= '{$p_start}' OR (sched.starts <= '{$p_track_start}'
AND sched.ends >= '{$p_end}')) AND sched.ends >= '{$p_track_end}'))
) )
SQL; SQL;
@ -315,12 +324,12 @@ SQL;
$streamJoin = <<<SQL $streamJoin = <<<SQL
cc_schedule AS sched cc_schedule AS sched
JOIN cc_webstream AS ws ON (sched.stream_id = ws.id JOIN cc_webstream AS ws ON (sched.stream_id = ws.id
AND ((sched.starts >= '{$p_start}' AND ((sched.starts >= '{$p_track_start}'
AND sched.starts < '{$p_end}') AND sched.starts < '{$p_track_end}')
OR (sched.ends > '{$p_start}' OR (sched.ends > '{$p_track_start}'
AND sched.ends <= '{$p_end}') AND sched.ends <= '{$p_track_end}')
OR (sched.starts <= '{$p_start}' OR (sched.starts <= '{$p_track_start}'
AND sched.ends >= '{$p_end}')) AND sched.ends >= '{$p_track_end}'))
) )
LEFT JOIN cc_subjs AS sub ON (ws.creator_id = sub.id) LEFT JOIN cc_subjs AS sub ON (ws.creator_id = sub.id)
SQL; SQL;
@ -358,12 +367,12 @@ SELECT showt.name AS show_name,
JOIN cc_show AS showt ON (showt.id = si.show_id) JOIN cc_show AS showt ON (showt.id = si.show_id)
WHERE si.modified_instance = FALSE WHERE si.modified_instance = FALSE
$showPredicate $showPredicate
AND ((si.starts >= '{$p_start}' AND ((si.starts >= '{$p_start_str}'
AND si.starts < '{$p_end}') AND si.starts < '{$p_end_str}')
OR (si.ends > '{$p_start}' OR (si.ends > '{$p_start_str}'
AND si.ends <= '{$p_end}') AND si.ends <= '{$p_end_str}')
OR (si.starts <= '{$p_start}' OR (si.starts <= '{$p_start_str}'
AND si.ends >= '{$p_end}')) AND si.ends >= '{$p_end_str}'))
ORDER BY si_starts, ORDER BY si_starts,
sched_starts; sched_starts;
SQL; SQL;

View file

@ -423,8 +423,7 @@ class Application_Model_ShowBuilder
} }
$scheduled_items = Application_Model_Schedule::GetScheduleDetailItems( $scheduled_items = Application_Model_Schedule::GetScheduleDetailItems(
$this->startDT->format("Y-m-d H:i:s"), $this->endDT->format( $this->startDT, $this->endDT, $shows);
"Y-m-d H:i:s"), $shows);
for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) { for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) {

View file

@ -329,14 +329,24 @@ class Application_Model_User
$res = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables); $res = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
// mark record which is for the current user // mark record which is for the current user
foreach ($res['aaData'] as &$record) { foreach($res['aaData'] as $key => &$record){
if ($record['login'] == $username) { if ($record['login'] == $username) {
$record['delete'] = "self"; $record['delete'] = "self";
} else { } else {
$record['delete'] = ""; $record['delete'] = "";
} }
if($record['login'] == 'sourcefabric_admin'){
//arrays in PHP are basically associative arrays that can be iterated in order.
//Deleting an earlier element does not change the keys of elements that come after it. --MK
unset($res['aaData'][$key]);
$res['iTotalDisplayRecords']--;
$res['iTotalRecords']--;
}
} }
$res['aaData'] = array_values($res['aaData']);
return $res; return $res;
} }

View file

@ -13,19 +13,6 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dd id="UseSoundCloud-element" class="block-display" style="padding-left:20px; margin:6px 0 10px 0">
<label class="optional" for="UseSoundCloud">
<?php echo $this->element->getElement('UseSoundCloud') ?>
<strong><?php echo $this->element->getElement('UseSoundCloud')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('UseSoundCloud')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('UseSoundCloud')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dd id="SoundCloudDownloadbleOption-element" class="block-display" style="padding-left:20px; margin:6px 0 10px 0"> <dd id="SoundCloudDownloadbleOption-element" class="block-display" style="padding-left:20px; margin:6px 0 10px 0">
<label class="optional" for="SoundCloudDownloadbleOption"> <label class="optional" for="SoundCloudDownloadbleOption">
<?php echo $this->element->getElement('SoundCloudDownloadbleOption') ?> <?php echo $this->element->getElement('SoundCloudDownloadbleOption') ?>

View file

@ -1,3 +1,14 @@
2.2.0 - October 25th, 2012
* New features
* Smart Playlists
* Webstream rebroadcasts
* Replaygain support
* FLAC + WAV support (AAC if you compile your own Liquidsoap)
* Huge performance increase on library import
* User ownership of files
* Stereo/mono streams
* Rescan watched folders button (useful for network drives where keeping in sync is more difficult)
2.1.3 - July 4th, 2012 2.1.3 - July 4th, 2012
* Changes * Changes
* Clarify inputs and output labels under stream settings * Clarify inputs and output labels under stream settings

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import time
import media.monitor.pure as mmp import media.monitor.pure as mmp
import media.monitor.owners as owners import media.monitor.owners as owners
from media.monitor.handler import ReportHandler from media.monitor.handler import ReportHandler
@ -72,9 +72,13 @@ class Organizer(ReportHandler,Loggable):
directory=d) directory=d)
return cb return cb
time.sleep(0.05)
mmp.magic_move(event.path, new_path, mmp.magic_move(event.path, new_path,
after_dir_make=new_dir_watch(dirname(new_path))) after_dir_make=new_dir_watch(dirname(new_path)))
time.sleep(0.05)
# The reason we need to go around saving the owner in this ass # The reason we need to go around saving the owner in this ass
# backwards way is bewcause we are unable to encode the owner id # backwards way is bewcause we are unable to encode the owner id
# into the file itself so that the StoreWatchListener listener can # into the file itself so that the StoreWatchListener listener can

View file

@ -2,6 +2,8 @@
AirtimeCheck::ExitIfNotRoot(); AirtimeCheck::ExitIfNotRoot();
date_default_timezone_set("UTC");
$sapi_type = php_sapi_name(); $sapi_type = php_sapi_name();
$showColor = !in_array("--no-color", $argv); $showColor = !in_array("--no-color", $argv);

View file

@ -2,6 +2,8 @@
exitIfNotRoot(); exitIfNotRoot();
date_default_timezone_set("UTC");
$airtimeIni = getAirtimeConf(); $airtimeIni = getAirtimeConf();
$airtime_base_dir = $airtimeIni['general']['airtime_dir']; $airtime_base_dir = $airtimeIni['general']['airtime_dir'];

View file

@ -2,6 +2,8 @@
exitIfNotRoot(); exitIfNotRoot();
date_default_timezone_set("UTC");
$values = parse_ini_file('/etc/airtime/airtime.conf', true); $values = parse_ini_file('/etc/airtime/airtime.conf', true);
// Name of the web server user // Name of the web server user

View file

@ -1,4 +1,6 @@
<?php <?php
date_default_timezone_set("UTC");
$values = parse_ini_file('/etc/airtime/airtime.conf', true); $values = parse_ini_file('/etc/airtime/airtime.conf', true);
// Name of the web server user // Name of the web server user