malcolmstill / thunner

A curses Google Play Music client
104 stars 25 forks source link

AttributeError: 'Webclient' object has no attribute 'get_all_songs' #20

Open certik opened 10 years ago

certik commented 10 years ago
$ ./thunner 
Traceback (most recent call last):
  File "./thunner", line 442, in <module>
    main()
  File "./thunner", line 292, in main
    library = api.get_all_songs()
AttributeError: 'Webclient' object has no attribute 'get_all_songs'

I am using gmusicapi 4.0.0.

certik commented 10 years ago

The following patch fixes it:

diff --git a/thunner b/thunner
index fd1ddd8..738b2fa 100755
--- a/thunner
+++ b/thunner
@@ -36,7 +36,7 @@ import signal

 from Queue import Queue, Empty
 from threading import Thread
-from gmusicapi import Webclient
+from gmusicapi import Mobileclient
 from getpass import getpass
 from operator import itemgetter

@@ -105,7 +105,7 @@ def name_colors(colordefs):
     return colormap

 def apiinit(email,password):
-    api = Webclient()
+    api = Mobileclient()
     api.login(email, password)
     return api

Then it fails later with:

Traceback (most recent call last):
  File "./thunner", line 442, in <module>
    main()
  File "./thunner", line 293, in main
    artists, albums = gen_trees(library)
  File "./thunner", line 233, in gen_trees
    "subtree":sorted(tracks,key=itemgetter('track')),
KeyError: 'track'

which is fixed by #8. After applying that PR, it fails with:

Traceback (most recent call last):
  File "./thunner", line 444, in <module>
    main()
  File "./thunner", line 297, in main
    playlist_ids = api.get_all_playlist_ids()
AttributeError: 'Mobileclient' object has no attribute 'get_all_playlist_ids'

and after the following patch:

@@ -292,7 +294,7 @@ def main():
         library = api.get_all_songs()
         artists, albums = gen_trees(library)

-        playlist_ids = api.get_all_playlist_ids()
+        playlist_ids = api.get_all_playlists()
         playlists = list_playlists(api,playlist_ids)

         scr.clear()

it fails with:

Traceback (most recent call last):
  File "./thunner", line 444, in <module>
    main()
  File "./thunner", line 298, in main
    playlists = list_playlists(api,playlist_ids)
  File "./thunner", line 245, in list_playlists
    for name,pids in playlist_ids['user'].iteritems():
TypeError: list indices must be integers, not str
vtr88 commented 8 years ago

Is this fixed or not? I'm getting the same error.

https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/webclient.py

there is no get_all_songs there.

[edit] Took me some time to realise this was abbandoned, last commit been a while, probably a bunch of other things changed (tried to change to mobileclient but the login() also changed)