@@ -229,15 +229,15 @@ def read_lines(self, file):
229
229
for line in file :
230
230
# If there is more than one PRODID line or a TZUNTIL line, skip them:
231
231
if (not ("PRODID:" in line and "PRODID:" in previous_line ) and
232
- not ("TZUNTIL" in line )):
232
+ not ("TZUNTIL" in line )):
233
233
text += line
234
234
previous_line = line
235
235
return text
236
236
237
237
def read_file (self , path ):
238
238
"""Parse an ics file if it exists"""
239
239
if not os .path .exists (path ):
240
- logging .error ("Failed to load %s. Probably path is incorrect ." , path )
240
+ logging .error ("Failed to load %s because file does not exist ." , path )
241
241
return ""
242
242
with open (path , 'r' , encoding = "utf-8" ) as file :
243
243
return self .read_lines (file )
@@ -249,10 +249,10 @@ def read_url(self, path):
249
249
file = io .TextIOWrapper (response , 'utf-8' )
250
250
return self .read_lines (file )
251
251
except urllib .error .HTTPError :
252
- logging .error ("Failed to load %s. Probably url is wrong." , path )
252
+ logging .error ("Failed to load from %s. Probably url is wrong." , path )
253
253
return ""
254
254
except urllib .error .URLError :
255
- logging .error ("Failed to load %s. Probably no internet connection." , path )
255
+ logging .error ("Failed to load from %s. Probably no internet connection." , path )
256
256
return ""
257
257
258
258
def read_resource (self , path ):
@@ -337,12 +337,8 @@ def load(self):
337
337
year , month , day , calendar_number )
338
338
self .user_ics_tasks .add_item (new_task )
339
339
340
- except NotImplementedError : # More than one calendar in the file
341
- logging .error ("Failed to load %s. Probably more that one calendar in this file." , filename )
342
- pass
343
340
except Exception :
344
- logging .error ("Failed to load %s." , filename )
345
- pass
341
+ logging .error ("Failed to parse %s." , filename )
346
342
return self .user_ics_tasks
347
343
348
344
@@ -402,11 +398,7 @@ def load(self):
402
398
frequency , status , is_private , calendar_number )
403
399
self .user_ics_events .add_item (new_event )
404
400
405
- except NotImplementedError : # More than one calendar in the file
406
- logging .error ("Failed to load %s. Probably more that one calendar in this file" , filename )
407
- pass
408
401
except Exception :
409
- logging .error ("Failed to load %s." , filename )
410
- pass
402
+ logging .error ("Failed to parse %s." , filename )
411
403
412
404
return self .user_ics_events
0 commit comments