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

Conflicts:
	VERSION
	airtime_mvc/application/configs/conf.php
	airtime_mvc/application/models/Playlist.php
	airtime_mvc/application/models/Schedule.php
	airtime_mvc/application/models/Shows.php
	airtime_mvc/application/models/StoredFile.php
	airtime_mvc/application/views/scripts/form/preferences_general.phtml
	airtime_mvc/application/views/scripts/user/remove-user.phtml
	airtime_mvc/public/js/airtime/schedule/add-show.js
	airtime_mvc/public/js/airtime/schedule/schedule.js
	install/airtime-upgrade.php
	install/include/AirtimeInstall.php
	python_apps/api_clients/api_client.py
	utils/airtime-clean-storage
	utils/airtime-clean-storage.php
	utils/airtime-import
	utils/airtime-import.php
This commit is contained in:
Paul Baranowski 2011-04-25 17:24:53 -04:00
commit eb76bbe7f0
17 changed files with 254 additions and 129 deletions

View File

@ -1,2 +1,2 @@
PRODUCT_ID=Airtime
PRODUCT_RELEASE=1.8.0
PRODUCT_RELEASE=1.9.0-beta

View File

@ -5,8 +5,8 @@
* /etc/airtime/pypo.cfg
* /etc/airtime/recorder.cfg
*/
define('AIRTIME_VERSION', '1.8.0');
define('AIRTIME_VERSION', '1.9.0-beta');
define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
define('AIRTIME_REST_VERSION', '1.1');
@ -44,7 +44,7 @@ $CC_CONFIG = array(
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
'soundcloud-connection-retries' => $values['soundcloud']['connection_retries'],
'soundcloud-connection-wait' => $values['soundcloud']['time_between_retries'],
'soundcloud-connection-wait' => $values['soundcloud']['time_between_retries'],
"rootDir" => __DIR__."/../..",
'pearPath' => dirname(__FILE__).'/../../library/pear',
@ -86,7 +86,7 @@ set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath']
function load_airtime_config(){
$ini_array = parse_ini_file('/etc/airtime/airtime.conf', true);
return $ini_array;
}
}
class Config {
public static function reload_config() {

View File

@ -60,7 +60,6 @@ class ScheduleGroup {
if (empty($length)) {
return new PEAR_Error("Length is empty.");
}
// Insert into the table
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");

View File

@ -128,26 +128,26 @@ class Show {
* then all show instances that occur on Sunday are removed.
*
* @param array p_uncheckedDays
* An array specifying which days
* An array specifying which days
*/
public function removeUncheckedDaysInstances($p_uncheckedDays)
{
global $CC_DBC;
$uncheckedDaysImploded = implode(",", $p_uncheckedDays);
$showId = $this->getId();
$date = new DateHelper;
$timestamp = $date->getTimestamp();
$sql = "DELETE FROM cc_show_instances"
." WHERE EXTRACT(DOW FROM starts) IN ($uncheckedDaysImploded)"
." AND starts > TIMESTAMP '$timestamp'"
." AND show_id = $showId";
$CC_DBC->query($sql);
$CC_DBC->query($sql);
}
/**
* Check whether the current show originated
* from a recording.
@ -178,7 +178,7 @@ class Show {
->filterByDbRebroadcast(1)
->findOne();
return !is_null($showInstancesRow);
return !is_null($showInstancesRow);
}
/**
@ -187,12 +187,12 @@ class Show {
* YYYY-MM-DD and time would HH:MM
*
* @return array
* array of associate arrays containing "start_date" and "start_time"
* array of associate arrays containing "start_date" and "start_time"
*/
public function getRebroadcastsAbsolute()
{
global $CC_DBC;
$showId = $this->getId();
$sql = "SELECT date(starts) "
."FROM cc_show_instances "
@ -207,7 +207,7 @@ class Show {
$sql = "SELECT date(DATE '$baseDate' + day_offset::INTERVAL) as start_date, start_time FROM cc_show_rebroadcast "
."WHERE show_id = $showId "
."ORDER BY start_date";
return $CC_DBC->GetAll($sql);
}
@ -217,20 +217,20 @@ class Show {
* "x days" and time would HH:MM:SS
*
* @return array
* array of associate arrays containing "day_offset" and "start_time"
* array of associate arrays containing "day_offset" and "start_time"
*/
public function getRebroadcastsRelative()
{
global $CC_DBC;
$showId = $this->getId();
$sql = "SELECT day_offset, start_time FROM cc_show_rebroadcast "
."WHERE show_id = $showId "
."ORDER BY day_offset";
return $CC_DBC->GetAll($sql);
}
/**
* Check whether the current show is set to repeat
* repeating shows.
@ -249,11 +249,11 @@ class Show {
} else
return false;
}
/**
* Get the repeat type of the show. Show can have repeat
* type of "weekly", "bi-weekly" and "monthly". These values
* are represented by 0, 1, and 2 respectively.
* are represented by 0, 1, and 2 respectively.
*
* @return int
* Return the integer corresponding to the repeat type.
@ -279,13 +279,14 @@ class Show {
*/
public function getRepeatingEndDate(){
global $CC_DBC;
$showId = $this->getId();
$sql = "SELECT last_show FROM cc_show_days"
." WHERE show_id = $showId";
." WHERE show_id = $showId"
." ORDER BY last_show DESC";
$endDate = $CC_DBC->GetOne($sql);
if (is_null($endDate)){
return "";
} else {
@ -308,8 +309,8 @@ class Show {
$sql = "DELETE FROM cc_show_instances"
." WHERE starts > TIMESTAMP '$timestamp'"
." AND show_id = $showId";
$CC_DBC->query($sql);
$CC_DBC->query($sql);
}
/**
@ -330,8 +331,8 @@ class Show {
." WHERE date(starts) > DATE '$p_date'"
." AND starts > TIMESTAMP '$timestamp'"
." AND show_id = $showId";
$CC_DBC->query($sql);
$CC_DBC->query($sql);
}
/**
@ -352,8 +353,8 @@ class Show {
." WHERE date(starts) < DATE '$p_date'"
." AND starts > TIMESTAMP '$timestamp'"
." AND show_id = $showId";
$CC_DBC->query($sql);
$CC_DBC->query($sql);
}
/**
@ -361,16 +362,17 @@ class Show {
*
* @return string
* The start date in the format YYYY-MM-DD
*/
*/
public function getStartDate(){
global $CC_DBC;
$showId = $this->getId();
$sql = "SELECT first_show FROM cc_show_days"
." WHERE show_id = $showId";
." WHERE show_id = $showId"
." ORDER BY first_show";
$firstDate = $CC_DBC->GetOne($sql);
if (is_null($firstDate)){
return "";
} else {
@ -383,16 +385,16 @@ class Show {
*
* @return string
* The start time in the format HH:MM:SS
*/
*/
public function getStartTime(){
global $CC_DBC;
$showId = $this->getId();
$sql = "SELECT start_time FROM cc_show_days"
." WHERE show_id = $showId";
$startTime = $CC_DBC->GetOne($sql);
if (is_null($startTime)){
return "";
} else {
@ -405,18 +407,18 @@ class Show {
*
* @return array
* A simple array containing all future instance ID's
*/
*/
public function getAllFutureInstanceIds(){
global $CC_DBC;
$date = new DateHelper;
$timestamp = $date->getTimestamp();
$showId = $this->getId();
$sql = "SELECT id from cc_show_instances"
." WHERE show_id = $showId"
." AND starts > TIMESTAMP '$timestamp'";
$rows = $CC_DBC->GetAll($sql);
$instance_ids = array();
@ -425,36 +427,36 @@ class Show {
}
return $instance_ids;
}
private function updateDurationTime($p_data){
//need to update cc_show_instances, cc_show_days
global $CC_DBC;
$date = new DateHelper;
$timestamp = $date->getTimestamp();
$sql = "UPDATE cc_show_days "
."SET duration = '$p_data[add_show_duration]' "
."WHERE show_id = $p_data[add_show_id]";
$CC_DBC->query($sql);
$sql = "UPDATE cc_show_instances "
."SET ends = starts + INTERVAL '$p_data[add_show_duration]' "
."WHERE show_id = $p_data[add_show_id] "
."AND starts > TIMESTAMP '$timestamp'";
."AND starts > TIMESTAMP '$timestamp'";
$CC_DBC->query($sql);
}
private function updateStartDateTime($p_data, $p_endDate){
//need to update cc_schedule, cc_show_instances, cc_show_days
global $CC_DBC;
$date = new DateHelper;
$timestamp = $date->getTimestamp();
$sql = "UPDATE cc_show_days "
."SET start_time = TIME '$p_data[add_show_start_time]', "
."first_show = DATE '$p_data[add_show_start_date]', ";
@ -465,7 +467,7 @@ class Show {
}
$sql .= "WHERE show_id = $p_data[add_show_id]";
$CC_DBC->query($sql);
$oldStartDateTimeEpoch = strtotime($this->getStartDate()." ".$this->getStartTime());
$newStartDateTimeEpoch = strtotime($p_data['add_show_start_date']." ".$p_data['add_show_start_time']);
$diff = $newStartDateTimeEpoch - $oldStartDateTimeEpoch;
@ -474,61 +476,61 @@ class Show {
."SET starts = starts + INTERVAL '$diff sec', "
."ends = ends + INTERVAL '$diff sec' "
."WHERE show_id = $p_data[add_show_id] "
."AND starts > TIMESTAMP '$timestamp'";
."AND starts > TIMESTAMP '$timestamp'";
$CC_DBC->query($sql);
$showInstanceIds = $this->getAllFutureInstanceIds();
if (count($showInstanceIds) > 0 && $diff != 0){
$showIdsImploded = implode(",", $showInstanceIds);
$sql = "UPDATE cc_schedule "
."SET starts = starts + INTERVAL '$diff sec', "
."ends = ends + INTERVAL '$diff sec' "
."WHERE instance_id IN ($showIdsImploded)";
."WHERE instance_id IN ($showIdsImploded)";
$CC_DBC->query($sql);
}
}
public function getDuration(){
$showDay = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->findOne();
return $showDay->getDbDuration();
return $showDay->getDbDuration();
}
public function getShowDays(){
$showDays = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->find();
$days = array();
foreach ($showDays as $showDay){
array_push($days, $showDay->getDbDay());
}
return $days;
}
public function hasInstance(){
return (!is_null($this->getInstance()));
}
public function getInstance(){
$showInstances = CcShowInstancesQuery::create()->filterByDbShowId($this->getId())->findOne();
return $showInstances;
}
public function hasInstanceOnDate($p_timestamp){
return (!is_null($this->getInstanceOnDate($p_timestamp)));
}
public function getInstanceOnDate($p_timestamp){
global $CC_DBC;
$showId = $this->getId();
$sql = "SELECT id FROM cc_show_instances"
." WHERE date(starts) = date(TIMESTAMP '$p_timestamp') "
." AND show_id = $showId";
$row = $CC_DBC->GetOne($sql);
return CcShowInstancesQuery::create()->findPk($row);
}
public static function deletePossiblyInvalidInstances($p_data, $p_show, $p_endDate, $isRecorded, $repeatType)
{
if ($p_data['add_show_repeats'] != $p_show->isRepeating()
@ -541,17 +543,17 @@ class Show {
//duration has changed
$p_show->updateDurationTime($p_data);
}
if ($p_data['add_show_repeats']){
if ($p_data['add_show_start_date'] != $p_show->getStartDate()
|| $p_data['add_show_start_time'] != $p_show->getStartTime()){
//start date/time has changed
$newDate = strtotime($p_data['add_show_start_date']);
$oldDate = strtotime($p_show->getStartDate());
if ($newDate > $oldDate){
$p_show->removeAllInstancesBeforeDate($p_data['add_show_start_date']);
}
}
$p_show->updateStartDateTime($p_data, $p_endDate);
}
@ -572,16 +574,16 @@ class Show {
} else {
$repeatingDaysChanged = true;
}
if ($repeatingDaysChanged){
$daysRemoved = array_diff($showDaysArray, $p_data['add_show_day_check']);
if (count($daysRemoved) > 0){
$p_show->removeUncheckedDaysInstances($daysRemoved);
}
}
}
//Check if end date for the repeat option has changed. If so, need to take care
//of deleting possible invalid Show Instances.
if ((strlen($p_show->getRepeatingEndDate()) == 0) == $p_data['add_show_no_end']){
@ -593,7 +595,7 @@ class Show {
}
if ($p_show->getRepeatingEndDate() != $p_data['add_show_end_date']){
//end date was changed.
$newDate = strtotime($p_data['add_show_end_date']);
$oldDate = strtotime($p_show->getRepeatingEndDate());
if ($newDate < $oldDate){
@ -662,17 +664,17 @@ class Show {
$show = new Show($showId);
$isRecorded = ($data['add_show_record']) ? 1 : 0;
if ($data['add_show_id'] != -1){
Show::deletePossiblyInvalidInstances($data, $show, $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();
@ -853,7 +855,7 @@ class Show {
$sql = "SELECT timestamp '{$start}' + interval '{$duration}'";
$end = $CC_DBC->GetOne($sql);
$show = new Show($show_id);
if ($show->hasInstance()){
$ccShowInstance = $show->getInstance();
@ -862,7 +864,7 @@ class Show {
$ccShowInstance = new CcShowInstances();
$newInstance = true;
}
$ccShowInstance->setDbShowId($show_id);
$ccShowInstance->setDbStarts($start);
$ccShowInstance->setDbEnds($end);
@ -875,7 +877,7 @@ class Show {
if (!$newInstance){
$showInstance->correctScheduleStartTimes();
}
$sql = "SELECT * FROM cc_show_rebroadcast WHERE show_id={$show_id}";
$rebroadcasts = $CC_DBC->GetAll($sql);
@ -925,7 +927,7 @@ class Show {
$sql = "SELECT timestamp '{$start}' + interval '{$duration}'";
$end = $CC_DBC->GetOne($sql);
if ($show->hasInstanceOnDate($start)){
$ccShowInstance = $show->getInstanceOnDate($start);
$newInstance = false;
@ -1098,7 +1100,7 @@ class Show {
return $events;
}
private static function makeFullCalendarEvent($show, $options=array())
private static function makeFullCalendarEvent($show, $options=array())
{
$event = array();
@ -1123,7 +1125,7 @@ class Show {
}
if($show["background_color"] != "") {
$event["color"] = "#".$show["background_color"];
}
}
foreach($options as $key=>$value) {
$event[$key] = $value;
@ -1136,12 +1138,12 @@ class Show {
$explode = explode(" ", $p_timestamp);
return $explode[0];
}
public static function getTimeFromTimestamp($p_timestamp){
$explode = explode(" ", $p_timestamp);
return $explode[1];
}
/**
* This function formats a time by removing seconds
*
@ -1238,7 +1240,7 @@ class ShowInstance {
return $showStartExplode[1];
}
public function setSoundCloudFileId($p_soundcloud_id)
{
$showInstance = CcShowInstancesQuery::create()->findPK($this->_instanceId);
@ -1268,7 +1270,7 @@ class ShowInstance {
return $file;
}
}
return null;
}
@ -1297,7 +1299,7 @@ class ShowInstance {
public function correctScheduleStartTimes(){
global $CC_DBC;
$instance_id = $this->getShowInstanceId();
$sql = "SELECT starts from cc_schedule"
." WHERE instance_id = $instance_id"
@ -1305,7 +1307,7 @@ class ShowInstance {
." LIMIT 1";
$scheduleStarts = $CC_DBC->GetOne($sql);
if (!is_null($scheduleStarts)){
$scheduleStartsEpoch = strtotime($scheduleStarts);
$showStartsEpoch = strtotime($this->getShowStart());
@ -1316,7 +1318,7 @@ class ShowInstance {
$sql = "UPDATE cc_schedule"
." SET starts = starts + INTERVAL '$diff' second,"
." ends = ends + INTERVAL '$diff' second"
." WHERE instance_id = $instance_id";
." WHERE instance_id = $instance_id";
$CC_DBC->query($sql);
}
@ -1551,7 +1553,7 @@ class ShowInstance {
$start_timestamp = $this->getShowStart();
$end_timestamp = $this->getShowEnd();
$time_filled = $this->getTimeScheduled();
$s_epoch = strtotime($start_timestamp);
$e_epoch = strtotime($end_timestamp);
$i_epoch = Schedule::WallTimeToMillisecs($time_filled) / 1000;

View File

@ -431,20 +431,16 @@ class StoredFile {
*
* @param string $p_gunid
* globally unique id of file
* @param boolean $p_autoload
* if TRUE, automatically load the row from the DB
*/
public function __construct($p_gunid=NULL, $p_autoload=TRUE)
public function __construct($p_gunid=NULL)
{
$this->gunid = $p_gunid;
if (empty($this->gunid)) {
$this->gunid = StoredFile::generateGunid();
}
else {
if ($p_autoload) {
$this->loadMetadata();
$this->exists = is_file($this->filepath) && is_readable($this->filepath);
}
$this->loadMetadata();
$this->exists = is_file($this->filepath) && is_readable($this->filepath);
}
}

View File

@ -31,12 +31,12 @@
<label class="optional"><?php echo $this->element->getElement('streamFormat')->getLabel() ?></label>
</dt>
<dd id="streamFormat-element" class="block-display radio-inline-list">
<?php $i=0;
<?php $i=0;
$value = $this->element->getElement('streamFormat')->getValue();
?>
<?php foreach ($this->element->getElement('streamFormat')->getMultiOptions() as $radio) : ?>
<label for="streamFormat-<?php echo $i ?>">
<input type="radio" value="<?php echo $i ?>" id="streamFormat-<?php echo $i ?>" name="streamFormat" <?php if($i == $value){echo 'checked="checked"';}?>/>
<input type="radio" value="<?php echo $i ?>" id="streamFormat-<?php echo $i ?>" name="streamFormat" <?php if($i == $value){echo 'checked="checked"';}?> >
<?php echo $radio ?>
</input>
</label>
@ -54,12 +54,12 @@
<label class="optional"><?php echo $this->element->getElement('thirdPartyApi')->getLabel() ?></label>
</dt>
<dd id="thirdPartyApi-element" class="block-display radio-inline-list">
<?php $i=0;
<?php $i=0;
$value = $this->element->getElement('thirdPartyApi')->getValue();
?>
<?php foreach ($this->element->getElement('thirdPartyApi')->getMultiOptions() as $radio) : ?>
<label for="thirdPartyApi-<?php echo $i ?>">
<input type="radio" value="<?php echo $i ?>" id="thirdPartyApi-<?php echo $i ?>" name="thirdPartyApi" <?php if($i == $value){echo 'checked="checked"';}?> />
<input type="radio" value="<?php echo $i ?>" id="thirdPartyApi-<?php echo $i ?>" name="thirdPartyApi" <?php if($i == $value){echo 'checked="checked"';}?>>
<?php echo $radio ?>
</input>
</label>
@ -71,7 +71,7 @@
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php endif; ?>
</dd>
</dl>

View File

@ -1,3 +1,3 @@
<?php
echo this->entries;
echo $this->entries;
?>

View File

@ -104,15 +104,17 @@ function setAddShowEvents() {
form.find("#add_show_rebroadcast").click(function(){
$(this).blur();
if($(this).attr('checked') && !form.find("#add_show_repeats").attr('checked')) {
form.find("#add_show_rebroadcast_absolute").show();
}
else if($(this).attr('checked') && form.find("#add_show_repeats").attr('checked')) {
form.find("#add_show_rebroadcast_relative").show();
}
else {
form.find("#schedule-record-rebroadcast > fieldset:not(:first-child)").hide();
}
if(form.find("#add_show_record").attr('checked')){
if($(this).attr('checked') && !form.find("#add_show_repeats").attr('checked')) {
form.find("#add_show_rebroadcast_absolute").show();
}
else if($(this).attr('checked') && form.find("#add_show_repeats").attr('checked')) {
form.find("#add_show_rebroadcast_relative").show();
}
else {
form.find("#schedule-record-rebroadcast > fieldset:not(:first-child)").hide();
}
}
});
form.find("#add_show_repeat_type").change(function(){

View File

@ -228,7 +228,7 @@ function buildScheduleDialog(json){
dialog.dialog({
autoOpen: false,
title: 'Schedule Playlist',
title: 'Schedule Media',
width: 1100,
height: 550,
modal: true,

View File

@ -14,13 +14,16 @@ require_once(dirname(__FILE__).'/include/AirtimeInstall.php');
AirtimeInstall::ExitIfNotRoot();
AirtimeInstall::DbConnect(true);
if(AirtimeInstall::DbTableExists('cc_show_rebroadcast') === true) {
$version = "1.7.0";
echo "Airtime Version: ".$version." ".PHP_EOL;
}
else {
$version = "1.6";
echo "Airtime Version: ".$version." ".PHP_EOL;
$version = AirtimeInstall::GetAirtimeVersion();
if (!$version){
if(AirtimeInstall::DbTableExists('cc_show_rebroadcast') === true) {
$version = "1.7.0";
echo "Airtime Version: ".$version." ".PHP_EOL;
}
else {
$version = "1.6";
echo "Airtime Version: ".$version." ".PHP_EOL;
}
}
echo "******************************** Update Begin *********************************".PHP_EOL;
@ -31,6 +34,9 @@ if(strcmp($version, "1.7.0") < 0) {
if(strcmp($version, "1.8.0") < 0) {
system("php ".__DIR__."/upgrades/airtime-1.8/airtime-upgrade.php");
}
if (strcmp($version, "1.9.0") < 0){
system("php ".__DIR__."/upgrades/airtime-1.9/airtime-upgrade.php");
}
AirtimeInstall::SetAirtimeVersion(AIRTIME_VERSION);

View File

@ -124,9 +124,9 @@ class AirtimeInstall
echo "* Creating Airtime database user".PHP_EOL;
// Create the database user
$command = "sudo -u postgres psql postgres --command \"CREATE USER {$CC_CONFIG['dsn']['username']} "
." ENCRYPTED PASSWORD '{$CC_CONFIG['dsn']['password']}' LOGIN CREATEDB NOCREATEUSER;\" 2>/dev/null";
$username = $CC_CONFIG['dsn']['username'];
$password = $CC_CONFIG['dsn']['password'];
$command = "echo \"CREATE USER $username ENCRYPTED PASSWORD '$password' LOGIN CREATEDB NOCREATEUSER;\" | sudo -u postgres psql";
@exec($command, $output, $results);
if ($results == 0) {
@ -148,7 +148,9 @@ class AirtimeInstall
echo "* Creating Airtime database".PHP_EOL;
$command = "sudo -u postgres createdb {$CC_CONFIG['dsn']['database']} --owner {$CC_CONFIG['dsn']['username']} 2> /dev/null";
$database = $CC_CONFIG['dsn']['database'];
$username = $CC_CONFIG['dsn']['username'];
$command = "echo \"CREATE DATABASE $database OWNER $username\" | sudo -u postgres psql";
@exec($command, $output, $results);
if ($results == 0) {
echo "* Database '{$CC_CONFIG['dsn']['database']}' created.".PHP_EOL;
@ -324,13 +326,13 @@ class AirtimeInstall
global $CC_CONFIG;
echo "* Creating logs directory ".AirtimeInstall::CONF_DIR_LOG.PHP_EOL;
$path = AirtimeInstall::CONF_DIR_LOG;
$file = $path.'/zendphp.log';
if (!file_exists($path)){
mkdir($path, 0755, true);
}
touch($file);
chmod($file, 0755);
chown($file, $CC_CONFIG['webServerUser']);
@ -340,7 +342,7 @@ class AirtimeInstall
public static function RemoveLogDirectories(){
$path = AirtimeInstall::CONF_DIR_LOG;
echo "* Removing logs directory ".$path.PHP_EOL;
exec("rm -rf $path");
}
}

View File

@ -0,0 +1,14 @@
<?php
/**
* @package Airtime
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
require_once __DIR__.'/../../../airtime_mvc/application/configs/conf.php';
require_once(dirname(__FILE__).'/../../include/AirtimeInstall.php');
require_once(dirname(__FILE__).'/../../include/AirtimeIni.php');
AirtimeInstall::CreateZendPhpLogFile();

View File

@ -180,7 +180,7 @@ class AirTimeApiClient(ApiClientInterface):
print 'Unable to get Airtime version number.'
print
return False
elif (version[0:4] != "1.8."):
elif (version[0:4] != "1.9."):
if (verbose):
print 'Airtime version: ' + str(version)
print 'pypo not compatible with this version of Airtime.'

View File

@ -0,0 +1,29 @@
api_client = "airtime"
# Hostname
base_url = 'localhost'
base_port = 80
# where the binary files live
bin_dir = '/usr/lib/airtime/media-monitor'
# base path to store recordered shows at
base_recorded_files = '/var/tmp/airtime/show-recorder/'
# where the logging files live
log_dir = '/var/log/airtime/show-recorder'
# Value needed to access the API
api_key = 'AAA'
# Path to the base of the API
api_base = 'api'
# URL to get the version number of the server API
version_url = 'version/api_key/%%api_key%%'
# URL to get the schedule of shows set to record
show_schedule_url = 'recorded-shows/format/json/api_key/%%api_key%%'
# URL to upload the recorded show's file to Airtime
upload_file_url = 'upload-recorded/format/json/api_key/%%api_key%%'

View File

@ -0,0 +1,52 @@
import os
import pyinotify
from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, ProcessEvent
# configure logging
try:
logging.config.fileConfig("logging.cfg")
except Exception, e:
print 'Error configuring logging: ', e
sys.exit()
# loading config file
try:
config = ConfigObj('/etc/airtime/recorder.cfg')
except Exception, e:
print 'Error loading config file: ', e
sys.exit()
# watched events
mask = pyinotify.ALL_EVENTS
wm = WatchManager()
wdd = wm.add_watch('/srv/airtime/stor', mask, rec=True)
class PTmp(ProcessEvent):
def process_IN_CREATE(self, event):
if event.dir :
global wm
wdd = wm.add_watch(event.pathname, mask, rec=True)
#print wdd.keys()
print "%s: %s" % (event.maskname, os.path.join(event.path, event.name))
def process_IN_MODIFY(self, event):
if not event.dir :
print event.path
print "%s: %s" % (event.maskname, os.path.join(event.path, event.name))
def process_default(self, event):
print "%s: %s" % (event.maskname, os.path.join(event.path, event.name))
if __name__ == '__main__':
try:
notifier = Notifier(wm, PTmp(), read_freq=2, timeout=1)
notifier.coalesce_events()
notifier.loop()
except KeyboardInterrupt:
notifier.stop()

View File

@ -0,0 +1,22 @@
[loggers]
keys=root
[handlers]
keys=consoleHandler
[formatters]
keys=simpleFormatter
[logger_root]
level=DEBUG
handlers=consoleHandler
[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=simpleFormatter
args=(sys.stdout,)
[formatter_simpleFormatter]
format=%(asctime)s %(levelname)s - [%(filename)s : %(funcName)s() : line %(lineno)d] - %(message)s
datefmt=

View File

@ -8,6 +8,7 @@ if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
echo "400 Not executable\r\n";
exit(1);
}
set_include_path('/var/www/airtime/library' . PATH_SEPARATOR . get_include_path());
set_include_path('/var/www/airtime/application/models' . PATH_SEPARATOR . get_include_path());
require_once('/var/www/airtime/application/configs/conf.php');