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

This commit is contained in:
naomiaro 2011-04-01 18:18:59 -04:00
commit 8f8bd68849
7 changed files with 43 additions and 28 deletions

View File

@ -6,7 +6,7 @@
* /etc/airtime/recorder.cfg
*/
define('AIRTIME_VERSION', '1.7.0-alpha');
define('AIRTIME_VERSION', '1.7.0-beta');
define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
define('AIRTIME_REST_VERSION', '1.1');
@ -16,13 +16,13 @@ $values = load_airtime_config();
$CC_CONFIG = array(
// Name of the web server user
'webServerUser' => $values['general']['webServerUser'],
'webServerUser' => $values['general']['web_server_user'],
'rabbitmq' => $values['rabbitmq'],
'baseFilesDir' => $values['general']['baseFilesDir'],
'baseFilesDir' => $values['general']['base_files_dir'],
// main directory for storing binary media files
'storageDir' => $values['general']['baseFilesDir']."/stor",
'storageDir' => $values['general']['base_files_dir']."/stor",
// Database config
'dsn' => array(

View File

@ -13,8 +13,9 @@ vhost = /
[general]
api_key = AAA
webServerUser = www-data
baseFilesDir = x
web_server_user = www-data
airtime_dir = x
base_files_dir = x
[soundcloud]
connection_retries = 3

View File

@ -161,7 +161,8 @@ class AirtimeIni{
{
$api_key = AirtimeIni::GenerateRandomString();
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'api_key', $api_key);
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'baseFilesDir', realpath(__DIR__.'/../../').'/files');
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'base_files_dir', realpath(__DIR__.'/../../').'/files');
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'airtime_dir', realpath(__DIR__.'/../../'));
AirtimeIni::UpdateIniValue('/etc/airtime/pypo.cfg', 'api_key', "'$api_key'");
AirtimeIni::UpdateIniValue('/etc/airtime/recorder.cfg', 'api_key', "'$api_key'");
AirtimeIni::UpdateIniValue(__DIR__.'/../../build/build.properties', 'project.home', realpath(__dir__.'/../../'));

View File

@ -167,10 +167,14 @@ class AirtimeInstall {
$dir = realpath(__DIR__."/../../utils/airtime-clean-storage");
exec("ln -s $dir /usr/bin/airtime-clean-storage");
$dir = realpath(__DIR__."/../../utils/airtime-update-db-settings");
exec("ln -s $dir /usr/bin/airtime-update-db-settings");
}
public static function RemoveSymlinks(){
exec("rm -f /usr/bin/airtime-import");
exec("rm -f /usr/bin/airtime-clean-storage");
exec("rm -f /usr/bin/airtime-update-db-settings");
}
}

View File

@ -76,8 +76,7 @@
var defaults = {
updatePeriod: 5, //seconds
sourceDomain: "http://localhost/", //where to get show status from
audioStreamSource: "http://localhost:8000/airtime.mp3", //where to get audio stream from
text: {listenLive:"Listen WADR Live", onAirNow:"On Air Now", offline:"Offline", current:"Current", next:"Next"}
text: {onAirNow:"On Air Now", offline:"Offline", current:"Current", next:"Next"}
};
var options = $.extend(defaults, options);
options.sourceDomain = addEndingBackslash(options.sourceDomain);
@ -113,7 +112,6 @@
}
obj.empty();
obj.append("<a id='listenWadrLive' href='"+options.audioStreamSource+"'><span>"+options.text.listenLive+"</span></a>");
obj.append("<h4>"+showStatus+" &gt;&gt;</h4>");
obj.append("<ul class='widget no-playing-bar'>" +
"<li class='current'>"+options.text.current+": "+currentShowName+
@ -165,9 +163,16 @@
var dow = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
var date = new Date();
//subtract 1 because javascript date function returns
//sunday as 0 based, but we want Monday to be 0-based.
var todayInt = (date.getDay()-1);
if (todayInt < 0)
todayInt += 7;
var html = '<ul>';
for (var i=0; i<dow.length; i++){
html += '<li><a href="#'+dow[i]+'">'+options.dowText[dow[i]]+'</a></li>';
html += '<li'+ (i==todayInt?' class="ui-tabs-selected ui-state-active"':'')+'><a href="#'+dow[i]+'">'+options.dowText[dow[i]]+'</a></li>';
}
html += '</ul>';

View File

@ -72,6 +72,9 @@ class PypoPush(Thread):
schedule = self.schedule
playlists = self.playlists
logger.debug('schedule %s' % json.dumps(schedule))
logger.debug('playlists %s' % json.dumps(playlists))
currently_on_air = False
if schedule:
@ -112,7 +115,7 @@ class PypoPush(Thread):
schedule_tracker = open(self.schedule_tracker_file, "w")
pickle.dump(playedItems, schedule_tracker)
schedule_tracker.close()
logger.debug("Wrote schedule to disk: "+str(json.dumps(playedItems)))
#logger.debug("Wrote schedule to disk: "+str(json.dumps(playedItems)))
# Call API to update schedule states
logger.debug("Doing callback to server to update 'played' status.")
@ -172,9 +175,10 @@ class PypoPush(Thread):
logger.debug("vars.pypo_data %s\n"%(str(liquidsoap_data["schedule_id"])))
tn.write(("vars.pypo_data %s\n"%str(liquidsoap_data["schedule_id"])).encode('latin-1'))
logger.debug('Preparing to push playlist %s' % pkey)
for item in playlist:
annotate = str(item['annotate'])
logger.debug(annotate)
#logger.debug(annotate)
tn.write(('queue.push %s\n' % annotate).encode('latin-1'))
tn.write(('vars.show_name %s\n' % item['show_name']).encode('latin-1'))

View File

@ -2,7 +2,7 @@
The purpose of this script is to consolidate into one location where
we need to update database host, dbname, username and password.
This script reads from database.conf.
This script reads from airtime.conf.
"""
import os
import ConfigParser
@ -11,18 +11,18 @@ from xml.dom.minidom import Node
#Read the universal values
parser = ConfigParser.SafeConfigParser()
parser.read('airtime.conf')
section_names = parser.sections();
items_in_section = parser.items(section_names[0])
parser.read('/etc/airtime/airtime.conf')
print "Updating ../application/configs/application.ini"
host = 'resources.db.params.host'
dbname = 'resources.db.params.dbname'
username = 'resources.db.params.username'
password = 'resources.db.params.password'
f = file('../application/configs/application.ini','r')
airtime_dir = parser.get('general', 'airtime_dir')
print 'Airtime root folder found at %s' % airtime_dir
print ("Updating %s/application/configs/application.ini" % airtime_dir)
f = file('%s/application/configs/application.ini' % airtime_dir,'r')
file_lines = []
for line in f:
@ -37,14 +37,14 @@ for line in f:
file_lines.append(line)
f.close()
f = file('../application/configs/application.ini', 'w')
f = file('%s/application/configs/application.ini' % airtime_dir, 'w')
f.writelines(file_lines)
f.close()
print "Updating ./build.properties"
print ("Updating %s/build.properties" % airtime_dir)
f = file('build.properties', 'r')
f = file('%s/build/build.properties' % airtime_dir, 'r')
file_lines = []
db_url = 'propel.database.url'
@ -57,22 +57,22 @@ for line in f:
file_lines.append(line)
f.close()
f = file('build.properties', 'w')
f = file('%s/build/build.properties' % airtime_dir, 'w')
f.writelines(file_lines)
f.close()
print "Updating ./runtime-conf.xml"
print ("Updating %s/runtime-conf.xml" % airtime_dir)
doc = xml.dom.minidom.parse('./runtime-conf.xml')
doc = xml.dom.minidom.parse('%s/build/runtime-conf.xml' % airtime_dir)
node = doc.getElementsByTagName("dsn")[0]
node.firstChild.nodeValue = 'pgsql:host=%s;port=5432;dbname=%s;user=%s;password=%s' % (parser.get('database', 'host'), \
parser.get('database', 'dbname'), parser.get('database', 'dbuser'), parser.get('database', 'dbpass'))
xml_file = open('runtime-conf.xml', "w")
xml_file = open('%s/build/runtime-conf.xml' % airtime_dir, "w")
xml_file.writelines(doc.toxml('utf-8'))
xml_file.close()
print 'Regenerating propel-config.php'
os.system('../library/propel/generator/bin/propel-gen')
os.system('cd %s/build && %s/library/propel/generator/bin/propel-gen' % (airtime_dir, airtime_dir))