Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
d067cf0222
7 changed files with 20 additions and 68 deletions
|
@ -196,30 +196,10 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
|
||||
def get_schedule(self, start=None, end=None):
|
||||
logger = logging.getLogger()
|
||||
|
||||
"""
|
||||
calculate start/end time range (format: YYYY-DD-MM-hh-mm-ss,YYYY-DD-MM-hh-mm-ss)
|
||||
(seconds are ignored, just here for consistency)
|
||||
"""
|
||||
tnow = time.localtime(time.time())
|
||||
if (not start):
|
||||
tstart = time.localtime(time.time() - 3600 * int(self.config["cache_for"]))
|
||||
start = "%04d-%02d-%02d-%02d-%02d" % (tstart[0], tstart[1], tstart[2], tstart[3], tstart[4])
|
||||
|
||||
if (not end):
|
||||
tend = time.localtime(time.time() + 3600 * int(self.config["prepare_ahead"]))
|
||||
end = "%04d-%02d-%02d-%02d-%02d" % (tend[0], tend[1], tend[2], tend[3], tend[4])
|
||||
|
||||
range = {}
|
||||
range['start'] = start
|
||||
range['end'] = end
|
||||
|
||||
|
||||
# Construct the URL
|
||||
export_url = self.config["base_url"] + self.config["api_base"] + self.config["export_url"]
|
||||
|
||||
# Insert the start and end times into the URL
|
||||
export_url = export_url.replace('%%from%%', range['start'])
|
||||
export_url = export_url.replace('%%to%%', range['end'])
|
||||
logger.info("Fetching schedule from %s", export_url)
|
||||
export_url = export_url.replace('%%api_key%%', self.config["api_key"])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue