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

This commit is contained in:
Yuchen Wang 2011-11-14 17:53:37 -05:00
commit 709582b47d
9 changed files with 65 additions and 27 deletions

View file

@ -187,7 +187,7 @@ class PreferenceController extends Zend_Controller_Action
} }
} }
} }
if($form->isValid($post_data['output_sound_device'])){ if(Application_Model_Preference::GetPlanLevel() == 'disabled' && $form->isValid($post_data['output_sound_device'])){
$values['output_sound_device'] = $form->getValue('output_sound_device'); $values['output_sound_device'] = $form->getValue('output_sound_device');
} }
if(!$error){ if(!$error){

View file

@ -92,31 +92,25 @@ class Application_Model_Preference
} }
public static function GetHeadTitle(){ public static function GetHeadTitle(){
/* Caches the title name as a session variable so we dont access $title = self::GetValue("station_name");
* the database on every page load. */ $defaultNamespace->title = $title;
$defaultNamespace = new Zend_Session_Namespace('title_name');
if (isset($defaultNamespace->title)) {
$title = $defaultNamespace->title;
} else {
$title = self::GetValue("station_name");
$defaultNamespace->title = $title;
}
if (strlen($title) > 0) if (strlen($title) > 0)
$title .= " - "; $title .= " - ";
return $title."Airtime"; return $title."Airtime";
} }
public static function SetHeadTitle($title, $view){ public static function SetHeadTitle($title, $view=null){
self::SetValue("station_name", $title); self::SetValue("station_name", $title);
$defaultNamespace = new Zend_Session_Namespace('title_name');
$defaultNamespace->title = $title;
Application_Model_RabbitMq::PushSchedule(); Application_Model_RabbitMq::PushSchedule();
//set session variable to new station name so that html title is updated. // in case this is called from airtime-saas script
//should probably do this in a view helper to keep this controller as minimal as possible. if($view !== null){
$view->headTitle()->exchangeArray(array()); //clear headTitle ArrayObject //set session variable to new station name so that html title is updated.
$view->headTitle(self::GetHeadTitle()); //should probably do this in a view helper to keep this controller as minimal as possible.
$view->headTitle()->exchangeArray(array()); //clear headTitle ArrayObject
$view->headTitle(self::GetHeadTitle());
}
} }
/** /**

View file

@ -448,14 +448,24 @@ class Application_Model_StoredFile {
/** /**
* Get the URL to access this file using the server name/address that * Get the URL to access this file using the server name/address that
* is specified in the airtime.conf config file. * is specified in the airtime.conf config file. If either of these is
* not specified, then use values provided by the $_SERVER global variable.
*/ */
public function getFileUrlUsingConfigAddress(){ public function getFileUrlUsingConfigAddress(){
global $CC_CONFIG; global $CC_CONFIG;
$serverName = $CC_CONFIG['baseUrl']; if (isset($CC_CONFIG['baseUrl'])){
$serverPort = $CC_CONFIG['basePort']; $serverName = $CC_CONFIG['baseUrl'];
} else {
$serverName = $_SERVER['SERVER_NAME'];
}
if (isset($CC_CONFIG['basePort'])){
$serverPort = $CC_CONFIG['basePort'];
} else {
$serverPort = $_SERVER['SERVER_PORT'];
}
return $this->constructGetFileUrl($serverName, $serverPort); return $this->constructGetFileUrl($serverName, $serverPort);
} }

View file

@ -44,7 +44,7 @@ def download_if_needed(vdi_dir, xml_dir, vm_name, vm_vdi_file, vm_xml_file):
local("wget %s/%s/%s -O %s"%(env.vm_download_url, vm_name, vm_xml_file, os.path.join(xml_dir, vm_xml_file))) local("wget %s/%s/%s -O %s"%(env.vm_download_url, vm_name, vm_xml_file, os.path.join(xml_dir, vm_xml_file)))
def create_fresh_os(vm_name): def create_fresh_os(vm_name, debian=False):
vm_vdi_file = '%s.vdi'%vm_name vm_vdi_file = '%s.vdi'%vm_name
vm_xml_file = '%s.xml'%vm_name vm_xml_file = '%s.xml'%vm_name
@ -84,6 +84,9 @@ def create_fresh_os(vm_name):
env.hosts.append(ip_addr) env.hosts.append(ip_addr)
env.host_string = ip_addr env.host_string = ip_addr
if debian:
append('/etc/apt/sources.list', "deb http://www.debian-multimedia.org squeeze main non-free", use_sudo=True)
def ubuntu_lucid_32(fresh_os=True): def ubuntu_lucid_32(fresh_os=True):
@ -101,13 +104,17 @@ def ubuntu_natty_32(fresh_os=True):
def ubuntu_natty_64(fresh_os=True): def ubuntu_natty_64(fresh_os=True):
if (fresh_os): if (fresh_os):
create_fresh_os('Ubuntu_11.04_64') create_fresh_os('Ubuntu_11.04_64')
def debian_squeeze_64(fresh_os=True):
if (fresh_os):
create_fresh_os('Debian_Squeeze_64', debian=True)
def compile_liquidsoap(filename="liquidsoap"): def compile_liquidsoap(filename="liquidsoap"):
sudo('apt-get update') sudo('apt-get update')
sudo('apt-get upgrade -y') sudo('apt-get upgrade -y --force-yes')
sudo('sudo apt-get install -y libocamlcvs-ocaml-dev ocaml-findlib libao-ocaml-dev libportaudio-ocaml-dev ' + \ sudo('sudo apt-get install -y --force-yes libocamlcvs-ocaml-dev ocaml-findlib libao-ocaml-dev libportaudio-ocaml-dev ' + \
'libmad-ocaml-dev libtaglib-ocaml-dev libalsa-ocaml-dev libtaglib-ocaml-dev libvorbis-ocaml-dev ' + \ 'libmad-ocaml-dev libtaglib-ocaml-dev libalsa-ocaml-dev libtaglib-ocaml-dev libvorbis-ocaml-dev ' + \
'libspeex-dev libspeexdsp-dev speex libladspa-ocaml-dev festival festival-dev ' + \ 'libspeex-dev libspeexdsp-dev speex libladspa-ocaml-dev festival festival-dev ' + \
'libsamplerate-dev libxmlplaylist-ocaml-dev libxmlrpc-light-ocaml-dev libflac-dev ' + \ 'libsamplerate-dev libxmlplaylist-ocaml-dev libxmlrpc-light-ocaml-dev libflac-dev ' + \

View file

@ -1,6 +1,6 @@
import platform import platform
import shutil import shutil
from subprocess import Popen from subprocess import Popen, PIPE
import sys import sys
import os import os
sys.path.append('/usr/lib/airtime/api_clients/') sys.path.append('/usr/lib/airtime/api_clients/')
@ -11,6 +11,7 @@ if os.geteuid() != 0:
print "Please run this as root." print "Please run this as root."
sys.exit(1) sys.exit(1)
"""
def is_natty(): def is_natty():
try: try:
f = open('/etc/lsb-release') f = open('/etc/lsb-release')
@ -25,7 +26,27 @@ def is_natty():
if split[0] == "DISTRIB_CODENAME" and (split[1] == "natty" or split[1] == "oneiric"): if split[0] == "DISTRIB_CODENAME" and (split[1] == "natty" or split[1] == "oneiric"):
return True return True
return False return False
"""
"""
This function returns the codename of the host OS by querying lsb_release.
If lsb_release does not exist, or an exception occurs the codename returned
is 'unknown'
"""
def get_os_codename():
try:
p = Popen("which lsb_release", shell=True)
sts = os.waitpid(p.pid, 0)[1]
if (sts == 0):
#lsb_release is available on this system. Let's get the os codename
p = Popen("lsb_release -sc", shell=True, stdout=PIPE)
return p.communicate()[0].strip('\r\n')
except Exception, e:
pass
return "unknown"
def get_current_script_dir(): def get_current_script_dir():
current_script_dir = os.path.realpath(__file__) current_script_dir = os.path.realpath(__file__)
index = current_script_dir.rindex('/') index = current_script_dir.rindex('/')
@ -56,6 +77,9 @@ def generate_liquidsoap_config(ss):
PATH_INI_FILE = '/etc/airtime/pypo.cfg' PATH_INI_FILE = '/etc/airtime/pypo.cfg'
#any debian/ubuntu codename in this et will automatically use the natty liquidsoap binary
codenames_for_natty_binary = set(["natty", "oneiric", "precise", "squeeze"])
# load config file # load config file
try: try:
config = ConfigObj(PATH_INI_FILE) config = ConfigObj(PATH_INI_FILE)
@ -68,7 +92,10 @@ try:
#select appropriate liquidsoap file for given system os/architecture #select appropriate liquidsoap file for given system os/architecture
architecture = platform.architecture()[0] architecture = platform.architecture()[0]
natty = is_natty() #natty = is_natty()
codename = get_os_codename()
natty = codename in codenames_for_natty_binary
print "* Detecting system architecture for Liquidsoap" print "* Detecting system architecture for Liquidsoap"

0
python_apps/pypo/liquidsoap_bin/liquidsoap-amd64 Normal file → Executable file
View file

0
python_apps/pypo/liquidsoap_bin/liquidsoap-i386 Normal file → Executable file
View file

0
python_apps/pypo/liquidsoap_bin/liquidsoap-natty-amd64 Normal file → Executable file
View file

0
python_apps/pypo/liquidsoap_bin/liquidsoap-natty-i386 Normal file → Executable file
View file