Merge branch '2.3.x' into 2.3.x-saas

Conflicts:
	airtime_mvc/application/controllers/PreferenceController.php
This commit is contained in:
Martin Konecny 2013-02-04 16:22:35 -05:00
commit c398ce930b
17 changed files with 190 additions and 117 deletions

View file

@ -438,7 +438,7 @@ class LibraryController extends Zend_Controller_Action
$formValues = $this->_getParam('data', null); $formValues = $this->_getParam('data', null);
$formdata = array(); $formdata = array();
foreach ($formValues as $val) { foreach ($formValues as $val) {
$formdata[$val["name"]] = htmlspecialchars($val["value"]); $formdata[$val["name"]] = $val["value"];
} }
$file->setDbColMetadata($formdata); $file->setDbColMetadata($formdata);

View file

@ -116,7 +116,6 @@ class PreferenceController extends Zend_Controller_Action
public function directoryConfigAction() public function directoryConfigAction()
{ {
} }
public function streamSettingAction() public function streamSettingAction()

View file

@ -479,7 +479,7 @@ class ScheduleController extends Zend_Controller_Action
$this->view->percentFilled = $show->getPercentScheduled(); $this->view->percentFilled = $show->getPercentScheduled();
$this->view->showContent = $show->getShowListContent(); $this->view->showContent = $show->getShowListContent();
$this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml'); $this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml');
$this->view->showTitle = $show->getName(); $this->view->showTitle = htmlspecialchars($show->getName());
unset($this->view->showContent); unset($this->view->showContent);
} }

View file

@ -8,6 +8,7 @@ if ($item['type'] == 2) {
$bl= new Application_Model_Block($item['item_id']); $bl= new Application_Model_Block($item['item_id']);
$staticBlock = $bl->isStatic(); $staticBlock = $bl->isStatic();
} }
$item["track_title"] = $this->escape($item["track_title"]);
?> ?>
<li class="ui-state-default" id="spl_<?php echo $item["id"] ?>" unqid="<?php echo $item["id"]; ?>"> <li class="ui-state-default" id="spl_<?php echo $item["id"] ?>" unqid="<?php echo $item["id"]; ?>">
<div class="list-item-container"> <div class="list-item-container">

View file

@ -80,23 +80,19 @@ class ApiRequest(object):
if logger is None: self.logger = logging if logger is None: self.logger = logging
else: self.logger = logger else: self.logger = logger
def __call__(self,_post_data=None, **kwargs): def __call__(self,_post_data=None, **kwargs):
# TODO : get rid of god damn urllib and replace everything with
# grequests or requests at least
final_url = self.url.params(**kwargs).url() final_url = self.url.params(**kwargs).url()
if _post_data is not None: _post_data = urllib.urlencode(_post_data) if _post_data is not None: _post_data = urllib.urlencode(_post_data)
try: try:
req = urllib2.Request(final_url, _post_data) req = urllib2.Request(final_url, _post_data)
response = urllib2.urlopen(req).read() response = urllib2.urlopen(req).read()
except Exception, e: except Exception, e:
self.logger.error('Exception: %s', e)
import traceback import traceback
top = traceback.format_exc() self.logger.error('Exception: %s', e)
self.logger.error("traceback: %s", top) self.logger.error("traceback: %s", traceback.format_exc())
response = "" raise
# Ghetto hack for now because we don't the content type we are getting # Ghetto hack for now because we don't the content type we are getting
# (Pointless to look at mime since it's not being set correctly always) # (Pointless to look at mime since it's not being set correctly always)
try: return json.loads(response) return json.loads(response)
except ValueError: return response
def req(self, *args, **kwargs): def req(self, *args, **kwargs):
self.__req = lambda : self(*args, **kwargs) self.__req = lambda : self(*args, **kwargs)
@ -150,7 +146,6 @@ class AirtimeApiClient(object):
sys.exit(1) sys.exit(1)
def __get_airtime_version(self): def __get_airtime_version(self):
# TODO : maybe fix this function to drop an exception?
try: return self.services.version_url()[u'version'] try: return self.services.version_url()[u'version']
except Exception: return -1 except Exception: return -1
@ -158,18 +153,18 @@ class AirtimeApiClient(object):
logger = self.logger logger = self.logger
version = self.__get_airtime_version() version = self.__get_airtime_version()
# logger.info('Airtime version found: ' + str(version)) # logger.info('Airtime version found: ' + str(version))
if (version == -1): if version == -1:
if (verbose): if (verbose):
logger.info('Unable to get Airtime version number.\n') logger.info('Unable to get Airtime version number.\n')
return False return False
elif (version[0:3] != AIRTIME_VERSION[0:3]): elif version[0:3] != AIRTIME_VERSION[0:3]:
if (verbose): if verbose:
logger.info('Airtime version found: ' + str(version)) logger.info('Airtime version found: ' + str(version))
logger.info('pypo is at version ' + AIRTIME_VERSION + logger.info('pypo is at version ' + AIRTIME_VERSION +
' and is not compatible with this version of Airtime.\n') ' and is not compatible with this version of Airtime.\n')
return False return False
else: else:
if (verbose): if verbose:
logger.info('Airtime version: ' + str(version)) logger.info('Airtime version: ' + str(version))
logger.info('pypo is at version ' + AIRTIME_VERSION + ' and is compatible with this version of Airtime.') logger.info('pypo is at version ' + AIRTIME_VERSION + ' and is compatible with this version of Airtime.')
return True return True
@ -182,24 +177,27 @@ class AirtimeApiClient(object):
except: return (False, None) except: return (False, None)
def notify_liquidsoap_started(self): def notify_liquidsoap_started(self):
return self.services.notify_liquidsoap_started() try:
self.services.notify_liquidsoap_started()
except Exception, e:
self.logger.error(str(e))
def notify_media_item_start_playing(self, media_id): def notify_media_item_start_playing(self, media_id):
""" This is a callback from liquidsoap, we use this to notify """ This is a callback from liquidsoap, we use this to notify
about the currently playing *song*. We get passed a JSON string about the currently playing *song*. We get passed a JSON string
which we handed to liquidsoap in get_liquidsoap_data(). """ which we handed to liquidsoap in get_liquidsoap_data(). """
return self.services.update_start_playing_url(media_id=media_id) try:
return self.services.update_start_playing_url(media_id=media_id)
# TODO : get this routine out of here it doesn't belong at all here except Exception, e:
def get_liquidsoap_data(self, pkey, schedule): self.logger.error(str(e))
playlist = schedule[pkey] return None
data = dict()
try: data["schedule_id"] = playlist['id']
except Exception: data["schedule_id"] = 0
return data
def get_shows_to_record(self): def get_shows_to_record(self):
return self.services.show_schedule_url() try:
return self.services.show_schedule_url()
except Exception, e:
self.logger.error(str(e))
return None
def upload_recorded_show(self, data, headers): def upload_recorded_show(self, data, headers):
logger = self.logger logger = self.logger
@ -235,8 +233,12 @@ class AirtimeApiClient(object):
return response return response
def check_live_stream_auth(self, username, password, dj_type): def check_live_stream_auth(self, username, password, dj_type):
return self.services.check_live_stream_auth( try:
username=username, password=password, djtype=dj_type) return self.services.check_live_stream_auth(
username=username, password=password, djtype=dj_type)
except Exception, e:
self.logger.error(str(e))
return {}
def construct_url(self,config_action_key): def construct_url(self,config_action_key):
"""Constructs the base url for every request""" """Constructs the base url for every request"""
@ -248,6 +250,10 @@ class AirtimeApiClient(object):
url = url.replace("%%api_key%%", self.config["api_key"]) url = url.replace("%%api_key%%", self.config["api_key"])
return url return url
"""
Caller of this method needs to catch any exceptions such as
ValueError thrown by json.loads or URLError by urllib2.urlopen
"""
def setup_media_monitor(self): def setup_media_monitor(self):
return self.services.media_setup_url() return self.services.media_setup_url()
@ -308,25 +314,40 @@ class AirtimeApiClient(object):
self.logger.error("Could not find index 'files' in dictionary: %s", self.logger.error("Could not find index 'files' in dictionary: %s",
str(response)) str(response))
return [] return []
"""
Caller of this method needs to catch any exceptions such as
ValueError thrown by json.loads or URLError by urllib2.urlopen
"""
def list_all_watched_dirs(self): def list_all_watched_dirs(self):
return self.services.list_all_watched_dirs() return self.services.list_all_watched_dirs()
"""
Caller of this method needs to catch any exceptions such as
ValueError thrown by json.loads or URLError by urllib2.urlopen
"""
def add_watched_dir(self, path): def add_watched_dir(self, path):
return self.services.add_watched_dir(path=base64.b64encode(path)) return self.services.add_watched_dir(path=base64.b64encode(path))
"""
Caller of this method needs to catch any exceptions such as
ValueError thrown by json.loads or URLError by urllib2.urlopen
"""
def remove_watched_dir(self, path): def remove_watched_dir(self, path):
return self.services.remove_watched_dir(path=base64.b64encode(path)) return self.services.remove_watched_dir(path=base64.b64encode(path))
"""
Caller of this method needs to catch any exceptions such as
ValueError thrown by json.loads or URLError by urllib2.urlopen
"""
def set_storage_dir(self, path): def set_storage_dir(self, path):
return self.services.set_storage_dir(path=base64.b64encode(path)) return self.services.set_storage_dir(path=base64.b64encode(path))
"""
Caller of this method needs to catch any exceptions such as
ValueError thrown by json.loads or URLError by urllib2.urlopen
"""
def get_stream_setting(self): def get_stream_setting(self):
logger = self.logger return self.services.get_stream_setting()
try: return self.services.get_stream_setting()
except Exception, e:
logger.error("Exception: %s", e)
return None
def register_component(self, component): def register_component(self, component):
""" Purpose of this method is to contact the server with a "Hey its """ Purpose of this method is to contact the server with a "Hey its
@ -343,6 +364,7 @@ class AirtimeApiClient(object):
self.services.update_liquidsoap_status.req(msg=encoded_msg, stream_id=stream_id, self.services.update_liquidsoap_status.req(msg=encoded_msg, stream_id=stream_id,
boot_time=time).retry(5) boot_time=time).retry(5)
except Exception, e: except Exception, e:
#TODO
logger.error("Exception: %s", e) logger.error("Exception: %s", e)
def notify_source_status(self, sourcename, status): def notify_source_status(self, sourcename, status):
@ -351,10 +373,11 @@ class AirtimeApiClient(object):
return self.services.update_source_status.req(sourcename=sourcename, return self.services.update_source_status.req(sourcename=sourcename,
status=status).retry(5) status=status).retry(5)
except Exception, e: except Exception, e:
#TODO
logger.error("Exception: %s", e) logger.error("Exception: %s", e)
def get_bootstrap_info(self): def get_bootstrap_info(self):
""" Retrive infomations needed on bootstrap time """ """ Retrieve infomations needed on bootstrap time """
return self.services.get_bootstrap_info() return self.services.get_bootstrap_info()
def get_files_without_replay_gain_value(self, dir_id): def get_files_without_replay_gain_value(self, dir_id):
@ -364,7 +387,11 @@ class AirtimeApiClient(object):
to this file is the return value. to this file is the return value.
""" """
#http://localhost/api/get-files-without-replay-gain/dir_id/1 #http://localhost/api/get-files-without-replay-gain/dir_id/1
return self.services.get_files_without_replay_gain(dir_id=dir_id) try:
return self.services.get_files_without_replay_gain(dir_id=dir_id)
except Exception, e:
self.logger.error(str(e))
return []
def get_files_without_silan_value(self): def get_files_without_silan_value(self):
""" """
@ -372,7 +399,11 @@ class AirtimeApiClient(object):
calculated. This list of files is downloaded into a file and the path calculated. This list of files is downloaded into a file and the path
to this file is the return value. to this file is the return value.
""" """
return self.services.get_files_without_silan_value() try:
return self.services.get_files_without_silan_value()
except Exception, e:
self.logger.error(str(e))
return []
def update_replay_gain_values(self, pairs): def update_replay_gain_values(self, pairs):
""" """
@ -382,12 +413,13 @@ class AirtimeApiClient(object):
self.logger.debug(self.services.update_replay_gain_value( self.logger.debug(self.services.update_replay_gain_value(
_post_data={'data': json.dumps(pairs)})) _post_data={'data': json.dumps(pairs)}))
def update_cue_values_by_silan(self, pairs): def update_cue_values_by_silan(self, pairs):
""" """
'pairs' is a list of pairs in (x, y), where x is the file's database 'pairs' is a list of pairs in (x, y), where x is the file's database
row id and y is the file's cue values in dB row id and y is the file's cue values in dB
""" """
print self.services.update_cue_values_by_silan(_post_data={'data': json.dumps(pairs)}) return self.services.update_cue_values_by_silan(_post_data={'data': json.dumps(pairs)})
def notify_webstream_data(self, data, media_id): def notify_webstream_data(self, data, media_id):
@ -409,5 +441,9 @@ class AirtimeApiClient(object):
return response return response
def update_stream_setting_table(self, data): def update_stream_setting_table(self, data):
response = self.services.update_stream_setting_table(_post_data={'data': json.dumps(data)}) try:
return response response = self.services.update_stream_setting_table(_post_data={'data': json.dumps(data)})
return response
except Exception, e:
#TODO
self.logger.error(str(e))

View file

@ -69,7 +69,7 @@ class AirtimeMediaMonitorBootstrap():
return json["dirs"] return json["dirs"]
except KeyError as e: except KeyError as e:
self.logger.error("Could not find index 'dirs' in dictionary: %s", str(json)) self.logger.error("Could not find index 'dirs' in dictionary: %s", str(json))
self.logger.error(e) self.logger.error(str(e))
return {} return {}
""" """

View file

@ -19,31 +19,35 @@ class AirtimeDB(Loggable):
saas = user().root_path saas = user().root_path
# dirs_setup is a dict with keys: try:
# u'watched_dirs' and u'stor' which point to lists of corresponding # dirs_setup is a dict with keys:
# dirs # u'watched_dirs' and u'stor' which point to lists of corresponding
dirs_setup = self.apc.setup_media_monitor() # dirs
dirs_setup[u'stor'] = normpath( join(saas, dirs_setup[u'stor'] ) ) dirs_setup = self.apc.setup_media_monitor()
dirs_setup[u'watched_dirs'] = map(lambda p: normpath(join(saas,p)), dirs_setup[u'stor'] = normpath( join(saas, dirs_setup[u'stor'] ) )
dirs_setup[u'watched_dirs']) dirs_setup[u'watched_dirs'] = map(lambda p: normpath(join(saas,p)),
dirs_with_id = dict([ (k,normpath(v)) for k,v in dirs_setup[u'watched_dirs'])
self.apc.list_all_watched_dirs()['dirs'].iteritems() ]) dirs_with_id = dict([ (k,normpath(v)) for k,v in
self.apc.list_all_watched_dirs()['dirs'].iteritems() ])
self.id_to_dir = dirs_with_id self.id_to_dir = dirs_with_id
self.dir_to_id = dict([ (v,k) for k,v in dirs_with_id.iteritems() ]) self.dir_to_id = dict([ (v,k) for k,v in dirs_with_id.iteritems() ])
self.base_storage = dirs_setup[u'stor'] self.base_storage = dirs_setup[u'stor']
self.storage_paths = mmp.expand_storage( self.base_storage ) self.storage_paths = mmp.expand_storage( self.base_storage )
self.base_id = self.dir_to_id[self.base_storage] self.base_id = self.dir_to_id[self.base_storage]
# hack to get around annoying schema of airtime db # hack to get around annoying schema of airtime db
self.dir_to_id[ self.recorded_path() ] = self.base_id self.dir_to_id[ self.recorded_path() ] = self.base_id
self.dir_to_id[ self.import_path() ] = self.base_id self.dir_to_id[ self.import_path() ] = self.base_id
# We don't know from the x_to_y dict which directory is watched or
# store...
self.watched_directories = set([ os.path.normpath(p) for p in
dirs_setup[u'watched_dirs'] ])
except Exception, e:
self.logger.info(str(e))
# We don't know from the x_to_y dict which directory is watched or
# store...
self.watched_directories = set([ os.path.normpath(p) for p in
dirs_setup[u'watched_dirs'] ])
def to_id(self, directory): def to_id(self, directory):
""" directory path -> id """ """ directory path -> id """

View file

@ -85,7 +85,15 @@ class MM2(InstanceThread, Loggable):
ToucherThread(path=user().touch_file_path(), ToucherThread(path=user().touch_file_path(),
interval=int(config['touch_interval'])) interval=int(config['touch_interval']))
apiclient.register_component('media-monitor') success = False
while not success:
try:
apiclient.register_component('media-monitor')
success = True
except Exception, e:
self.logger.error(str(e))
import time
time.sleep(10)
manager.loop() manager.loop()

View file

@ -26,13 +26,10 @@ def generate_liquidsoap_config(ss):
logging.basicConfig(format='%(message)s') logging.basicConfig(format='%(message)s')
ac = AirtimeApiClient(logging.getLogger()) ac = AirtimeApiClient(logging.getLogger())
ss = ac.get_stream_setting() try:
ss = ac.get_stream_setting()
if ss is not None: generate_liquidsoap_config(ss)
try: except Exception, e:
generate_liquidsoap_config(ss) logging.error(str(e))
except Exception, e:
logging.error(e)
else:
print "Unable to connect to the Airtime server." print "Unable to connect to the Airtime server."
sys.exit(1) sys.exit(1)

View file

@ -15,4 +15,7 @@ elif dj_type == '--dj':
response = api_clients.check_live_stream_auth(username, password, source_type) response = api_clients.check_live_stream_auth(username, password, source_type)
print response['msg'] if 'msg' in response:
print response['msg']
else:
print False

View file

@ -110,7 +110,10 @@ class ListenerStat(Thread):
self.update_listener_stat_error(v["mount"], 'OK') self.update_listener_stat_error(v["mount"], 'OK')
except Exception, e: except Exception, e:
self.logger.error('Exception: %s', e) self.logger.error('Exception: %s', e)
self.update_listener_stat_error(v["mount"], str(e)) try:
self.update_listener_stat_error(v["mount"], str(e))
except Exception, e:
self.logger.error('Exception: %s', e)
return stats return stats

View file

@ -67,15 +67,15 @@ class ReplayGainUpdater(Thread):
self.logger.error(e) self.logger.error(e)
self.logger.debug(traceback.format_exc()) self.logger.debug(traceback.format_exc())
def run(self): def run(self):
try: while True:
while True: try:
self.logger.info("Runnning replaygain updater") self.logger.info("Running replaygain updater")
self.main() self.main()
# Sleep for 5 minutes in case new files have been added # Sleep for 5 minutes in case new files have been added
time.sleep(60 * 5) except Exception, e:
except Exception, e: self.logger.error('ReplayGainUpdater Exception: %s', traceback.format_exc())
self.logger.error('ReplayGainUpdater Exception: %s', traceback.format_exc()) self.logger.error(e)
self.logger.error(e) time.sleep(60 * 5)
if __name__ == "__main__": if __name__ == "__main__":
rgu = ReplayGainUpdater() rgu = ReplayGainUpdater()

View file

@ -179,7 +179,14 @@ if __name__ == '__main__':
ReplayGainUpdater.start_reply_gain(api_client) ReplayGainUpdater.start_reply_gain(api_client)
api_client.register_component("pypo") success = False
while not success:
try:
api_client.register_component('pypo')
success = True
except Exception, e:
logger.error(str(e))
time.sleep(10)
pypoFetch_q = Queue() pypoFetch_q = Queue()
recorder_q = Queue() recorder_q = Queue()

View file

@ -206,23 +206,25 @@ class PypoFetch(Thread):
""" """
def set_bootstrap_variables(self): def set_bootstrap_variables(self):
self.logger.debug('Getting information needed on bootstrap from Airtime') self.logger.debug('Getting information needed on bootstrap from Airtime')
info = self.api_client.get_bootstrap_info() try:
if info is None: info = self.api_client.get_bootstrap_info()
except Exception, e:
self.logger.error('Unable to get bootstrap info.. Exiting pypo...') self.logger.error('Unable to get bootstrap info.. Exiting pypo...')
else: self.logger.error(str(e))
self.logger.debug('info:%s', info)
commands = []
for k, v in info['switch_status'].iteritems():
commands.append(self.switch_source_temp(k, v))
stream_format = info['stream_label'] self.logger.debug('info:%s', info)
station_name = info['station_name'] commands = []
fade = info['transition_fade'] for k, v in info['switch_status'].iteritems():
commands.append(self.switch_source_temp(k, v))
commands.append(('vars.stream_metadata_type %s\n' % stream_format).encode('utf-8')) stream_format = info['stream_label']
commands.append(('vars.station_name %s\n' % station_name).encode('utf-8')) station_name = info['station_name']
commands.append(('vars.default_dj_fade %s\n' % fade).encode('utf-8')) fade = info['transition_fade']
PypoFetch.telnet_send(self.logger, self.telnet_lock, commands)
commands.append(('vars.stream_metadata_type %s\n' % stream_format).encode('utf-8'))
commands.append(('vars.station_name %s\n' % station_name).encode('utf-8'))
commands.append(('vars.default_dj_fade %s\n' % fade).encode('utf-8'))
PypoFetch.telnet_send(self.logger, self.telnet_lock, commands)
def restart_liquidsoap(self): def restart_liquidsoap(self):

View file

@ -189,9 +189,17 @@ class Recorder(Thread):
self.server_timezone = '' self.server_timezone = ''
self.queue = q self.queue = q
self.loops = 0 self.loops = 0
self.api_client.register_component("show-recorder")
self.logger.info("RecorderFetch: init complete") self.logger.info("RecorderFetch: init complete")
success = False
while not success:
try:
self.api_client.register_component('show-recorder')
success = True
except Exception, e:
self.logger.error(str(e))
time.sleep(10)
def handle_message(self): def handle_message(self):
if not self.queue.empty(): if not self.queue.empty():
message = self.queue.get() message = self.queue.get()

View file

@ -75,15 +75,16 @@ def format_dir_string(path):
return path return path
def helper_get_stor_dir(): def helper_get_stor_dir():
res = api_client.list_all_watched_dirs() try:
if(res is None): res = api_client.list_all_watched_dirs()
except Exception, e:
return res return res
if(res['dirs']['1'][-1] != '/'):
out = res['dirs']['1']+'/'
return out
else: else:
if(res['dirs']['1'][-1] != '/'): return res['dirs']['1']
out = res['dirs']['1']+'/'
return out
else:
return res['dirs']['1']
def checkOtherOption(args): def checkOtherOption(args):
for i in args: for i in args:
@ -162,8 +163,9 @@ def WatchAddAction(option, opt, value, parser):
path = apc.encode_to(path, 'utf-8') path = apc.encode_to(path, 'utf-8')
if(os.path.isdir(path)): if(os.path.isdir(path)):
#os.chmod(path, 0765) #os.chmod(path, 0765)
res = api_client.add_watched_dir(path) try:
if(res is None): res = api_client.add_watched_dir(path)
except Exception, e:
exit("Unable to connect to the server.") exit("Unable to connect to the server.")
# sucess # sucess
if(res['msg']['code'] == 0): if(res['msg']['code'] == 0):
@ -179,8 +181,9 @@ def WatchListAction(option, opt, value, parser):
errorIfMultipleOption(parser.rargs) errorIfMultipleOption(parser.rargs)
if(len(parser.rargs) > 0): if(len(parser.rargs) > 0):
raise OptionValueError("This option doesn't take any arguments.") raise OptionValueError("This option doesn't take any arguments.")
res = api_client.list_all_watched_dirs() try:
if(res is None): res = api_client.list_all_watched_dirs()
except Exception, e:
exit("Unable to connect to the Airtime server.") exit("Unable to connect to the Airtime server.")
dirs = res["dirs"].items() dirs = res["dirs"].items()
# there will be always 1 which is storage folder # there will be always 1 which is storage folder
@ -204,8 +207,9 @@ def WatchRemoveAction(option, opt, value, parser):
path = currentDir+path path = currentDir+path
path = apc.encode_to(path, 'utf-8') path = apc.encode_to(path, 'utf-8')
if(os.path.isdir(path)): if(os.path.isdir(path)):
res = api_client.remove_watched_dir(path) try:
if(res is None): res = api_client.remove_watched_dir(path)
except Exception, e:
exit("Unable to connect to the Airtime server.") exit("Unable to connect to the Airtime server.")
# sucess # sucess
if(res['msg']['code'] == 0): if(res['msg']['code'] == 0):
@ -249,10 +253,11 @@ def StorageSetAction(option, opt, value, parser):
path = currentDir+path path = currentDir+path
path = apc.encode_to(path, 'utf-8') path = apc.encode_to(path, 'utf-8')
if(os.path.isdir(path)): if(os.path.isdir(path)):
res = api_client.set_storage_dir(path) try:
if(res is None): res = api_client.set_storage_dir(path)
except Exception, e:
exit("Unable to connect to the Airtime server.") exit("Unable to connect to the Airtime server.")
# sucess # success
if(res['msg']['code'] == 0): if(res['msg']['code'] == 0):
print "Successfully set storage folder to %s" % path print "Successfully set storage folder to %s" % path
else: else:

View file

@ -68,7 +68,7 @@ try:
subtotal += total subtotal += total
total = 0 total = 0
try: try:
api_client.update_cue_values_by_silan(processed_data) print api_client.update_cue_values_by_silan(processed_data)
except Exception ,e: except Exception ,e:
print e print e
print traceback.format_exc() print traceback.format_exc()