stevenewbs / gmpydl

Google Music Python Downloader
MIT License
22 stars 8 forks source link

Could not retrieve oauth credentials #8

Closed hitzemann closed 7 years ago

hitzemann commented 7 years ago

I freshly installed gmpydl from git as well as gmusicapi from simon-weber's repo. When running gmpydl I am asked for my Google Account email and the download destination just for being told that the oauth2.cred does not exist, see below:

Welcome to gmpydl - I cant find a config file so please enter the following to begin

Google Account email address: xxx@xxx.xxx
Music download destination directory: /home/simon/Music
2016-11-30 12:44:29,044 - gmusicapi.Musicmanager1 (musicmanager:186) [WARNING]: could not retrieve oauth credentials from ''/home/simon/.local/share/gmusicapi/oauth2.cred''

It looked to me like it tries reading the oauth settings for the second account without even having a first account. The following workaround fixed it for me:

diff --git a/gmpydl.py b/gmpydl.py
index 5fb1f3f..691ea59 100755
--- a/gmpydl.py
+++ b/gmpydl.py
@@ -129,9 +129,9 @@ def api_init():
     mm = Musicmanager()
     e = settings['email']
     creds = os.path.expanduser("~/.local/share/gmusicapi/oauth.cred") # default oauth store location
-    if settings['first2'] == '1' or OTHERACCOUNT:
-        e = settings['email2']
-        creds = os.path.expanduser("~/.local/share/gmusicapi/oauth2.cred")
+#    if settings['first2'] == '1' or OTHERACCOUNT:
+#        e = settings['email2']
+#        creds = os.path.expanduser("~/.local/share/gmusicapi/oauth2.cred")
     if e is not None:
         if settings['first2'] == '1' or settings['first'] == '1':
             print "Performing OAUTH for %s" % e
stevenewbs commented 7 years ago

Hi,

Thanks for this - think its just some bad logic around deciding whether or not to go into the second account credentials. I will fix and update