diff --git a/rip/config.py b/rip/config.py index 35e9782..e3a431f 100644 --- a/rip/config.py +++ b/rip/config.py @@ -70,11 +70,19 @@ class Config: def update(self): """Reset the config file except for credentials.""" self.reset() - temp = copy.deepcopy(self.defaults) - temp["qobuz"].update(self.file["qobuz"]) - temp["tidal"].update(self.file["tidal"]) - self.dump(temp) - del temp + # Save original credentials + qobuz_creds = self.file["qobuz"] + tidal_creds = self.file["tidal"] + + # Reset and load config file + shutil.copy(self.default_config_path, self._path) + self.load() + + # Set credentials and download directory, then save + self.file["qobuz"].update(qobuz_creds) + self.file["tidal"].update(tidal_creds) + self.file["downloads"]["folder"] = DOWNLOADS_DIR + self.save() def save(self): """Save the config state to file.""" diff --git a/streamrip/utils.py b/streamrip/utils.py index a1afa74..90c41ab 100644 --- a/streamrip/utils.py +++ b/streamrip/utils.py @@ -230,7 +230,7 @@ class DownloadStream: self.request = self.session.get( url, allow_redirects=True, stream=True, params=params ) - self.file_size = int(self.request.headers["Content-Length"]) + self.file_size = int(self.request.headers.get("Content-Length", 0)) if self.file_size == 0: raise NonStreamable