File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -252,12 +252,12 @@ def cache(self) -> dict:
252252
253253 def download (self , clb = None ):
254254 """ Downloads an XMLTV file. """
255- res = urlparse (self ._url )
256- if not all ((res .scheme , res .netloc )):
257- log (f"{ self .__class__ .__name__ } [download] error: Invalid URL { self ._url } " )
258- return
259-
260255 try :
256+ res = urlparse (self ._url )
257+ if not all ((res .scheme , res .netloc )):
258+ log (f"{ self .__class__ .__name__ } [download] error: Invalid URL { self ._url } " )
259+ return
260+
261261 with requests .get (url = self ._url , stream = True , timeout = (5 , 5 )) as resp :
262262 if resp .reason == "OK" :
263263 suf = self ._url [self ._url .rfind ("." ):]
@@ -314,10 +314,9 @@ def download(self, clb=None):
314314 log (f"{ self .__class__ .__name__ } [download] error: { resp .reason } " )
315315 except requests .exceptions .RequestException as e :
316316 log (f"{ self .__class__ .__name__ } [download] error: { e } " )
317- return
318-
319- if clb :
320- clb ()
317+ finally :
318+ if clb :
319+ clb ()
321320
322321 def get_current_events (self , names : set ) -> dict :
323322 events = defaultdict (list )
You can’t perform that action at this time.
0 commit comments