Skip to content

Commit

Permalink
update zomato
Browse files Browse the repository at this point in the history
  • Loading branch information
captn3m0 committed Mar 27, 2024
1 parent 4d5b013 commit d77b78f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/zomato.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ def get_event_details(event_id, zomaland = False):

def parse_datetime(dt):
tz = datetime.timezone(datetime.timedelta(hours=5, minutes=30)) # Asia/Kolkata timezone
print(dt)
(start,end) = dt.split("-")
r_start = None
print(start)
for d in list(datefinder.find_dates(start)):
days = (d - datetime.datetime.now()).days
if days > 0 and days < 90:
Expand All @@ -63,6 +65,9 @@ def parse_datetime(dt):
r_end = dd
break

if r_start == None:
return None

# Move end by 1 day
if r_end < r_start:
r_end = r_end + datetime.timedelta(days=1)
Expand Down Expand Up @@ -95,6 +100,8 @@ def make_event(event_id, data):
# IF not, let us check our datetime properly
if 'url' not in r and 'onwards' not in r['datetime']:
r['start'], r['end'] = parse_datetime(r['datetime'])
if r['start'] == None:
return None

return r

Expand All @@ -104,6 +111,8 @@ def make_event(event_id, data):
# Zomaland tickets show up via Insider anyway
if not zomaland:
jsonData = get_event_details(e, zomaland)
events.append(make_event(e, jsonData))
event = make_event(e, jsonData)
if event!=None:
events.append(event)
with open("out/zomato.json", "w") as f:
json.dump(sorted(events, key=lambda x: x['event_id']), f, indent=2)

0 comments on commit d77b78f

Please sign in to comment.