CC-2098: Only push playlists that havent ended yet

-implemented. Removed ability to specify time ranges for now, and defaulted to looking from now to 24 hours ahead.
Being able to specify time ranges was removed, since we are not using bi-directional communication between pypofetch and Airtime server.
This commit is contained in:
martin 2011-03-24 23:43:27 -04:00
parent 343fb593ee
commit 1107a67579
7 changed files with 20 additions and 68 deletions

View file

@ -189,30 +189,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"])