def close(self): if hasattr(self, '_json') and not self._shutdown: self._shutdown = True try: self._json.cancel() self.shutdown() finally: self._json = None # Clean debris from the cache dir if not self._mediaSettings.user_download_path and self._mediaSettings.delete_files: try: clear_media_cache(self._mediaSettings.media_cache_path) except: pass
def close(self): if hasattr(self, "_json") and not self._shutdown: self._shutdown = True try: self._json.cancel() self.shutdown() finally: self._json = None # Clean debris from the cache dir if self._mediaSettings.delete_files: try: clear_media_cache(os.path.join(_settings.cache_path, self._mediaSettings.mediaType)) except: pass