forked from NoLog.cz/trhlina-calendar
fixes "empty topic tag bug"
Honestly just stupid change that unbreaks this code (something I should do at the beginning). Stupid fix but works
This commit is contained in:
parent
c9a6c61f69
commit
f25d0b0bfa
1 changed files with 9 additions and 4 deletions
13
get_json.py
13
get_json.py
|
@ -33,6 +33,14 @@ def save_to_json(event_list):
|
|||
with open('events.json', 'w') as fp:
|
||||
json.dump(event_array, fp)
|
||||
|
||||
def set_name(raw_event):
|
||||
try:
|
||||
if raw_event["post"]["topic"]["tags"][0] == 'closed-event':
|
||||
event_name = "Closed"
|
||||
return event_name
|
||||
except:
|
||||
event_name = raw_event["post"]["topic"]["title"]
|
||||
return event_name
|
||||
|
||||
def parse_time(timestring):
|
||||
if timestring!= None:
|
||||
|
@ -54,10 +62,7 @@ def create_event_list(json):
|
|||
if event_end_time == None or event_first_start_datetime==event_end_time:
|
||||
event_end_time=offset_time(event_first_start_datetime, 1.5)
|
||||
|
||||
if raw_event["post"]["topic"]["tags"][0] == 'closed-event':
|
||||
event_name = "Closed"
|
||||
else:
|
||||
event_name = raw_event["post"]["topic"]["title"]
|
||||
event_name = set_name(raw_event)
|
||||
|
||||
|
||||
event_list.append((event_first_start_datetime,event_name,event_end_time))
|
||||
|
|
Loading…
Reference in a new issue