Merge branch 'master' into CC-2301

This commit is contained in:
Naomi 2013-05-02 18:02:09 -04:00
commit 3fc6a0fbae
3 changed files with 15 additions and 7 deletions

View File

@ -288,7 +288,7 @@ class ApiController extends Zend_Controller_Action
//used by caller to determine if the airtime they are running or widgets in use is out of date. //used by caller to determine if the airtime they are running or widgets in use is out of date.
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; $result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
header("Content-type: text/javascript"); header("Content-Type: application/json");
// If a callback is not given, then just provide the raw JSON. // If a callback is not given, then just provide the raw JSON.
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result); echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
@ -348,11 +348,14 @@ class ApiController extends Zend_Controller_Action
public function scheduleAction() public function scheduleAction()
{ {
$data = Application_Model_Schedule::getSchedule(); $this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
header("Content-Type: application/json"); header("Content-Type: application/json");
$data = json_encode($data, JSON_FORCE_OBJECT); $data = Application_Model_Schedule::getSchedule();
$this->_helper->json->sendJson($data, false, true);
echo json_encode($data, JSON_FORCE_OBJECT);
} }
public function notifyMediaItemStartPlayAction() public function notifyMediaItemStartPlayAction()

View File

@ -11,7 +11,7 @@ class ReplayGainUpdater(Thread):
""" """
The purpose of the class is to query the server for a list of files which The purpose of the class is to query the server for a list of files which
do not have a ReplayGain value calculated. This class will iterate over the do not have a ReplayGain value calculated. This class will iterate over the
list calculate the values, update the server and repeat the process until list, calculate the values, update the server and repeat the process until
the server reports there are no files left. the server reports there are no files left.
This class will see heavy activity right after a 2.1->2.2 upgrade since 2.2 This class will see heavy activity right after a 2.1->2.2 upgrade since 2.2

View File

@ -36,15 +36,20 @@ signal.signal(signal.SIGINT, keyboardInterruptHandler)
POLL_INTERVAL = 1800 POLL_INTERVAL = 1800
config_static = None
class PypoFetch(Thread): class PypoFetch(Thread):
def __init__(self, pypoFetch_q, pypoPush_q, media_q, telnet_lock, pypo_liquidsoap, config): def __init__(self, pypoFetch_q, pypoPush_q, media_q, telnet_lock, pypo_liquidsoap, config):
Thread.__init__(self) Thread.__init__(self)
global config_static
self.api_client = api_client.AirtimeApiClient() self.api_client = api_client.AirtimeApiClient()
self.fetch_queue = pypoFetch_q self.fetch_queue = pypoFetch_q
self.push_queue = pypoPush_q self.push_queue = pypoPush_q
self.media_prepare_queue = media_q self.media_prepare_queue = media_q
self.last_update_schedule_timestamp = time.time() self.last_update_schedule_timestamp = time.time()
self.config = config self.config = config
config_static = config
self.listener_timeout = POLL_INTERVAL self.listener_timeout = POLL_INTERVAL
self.telnet_lock = telnet_lock self.telnet_lock = telnet_lock
@ -134,7 +139,7 @@ class PypoFetch(Thread):
try: try:
lock.acquire() lock.acquire()
tn = telnetlib.Telnet(self.config['ls_host'], self.config['ls_port']) tn = telnetlib.Telnet(config_static['ls_host'], config_static['ls_port'])
logger.info(command) logger.info(command)
tn.write(command) tn.write(command)
tn.write('exit\n') tn.write('exit\n')
@ -149,7 +154,7 @@ class PypoFetch(Thread):
try: try:
lock.acquire() lock.acquire()
tn = telnetlib.Telnet(self.config['ls_host'], self.config['ls_port']) tn = telnetlib.Telnet(config_static['ls_host'], config_static['ls_port'])
for i in commands: for i in commands:
logger.info(i) logger.info(i)
tn.write(i) tn.write(i)