Bug fixed alarms as supposed by arustleund
This commit is contained in:
parent
73ccfba021
commit
c79f0b8888
1 changed files with 16 additions and 2 deletions
|
@ -56,5 +56,19 @@ class IcalEvents(CalendarInterface):
|
|||
return loaded_events
|
||||
|
||||
def __fix_errors__(self, decode):
|
||||
decode = self.__remove_alarms__(decode)
|
||||
return decode.replace('BEGIN:VALARM\r\nACTION:NONE','BEGIN:VALARM\r\nACTION:DISPLAY\r\nDESCRIPTION:') \
|
||||
.replace('BEGIN:VALARM\r\nACTION:EMAIL','BEGIN:VALARM\r\nACTION:DISPLAY\r\nDESCRIPTION:')
|
||||
|
||||
def __remove_alarms__(self, decode):
|
||||
alarm_begin = 'BEGIN:VALARM'
|
||||
alarm_end = 'END:VALARM'
|
||||
lineseparation = '\r\n'
|
||||
|
||||
beginAlarmIndex = 0
|
||||
while beginAlarmIndex >= 0:
|
||||
beginAlarmIndex = decode.find(alarm_begin)
|
||||
if beginAlarmIndex >= 0:
|
||||
endAlarmIndex = decode.find(alarm_end, beginAlarmIndex)
|
||||
decode = decode[:beginAlarmIndex] + decode[endAlarmIndex + len(alarm_end) + len(lineseparation):]
|
||||
return decode
|
Loading…
Reference in a new issue