Refactored get_schedule not to suck
This commit is contained in:
parent
9cea6210bb
commit
09c3e3a694
|
@ -205,22 +205,9 @@ class AirtimeApiClient(object):
|
||||||
|
|
||||||
def get_schedule(self):
|
def get_schedule(self):
|
||||||
# TODO : properly refactor this routine
|
# TODO : properly refactor this routine
|
||||||
logger = self.logger
|
# For now thre return type is a little fucked for compatibility reasons
|
||||||
|
try: return (True, self.services.export_url())
|
||||||
# Construct the URL
|
except: (False, "")
|
||||||
export_url = self.construct_url("export_url")
|
|
||||||
logger.info("Fetching schedule from %s", export_url)
|
|
||||||
|
|
||||||
response = ""
|
|
||||||
try:
|
|
||||||
response_json = self.get_response_from_server(export_url)
|
|
||||||
response = json.loads(response_json)
|
|
||||||
success = True
|
|
||||||
except Exception, e:
|
|
||||||
logger.error(e)
|
|
||||||
success = False
|
|
||||||
|
|
||||||
return success, response
|
|
||||||
|
|
||||||
def notify_liquidsoap_started(self):
|
def notify_liquidsoap_started(self):
|
||||||
return self.services.notify_liquidsoap_started()
|
return self.services.notify_liquidsoap_started()
|
||||||
|
|
Loading…
Reference in New Issue