Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
martin 2011-08-30 12:19:07 -04:00
commit bf95c3df1c
13 changed files with 668 additions and 6 deletions

View File

@ -1,5 +1,6 @@
INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin'));
-- added in 2.0.0
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_type', 'ogg, mp3');
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
INSERT INTO cc_pref("keystr", "valstr") VALUES('num_of_streams', '3');
@ -42,6 +43,8 @@ INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_mount', '
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_url', '', 'string');
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_description', '', 'string');
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_genre', '', 'string');
-- end of added in 2.0.0
INSERT INTO cc_country (isocode, name) VALUES ('AFG', 'Afghanistan ');
INSERT INTO cc_country (isocode, name) VALUES ('ALA', 'Åland Islands');

View File

@ -0,0 +1,27 @@
<?php
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
class Version20110829143306 extends AbstractMigration
{
public function up(Schema $schema)
{
//create cc_stream_setting table
$cc_stream_setting = $schema->createTable('cc_stream_setting');
$cc_stream_setting->addColumn('keyname', 'string', array('length' => 64));
$cc_stream_setting->addColumn('value', 'string', array('length' => 255));
$cc_stream_setting->addColumn('type', 'string', array('length' => 16));
$cc_stream_setting->setPrimaryKey(array('keyname'));
//end create cc_stream_setting table
}
public function down(Schema $schema)
{
$schema->dropTable('cc_stream_setting');
}
}

View File

@ -4,7 +4,7 @@
xsi:schemaLocation="http://doctrine-project.org/schemas/migrations/configuration
http://doctrine-project.org/schemas/migrations/configuration.xsd">
<name>Airtime 1.9.0 Database Upgrade</name>
<name>Airtime 2.0.0 Database Upgrade</name>
<migrations-namespace>DoctrineMigrations</migrations-namespace>

View File

@ -0,0 +1,24 @@
set daemon 10 # Poll at 10 second intervals
#set logfile syslog facility log_daemon
set logfile /var/log/monit.log
set httpd port 2812 and use address 127.0.0.1
allow localhost
allow admin:monit
check process airtime-playout
with pidfile "/var/run/airtime-playout.pid"
start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds
stop program = "/etc/init.d/airtime-playout stop"
check process airtime-liquidsoap
with pidfile "/var/run/airtime-liquidsoap.pid"
start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds
stop program = "/etc/init.d/airtime-playout stop"
check process airtime-media-monitor
with pidfile "/var/run/airtime-media-monitor.pid"
start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-media-monitor stop"
check process airtime-show-recorder
with pidfile "/var/run/airtime-show-recorder.pid"
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-show-recorder stop"

View File

@ -31,6 +31,95 @@ class AirtimeInstall{
}
return true;
}
public static function SetDefaultStreamSetting()
{
global $CC_DBC;
$sql = "INSERT INTO cc_pref(keystr, valstr) VALUES('stream_type', 'ogg, mp3');
INSERT INTO cc_pref(keystr, valstr) VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
INSERT INTO cc_pref(keystr, valstr) VALUES('num_of_streams', '3');
INSERT INTO cc_pref(keystr, valstr) VALUES('max_bitrate', '128');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('output_sound_device', 'false', 'boolean');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_output', 'icecast', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_type', 'ogg', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_bitrate', '128', 'integer');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_host', '127.0.0.1', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_port', '8000', 'integer');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_user', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_pass', 'hackme', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_mount', 'airtime_128', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_url', 'http://airtime.sourcefabric.org', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_description', 'Airtime Radio! Stream #1', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_genre', 'genre', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_output', 'disabled', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_type', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_bitrate', '', 'integer');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_host', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_port', '', 'integer');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_user', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_pass', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_mount', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_url', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_description', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_genre', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_output', 'disabled', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_type', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_bitrate', '', 'integer');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_host', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_port', '', 'integer');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_user', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_pass', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_mount', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_url', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_description', '', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_genre', '', 'string');";
$result = $CC_DBC->query($sql);
if (PEAR::isError($result)) {
return false;
}
return true;
}
public static function BypassMigrations($dir, $version)
{
$appDir = AirtimeInstall::GetAirtimeSrcDir();
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
"--no-interaction --add migrations:version $version";
system($command);
}
public static function MigrateTablesToVersion($dir, $version)
{
$appDir = AirtimeInstall::GetAirtimeSrcDir();
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
"--no-interaction migrations:migrate $version";
system($command);
}
public static function GetAirtimeSrcDir()
{
return __DIR__."/../../../airtime_mvc";
}
public static function DbTableExists($p_name)
{
global $CC_DBC;
$sql = "SELECT * FROM ".$p_name;
$result = $CC_DBC->GetOne($sql);
if (PEAR::isError($result)) {
return false;
}
return true;
}
}
class Airtime200Upgrade{
@ -49,6 +138,16 @@ class Airtime200Upgrade{
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
}
public static function InstallAirtimePhpServerCode($phpDir)
{
$AIRTIME_SRC = realpath(__DIR__.'/../../../airtime_mvc');
echo "* Installing PHP code to ".$phpDir.PHP_EOL;
exec("mkdir -p ".$phpDir);
exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir);
}
}
class ConvertToUtc{
@ -119,10 +218,173 @@ class ConvertToUtc{
}
}
class AirtimeIni200{
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg";
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
const CONF_FILE_API_CLIENT = "/etc/airtime/api_client.cfg";
const CONF_FILE_MONIT = "/etc/monit/conf.d/airtime-monit.cfg";
/**
* This function updates an INI style config file.
*
* A property and the value the property should be changed to are
* supplied. If the property is not found, then no changes are made.
*
* @param string $p_filename
* The path the to the file.
* @param string $p_property
* The property to look for in order to change its value.
* @param string $p_value
* The value the property should be changed to.
*
*/
public static function UpdateIniValue($p_filename, $p_property, $p_value)
{
$lines = file($p_filename);
$n=count($lines);
foreach ($lines as &$line) {
if ($line[0] != "#"){
$key_value = explode("=", $line);
$key = trim($key_value[0]);
if ($key == $p_property){
$line = "$p_property = $p_value".PHP_EOL;
}
}
}
$fp=fopen($p_filename, 'w');
for($i=0; $i<$n; $i++){
fwrite($fp, $lines[$i]);
}
fclose($fp);
}
public static function ReadPythonConfig($p_filename)
{
$values = array();
$lines = file($p_filename);
$n=count($lines);
for ($i=0; $i<$n; $i++) {
if (strlen($lines[$i]) && !in_array(substr($lines[$i], 0, 1), array('#', PHP_EOL))){
$info = explode("=", $lines[$i]);
$values[trim($info[0])] = trim($info[1]);
}
}
return $values;
}
public static function MergeConfigFiles($configFiles, $suffix) {
foreach ($configFiles as $conf) {
// we want to use new liquidsoap.cfg so don't merge
// also for monit
if( $conf == AirtimeIni200::CONF_FILE_LIQUIDSOAP || $conf == AirtimeIni200::CONF_FILE_MONIT){
continue;
}
if (file_exists("$conf$suffix.bak")) {
if($conf === AirtimeIni200::CONF_FILE_AIRTIME) {
// Parse with sections
$newSettings = parse_ini_file($conf, true);
$oldSettings = parse_ini_file("$conf$suffix.bak", true);
}
else {
$newSettings = AirtimeIni200::ReadPythonConfig($conf);
$oldSettings = AirtimeIni200::ReadPythonConfig("$conf$suffix.bak");
}
$settings = array_keys($newSettings);
foreach($settings as $section) {
if(isset($oldSettings[$section])) {
if(is_array($oldSettings[$section])) {
$sectionKeys = array_keys($newSettings[$section]);
foreach($sectionKeys as $sectionKey) {
// skip airtim_dir as we want to use new value
if($sectionKey != "airtime_dir"){
if(isset($oldSettings[$section][$sectionKey])) {
AirtimeIni200::UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
}
}
}
}
else {
AirtimeIni200::UpdateIniValue($conf, $section, $oldSettings[$section]);
}
}
}
}
}
}
public static function upgradeConfigFiles(){
$configFiles = array(AirtimeIni200::CONF_FILE_AIRTIME,
AirtimeIni200::CONF_FILE_PYPO,
AirtimeIni200::CONF_FILE_RECORDER,
AirtimeIni200::CONF_FILE_LIQUIDSOAP,
AirtimeIni200::CONF_FILE_MONIT);
// Backup the config files
$suffix = date("Ymdhis")."-1.9.3";
foreach ($configFiles as $conf) {
// do not back up monit cfg
if (file_exists($conf) && $conf != AirtimeIni200::CONF_FILE_MONIT) {
echo "Backing up $conf to $conf$suffix.bak".PHP_EOL;
copy($conf, $conf.$suffix.".bak");
}
}
$default_suffix = "200";
AirtimeIni200::CreateIniFiles($default_suffix);
AirtimeIni200::MergeConfigFiles($configFiles, $suffix);
}
/**
* This function creates the /etc/airtime configuration folder
* and copies the default config files to it.
*/
public static function CreateIniFiles($suffix)
{
if (!file_exists("/etc/airtime/")){
if (!mkdir("/etc/airtime/", 0755, true)){
echo "Could not create /etc/airtime/ directory. Exiting.";
exit(1);
}
}
if (!copy(__DIR__."/airtime.conf.$suffix", AirtimeIni200::CONF_FILE_AIRTIME)){
echo "Could not copy airtime.conf to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/pypo.cfg.$suffix", AirtimeIni200::CONF_FILE_PYPO)){
echo "Could not copy pypo.cfg to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/recorder.cfg.$suffix", AirtimeIni200::CONF_FILE_RECORDER)){
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/liquidsoap.cfg.$suffix", AirtimeIni200::CONF_FILE_LIQUIDSOAP)){
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
exit(1);
}
if (!copy(__DIR__."/airtime-monit.cfg.$suffix", AirtimeIni200::CONF_FILE_MONIT)){
echo "Could not copy airtime-monit.cfg to /etc/monit/conf.d/. Exiting.";
exit(1);
}
}
}
Airtime200Upgrade::connectToDatabase();
AirtimeInstall::SetDefaultTimezone();
/* Airtime 2.0.0 starts interpreting all database times in UTC format. Prior to this, all the times
* were stored using the local time zone. Let's convert to UTC time. */
ConvertToUtc::convert_cc_playlist();
@ -130,4 +392,28 @@ ConvertToUtc::convert_cc_schedule();
ConvertToUtc::convert_cc_show_days();
ConvertToUtc::convert_cc_show_instances();
// merging/updating config files
echo "* Updating configFiles\n";
AirtimeIni200::upgradeConfigFiles();
$values = parse_ini_file(AirtimeIni200::CONF_FILE_AIRTIME, true);
$phpDir = $values['general']['airtime_dir'];
Airtime200Upgrade::InstallAirtimePhpServerCode($phpDir);
if(AirtimeInstall::DbTableExists('doctrine_migration_versions') === false) {
$migrations = array('20110312121200', '20110331111708', '20110402164819', '20110406182005', '20110629143017', '20110711161043', '20110713161043');
foreach($migrations as $migration) {
AirtimeInstall::BypassMigrations(__DIR__, $migration);
}
}
AirtimeInstall::MigrateTablesToVersion(__DIR__, '20110829143306');
AirtimeInstall::SetDefaultStreamSetting();
// restart monit
exec("service monit restart");

View File

@ -0,0 +1,23 @@
[database]
host = localhost
dbname = airtime
dbuser = airtime
dbpass = airtime
[rabbitmq]
host = 127.0.0.1
port = 5672
user = guest
password = guest
vhost = /
[general]
api_key = AAA
web_server_user = www-data
airtime_dir = /usr/share/airtime/
base_url = localhost
base_port = 80
[soundcloud]
connection_retries = 3
time_between_retries = 60

View File

@ -0,0 +1,110 @@
bin_dir = "/usr/lib/airtime/api_clients"
#############################
## Common
#############################
# 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%%'
# Hostname
base_url = 'localhost'
base_port = 80
#############################
## Config for Media Monitor
#############################
# URL to setup the media monitor
media_setup_url = 'media-monitor-setup/format/json/api_key/%%api_key%%'
# Tell Airtime the file id associated with a show instance.
upload_recorded = 'upload-recorded/format/json/api_key/%%api_key%%/fileid/%%fileid%%/showinstanceid/%%showinstanceid%%'
# URL to tell Airtime to update file's meta data
update_media_url = 'reload-metadata/format/json/api_key/%%api_key%%/mode/%%mode%%'
# URL to tell Airtime we want a listing of all files it knows about
list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%'
# URL to tell Airtime we want a listing of all dirs its watching (including the stor dir)
list_all_watched_dirs = 'list-all-watched-dirs/format/json/api_key/%%api_key%%'
# URL to tell Airtime we want to add watched directory
add_watched_dir = 'add-watched-dir/format/json/api_key/%%api_key%%/path/%%path%%'
# URL to tell Airtime we want to add watched directory
remove_watched_dir = 'remove-watched-dir/format/json/api_key/%%api_key%%/path/%%path%%'
# URL to tell Airtime we want to add watched directory
set_storage_dir = 'set-storage-dir/format/json/api_key/%%api_key%%/path/%%path%%'
#############################
## Config for Recorder
#############################
# 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-file/format/json/api_key/%%api_key%%'
#number of retries to upload file if connection problem
upload_retries = 3
#time to wait between attempts to upload file if connection problem (in seconds)
upload_wait = 60
################################################################################
# Uncomment *one of the sets* of values from the API clients below, and comment
# out all the others.
################################################################################
#############################
## Config for Pypo
#############################
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
export_url = 'schedule/api_key/%%api_key%%'
get_media_url = 'get-media/file/%%file%%/api_key/%%api_key%%'
# Update whether a schedule group has begun playing.
update_item_url = 'notify-schedule-group-play/api_key/%%api_key%%/schedule_id/%%schedule_id%%'
# Update whether an audio clip is currently playing.
update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/media_id/%%media_id%%/schedule_id/%%schedule_id%%'
# ???
generate_range_url = 'generate_range_dp.php'
##############
# OBP config #
##############
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View File

@ -0,0 +1,64 @@
###########################################
# Liquidsoap config file #
###########################################
###########################################
# Output settings #
###########################################
output_sound_device = false
s1_output = "icecast"
s2_output = "disabled"
s3_output = "disabled"
s1_type = "ogg"
s2_type = "ogg"
s3_type = "mp3"
s1_bitrate = 128
s2_bitrate = 128
s3_bitrate = 160
###########################################
# Logging settings #
###########################################
log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"
#log_level = 3
###########################################
# Icecast Stream settings #
###########################################
s1_host = "127.0.0.1"
s2_host = "127.0.0.1"
s3_host = "127.0.0.1"
s1_port = 8000
s2_port = 8000
s3_port = 8000
s1_user = ""
s2_user = ""
s3_user = ""
s1_pass = "hackme"
s2_pass = "hackme"
s3_pass = "hackme"
# Icecast mountpoint names
s1_mount = "airtime_128.ogg"
s2_mount = "airtime_128.ogg"
s3_mount = "airtime_160.mp3"
# Webstream metadata settings
s1_url = "http://airtime.sourcefabric.org"
s2_url = "http://airtime.sourcefabric.org"
s3_url = "http://airtime.sourcefabric.org"
s1_description = "Airtime Radio! stream1"
s2_description = "Airtime Radio! stream2"
s3_description = "Airtime Radio! stream3"
s1_genre = "genre"
s2_genre = "genre"
s3_genre = "genre"
# Audio stream metadata for vorbis/ogg is disabled by default
# due to a number of client media players that disconnect
# when the metadata changes to a new track. Some versions of
# mplayer and VLC have this problem. Enable this option at your
# own risk!
output_icecast_vorbis_metadata = false

View File

@ -0,0 +1,21 @@
api_client = "airtime"
# where the binary files live
bin_dir = '/usr/lib/airtime/media-monitor'
# where the logging files live
log_dir = '/var/log/airtime/media-monitor'
############################################
# RabbitMQ settings #
############################################
rabbitmq_host = 'localhost'
rabbitmq_user = 'guest'
rabbitmq_password = 'guest'
############################################
# Media-Monitor preferences #
############################################
check_filesystem_events = 5 #how long to queue up events performed on the files themselves.
check_airtime_events = 30 #how long to queue metadata input from airtime.

View File

@ -0,0 +1,72 @@
############################################
# pypo - configuration #
############################################
# Set the type of client you are using.
# Currently supported types:
# 1) "obp" = Open Broadcast Platform
# 2) "airtime"
#
api_client = "airtime"
############################################
# Cache Directories #
# *include* trailing slash !! #
############################################
cache_dir = '/var/tmp/airtime/pypo/cache/'
file_dir = '/var/tmp/airtime/pypo/files/'
tmp_dir = '/var/tmp/airtime/pypo/tmp/'
############################################
# Setup Directories #
# Do *not* include trailing slash !! #
############################################
cache_base_dir = '/var/tmp/airtime/pypo'
bin_dir = '/usr/lib/airtime/pypo'
log_base_dir = '/var/log/airtime'
pypo_log_dir = '/var/log/airtime/pypo'
liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap'
############################################
# Liquidsoap settings #
############################################
ls_host = '127.0.0.1'
ls_port = '1234'
############################################
# RabbitMQ settings #
############################################
rabbitmq_host = 'localhost'
rabbitmq_user = 'guest'
rabbitmq_password = 'guest'
############################################
# pypo preferences #
############################################
prepare_ahead = 24 #in hours
cache_for = 24 #how long to hold the cache, in hours
# Poll interval in seconds.
#
# This will rarely need to be changed because any schedule changes are
# automatically sent to pypo immediately.
#
# This is how often the poll script downloads new schedules and files from the
# server in the event that no changes are made to the schedule.
#
poll_interval = 3600 # in seconds.
# Push interval in seconds.
#
# This is how often the push script checks whether it has something new to
# push to liquidsoap.
#
# It's hard to imagine a situation where this should be more than 1 second.
#
push_interval = 1 # in seconds
# 'pre' or 'otf'. 'pre' cues while playlist preparation
# while 'otf' (on the fly) cues while loading into ls
# (needs the post_processor patch)
cue_style = 'pre'

View File

@ -0,0 +1,26 @@
api_client = "airtime"
# where the binary files live
bin_dir = '/usr/lib/airtime/show-recorder'
# 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'
############################################
# RabbitMQ settings #
############################################
rabbitmq_host = 'localhost'
rabbitmq_user = 'guest'
rabbitmq_password = 'guest'
############################################
# Recorded Audio settings #
############################################
record_bitrate = 256
record_samplerate = 44100
record_channels = 2
record_sample_size = 16

View File

@ -6,9 +6,9 @@
# Output settings #
###########################################
output_sound_device = false
output_s1 = "icecast"
output_s2 = "disabled"
output_s3 = "disabled"
s1_output = "icecast"
s2_output = "disabled"
s3_output = "disabled"
s1_type = "ogg"
s2_type = "ogg"

View File

@ -128,14 +128,19 @@ class PypoFetch(Thread):
existing = {}
# create a temp file
fh = open('/etc/airtime/liquidsoap.cfg', 'r')
logger.info("Reading existing config...")
# read existing conf file and build dict
while 1:
line = fh.readline()
line = line.strip()
if not line:
break
line = line.strip()
if line.find('#') == 0:
continue
# if empty line
if not line:
continue
key, value = line.split('=')
key = key.strip()
value = value.strip()
@ -153,6 +158,7 @@ class PypoFetch(Thread):
#restart flag
restart = False
logger.info("Looking for changes...")
# look for changes
for s in setting:
if "output_sound_device" in s[u'keyname']: