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 * /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_COPYRIGHT_DATE', '2010-2011');
define('AIRTIME_REST_VERSION', '1.1'); define('AIRTIME_REST_VERSION', '1.1');
@ -16,13 +16,13 @@ $values = load_airtime_config();
$CC_CONFIG = array( $CC_CONFIG = array(
// Name of the web server user // Name of the web server user
'webServerUser' => $values['general']['webServerUser'], 'webServerUser' => $values['general']['web_server_user'],
'rabbitmq' => $values['rabbitmq'], 'rabbitmq' => $values['rabbitmq'],
'baseFilesDir' => $values['general']['baseFilesDir'], 'baseFilesDir' => $values['general']['base_files_dir'],
// main directory for storing binary media files // main directory for storing binary media files
'storageDir' => $values['general']['baseFilesDir']."/stor", 'storageDir' => $values['general']['base_files_dir']."/stor",
// Database config // Database config
'dsn' => array( 'dsn' => array(

View File

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

View File

@ -161,7 +161,8 @@ class AirtimeIni{
{ {
$api_key = AirtimeIni::GenerateRandomString(); $api_key = AirtimeIni::GenerateRandomString();
AirtimeIni::UpdateIniValue('/etc/airtime/airtime.conf', 'api_key', $api_key); 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/pypo.cfg', 'api_key', "'$api_key'");
AirtimeIni::UpdateIniValue('/etc/airtime/recorder.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__.'/../../')); 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"); $dir = realpath(__DIR__."/../../utils/airtime-clean-storage");
exec("ln -s $dir /usr/bin/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(){ public static function RemoveSymlinks(){
exec("rm -f /usr/bin/airtime-import"); exec("rm -f /usr/bin/airtime-import");
exec("rm -f /usr/bin/airtime-clean-storage"); 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 = { var defaults = {
updatePeriod: 5, //seconds updatePeriod: 5, //seconds
sourceDomain: "http://localhost/", //where to get show status from sourceDomain: "http://localhost/", //where to get show status from
audioStreamSource: "http://localhost:8000/airtime.mp3", //where to get audio stream from text: {onAirNow:"On Air Now", offline:"Offline", current:"Current", next:"Next"}
text: {listenLive:"Listen WADR Live", onAirNow:"On Air Now", offline:"Offline", current:"Current", next:"Next"}
}; };
var options = $.extend(defaults, options); var options = $.extend(defaults, options);
options.sourceDomain = addEndingBackslash(options.sourceDomain); options.sourceDomain = addEndingBackslash(options.sourceDomain);
@ -113,7 +112,6 @@
} }
obj.empty(); 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("<h4>"+showStatus+" &gt;&gt;</h4>");
obj.append("<ul class='widget no-playing-bar'>" + obj.append("<ul class='widget no-playing-bar'>" +
"<li class='current'>"+options.text.current+": "+currentShowName+ "<li class='current'>"+options.text.current+": "+currentShowName+
@ -165,9 +163,16 @@
var dow = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]; 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>'; var html = '<ul>';
for (var i=0; i<dow.length; i++){ 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>'; html += '</ul>';

View File

@ -72,6 +72,9 @@ class PypoPush(Thread):
schedule = self.schedule schedule = self.schedule
playlists = self.playlists playlists = self.playlists
logger.debug('schedule %s' % json.dumps(schedule))
logger.debug('playlists %s' % json.dumps(playlists))
currently_on_air = False currently_on_air = False
if schedule: if schedule:
@ -112,7 +115,7 @@ class PypoPush(Thread):
schedule_tracker = open(self.schedule_tracker_file, "w") schedule_tracker = open(self.schedule_tracker_file, "w")
pickle.dump(playedItems, schedule_tracker) pickle.dump(playedItems, schedule_tracker)
schedule_tracker.close() 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 # Call API to update schedule states
logger.debug("Doing callback to server to update 'played' status.") 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"]))) 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')) 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: for item in playlist:
annotate = str(item['annotate']) annotate = str(item['annotate'])
logger.debug(annotate) #logger.debug(annotate)
tn.write(('queue.push %s\n' % annotate).encode('latin-1')) tn.write(('queue.push %s\n' % annotate).encode('latin-1'))
tn.write(('vars.show_name %s\n' % item['show_name']).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 The purpose of this script is to consolidate into one location where
we need to update database host, dbname, username and password. 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 os
import ConfigParser import ConfigParser
@ -11,18 +11,18 @@ from xml.dom.minidom import Node
#Read the universal values #Read the universal values
parser = ConfigParser.SafeConfigParser() parser = ConfigParser.SafeConfigParser()
parser.read('airtime.conf') parser.read('/etc/airtime/airtime.conf')
section_names = parser.sections();
items_in_section = parser.items(section_names[0])
print "Updating ../application/configs/application.ini"
host = 'resources.db.params.host' host = 'resources.db.params.host'
dbname = 'resources.db.params.dbname' dbname = 'resources.db.params.dbname'
username = 'resources.db.params.username' username = 'resources.db.params.username'
password = 'resources.db.params.password' 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 = [] file_lines = []
for line in f: for line in f:
@ -37,14 +37,14 @@ for line in f:
file_lines.append(line) file_lines.append(line)
f.close() f.close()
f = file('../application/configs/application.ini', 'w') f = file('%s/application/configs/application.ini' % airtime_dir, 'w')
f.writelines(file_lines) f.writelines(file_lines)
f.close() 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 = [] file_lines = []
db_url = 'propel.database.url' db_url = 'propel.database.url'
@ -57,22 +57,22 @@ for line in f:
file_lines.append(line) file_lines.append(line)
f.close() f.close()
f = file('build.properties', 'w') f = file('%s/build/build.properties' % airtime_dir, 'w')
f.writelines(file_lines) f.writelines(file_lines)
f.close() 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 = doc.getElementsByTagName("dsn")[0]
node.firstChild.nodeValue = 'pgsql:host=%s;port=5432;dbname=%s;user=%s;password=%s' % (parser.get('database', 'host'), \ 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')) 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.writelines(doc.toxml('utf-8'))
xml_file.close() xml_file.close()
print 'Regenerating propel-config.php' 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))