diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 6a8237ccf..3f5617e3f 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -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'); } if(!$error){ diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 66002fe72..d76b4e9fc 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -92,31 +92,25 @@ class Application_Model_Preference } public static function GetHeadTitle(){ - /* Caches the title name as a session variable so we dont access - * the database on every page load. */ - $defaultNamespace = new Zend_Session_Namespace('title_name'); - if (isset($defaultNamespace->title)) { - $title = $defaultNamespace->title; - } else { - $title = self::GetValue("station_name"); - $defaultNamespace->title = $title; - } + $title = self::GetValue("station_name"); + $defaultNamespace->title = $title; if (strlen($title) > 0) $title .= " - "; return $title."Airtime"; } - public static function SetHeadTitle($title, $view){ + public static function SetHeadTitle($title, $view=null){ self::SetValue("station_name", $title); - $defaultNamespace = new Zend_Session_Namespace('title_name'); - $defaultNamespace->title = $title; Application_Model_RabbitMq::PushSchedule(); - //set session variable to new station name so that html title is updated. - //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()); + // in case this is called from airtime-saas script + if($view !== null){ + //set session variable to new station name so that html title is updated. + //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()); + } } /** diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 90cb2970e..8e6ecee57 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -448,14 +448,24 @@ class Application_Model_StoredFile { /** * 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(){ global $CC_CONFIG; - $serverName = $CC_CONFIG['baseUrl']; - $serverPort = $CC_CONFIG['basePort']; - + if (isset($CC_CONFIG['baseUrl'])){ + $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); } diff --git a/dev_tools/fabric/fab_liquidsoap_compile.py b/dev_tools/fabric/fab_liquidsoap_compile.py index 8ae202f54..f62068cb9 100644 --- a/dev_tools/fabric/fab_liquidsoap_compile.py +++ b/dev_tools/fabric/fab_liquidsoap_compile.py @@ -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))) -def create_fresh_os(vm_name): +def create_fresh_os(vm_name, debian=False): vm_vdi_file = '%s.vdi'%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.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): @@ -101,13 +104,17 @@ def ubuntu_natty_32(fresh_os=True): def ubuntu_natty_64(fresh_os=True): if (fresh_os): 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"): sudo('apt-get update') - sudo('apt-get upgrade -y') - sudo('sudo apt-get install -y libocamlcvs-ocaml-dev ocaml-findlib libao-ocaml-dev libportaudio-ocaml-dev ' + \ + sudo('apt-get upgrade -y --force-yes') + 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 ' + \ 'libspeex-dev libspeexdsp-dev speex libladspa-ocaml-dev festival festival-dev ' + \ 'libsamplerate-dev libxmlplaylist-ocaml-dev libxmlrpc-light-ocaml-dev libflac-dev ' + \ diff --git a/python_apps/pypo/install/pypo-initialize.py b/python_apps/pypo/install/pypo-initialize.py index 4f2a6ae21..1217d59c3 100644 --- a/python_apps/pypo/install/pypo-initialize.py +++ b/python_apps/pypo/install/pypo-initialize.py @@ -1,6 +1,6 @@ import platform import shutil -from subprocess import Popen +from subprocess import Popen, PIPE import sys import os sys.path.append('/usr/lib/airtime/api_clients/') @@ -11,6 +11,7 @@ if os.geteuid() != 0: print "Please run this as root." sys.exit(1) +""" def is_natty(): try: 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"): return True 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(): current_script_dir = os.path.realpath(__file__) index = current_script_dir.rindex('/') @@ -56,6 +77,9 @@ def generate_liquidsoap_config(ss): 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 try: config = ConfigObj(PATH_INI_FILE) @@ -68,7 +92,10 @@ try: #select appropriate liquidsoap file for given system os/architecture 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" diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap-amd64 b/python_apps/pypo/liquidsoap_bin/liquidsoap-amd64 old mode 100644 new mode 100755 diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap-i386 b/python_apps/pypo/liquidsoap_bin/liquidsoap-i386 old mode 100644 new mode 100755 diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap-natty-amd64 b/python_apps/pypo/liquidsoap_bin/liquidsoap-natty-amd64 old mode 100644 new mode 100755 diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap-natty-i386 b/python_apps/pypo/liquidsoap_bin/liquidsoap-natty-i386 old mode 100644 new mode 100755