summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorexislow <exislow@users.noreply.github.com>2024-11-10 12:42:17 +0100
committerGitHub <noreply@github.com>2024-11-10 12:42:17 +0100
commit96f762651e5b97d3d81b10170ba82db6da0b87db (patch)
treecea1bc4ad97d6ae0c276c0864598e242227f2e84
parentef2116f2b0fe10c3ffc3c465650da2991eeb16d9 (diff)
parent913c88e65c1e2da87ff83089cbadb1113af7f77e (diff)
downloadtidal-dl-ng-96f762651e5b97d3d81b10170ba82db6da0b87db.tar.gz
Merge pull request #221 from exislow/197-bug-both-cli-and-gui-app-crashes-with-jsondecodeerror-expecting-value-line-1-column-1-char-0
If login fails `token.json` will be removed, so the user can have a f…
-rw-r--r--tidal_dl_ng/config.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tidal_dl_ng/config.py b/tidal_dl_ng/config.py
index 715b7d3..a3ab809 100644
--- a/tidal_dl_ng/config.py
+++ b/tidal_dl_ng/config.py
@@ -125,8 +125,16 @@ class Tidal(BaseConfig, metaclass=SingletonMeta):
self.data.expiry_time,
is_pkce=do_pkce,
)
- except HTTPError:
+ except (HTTPError, JSONDecodeError):
result = False
+ # Remove token file. Probably corrupt or invalid.
+ if os.path.exists(self.file_path):
+ os.remove(self.file_path)
+
+ print(
+ "Either there is something wrong with your credentials / account or some server problems on TIDALs "
+ "side. Anyway... Try to login again by re-starting this app."
+ )
return result