mopidy / mopidy-gmusic

DEPRECATED (Mopidy extension for playing music from Google Play Music)
https://mopidy.com
Apache License 2.0
214 stars 60 forks source link

Cannot log in, exception thrown before deviceid is given #220

Closed mminklet closed 3 years ago

mminklet commented 5 years ago

Unable to log into GMusic and where a device id list is supposed to be generated, I get an exception

ERROR    Failed to login to Google Music as "mike@foobar.com"
ERROR    There is no gmusic deviceid set. Registered devices are listed below.
ERROR    Unhandled exception in GMusicBackend (urn:uuid:8aaba54e-93b0-411c-ab30-foobar):
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pykka/actor.py", line 192, in _actor_loop
    self.on_start()
  File "/usr/local/lib/python2.7/dist-packages/mopidy_gmusic/backend.py", line 57, in on_start
    for device in self.session.api.get_registered_devices():
  File "/usr/local/lib/python2.7/dist-packages/gmusicapi/clients/mobileclient.py", line 879, in get_registered_devices
    res = self._make_call(mobileclient.GetDeviceManagementInfo)
  File "/usr/local/lib/python2.7/dist-packages/gmusicapi/clients/mobileclient.py", line 48, in _make_call
    return super(Mobileclient, self)._make_call(protocol, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/gmusicapi/clients/shared.py", line 90, in _make_call
    return protocol.perform(self.session, self.validate, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/gmusicapi/protocol/shared.py", line 213, in perform
    response = session.send(req_kwargs, required_auth)
  File "/usr/local/lib/python2.7/dist-packages/gmusicapi/session.py", line 113, in send
    raise NotLoggedIn
NotLoggedIn
ERROR    Actor died: GMusicBackend (urn:uuid:8aaba54e-93b0-411c-ab30-foobar) stopped before handling the message

Where can I get a device ID from?

mminklet commented 5 years ago

sudo mopidyctl deps output

Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf deps" as user mopidy
Executable: /usr/bin/mopidy
Platform: Linux-4.19.42-v7+-armv7l-with-debian-9.9
Python: CPython 2.7.13 from /usr/lib/python2.7
Mopidy: 2.2.2 from /usr/lib/python2.7/dist-packages
Mopidy-GMusic: 3.0.0 from /usr/local/lib/python2.7/dist-packages
  cachetools>=1.0: 3.1.1 from /usr/local/lib/python2.7/dist-packages
  requests>=2.0: 2.12.4 from /usr/lib/python2.7/dist-packages
  setuptools: 33.1.1 from /usr/lib/python2.7/dist-packages
  gmusicapi>=10.1: 12.1.0 from /usr/local/lib/python2.7/dist-packages
    appdirs>=1.1.0: 1.4.3 from /usr/local/lib/python2.7/dist-packages
    six>=1.9.0: 1.12.0 from /usr/lib/python2.7/dist-packages
    protobuf>=3.0.0: 3.8.0 from /usr/local/lib/python2.7/dist-packages
      six>=1.9: 1.12.0 from /usr/lib/python2.7/dist-packages
      setuptools: 33.1.1 from /usr/lib/python2.7/dist-packages
    oauth2client>=1.1: 4.1.3 from /usr/local/lib/python2.7/dist-packages
      rsa>=3.1.4: 4.0 from /usr/local/lib/python2.7/dist-packages
        pyasn1>=0.1.3: 0.4.5 from /usr/local/lib/python2.7/dist-packages
      httplib2>=0.9.1: 0.13.0 from /usr/local/lib/python2.7/dist-packages
      six>=1.6.1: 1.12.0 from /usr/lib/python2.7/dist-packages
      pyasn1-modules>=0.0.5: 0.2.5 from /usr/local/lib/python2.7/dist-packages
        pyasn1<0.5.0,>=0.4.1: 0.4.5 from /usr/local/lib/python2.7/dist-packages
      pyasn1>=0.1.7: 0.4.5 from /usr/local/lib/python2.7/dist-packages
    gpsoauth>=0.2.0: 0.4.1 from /usr/local/lib/python2.7/dist-packages
      pycryptodomex>=3.0: 3.8.2 from /usr/local/lib/python2.7/dist-packages
      requests: 2.12.4 from /usr/lib/python2.7/dist-packages
    proboscis>=1.2.5.1: 1.2.6.0 from /usr/local/lib/python2.7/dist-packages
    validictory!=0.9.2,>=0.8.0: 1.1.2 from /usr/local/lib/python2.7/dist-packages
    future: 0.17.1 from /usr/local/lib/python2.7/dist-packages
    mock>=0.7.0: 3.0.5 from /usr/local/lib/python2.7/dist-packages
      funcsigs>=1; python_version < "3.3": 1.0.2 from /usr/local/lib/python2.7/dist-packages
      six: 1.12.0 from /usr/lib/python2.7/dist-packages
    python-dateutil!=2.0,>=1.3: 2.8.0 from /usr/local/lib/python2.7/dist-packages
      six>=1.5: 1.12.0 from /usr/lib/python2.7/dist-packages
    decorator>=3.3.1: 4.4.0 from /usr/local/lib/python2.7/dist-packages
    requests!=1.2.0,!=2.12.0,!=2.12.1,!=2.12.2,!=2.18.2,!=2.2.1,!=2.8.0,!=2.8.1,>=1.1.0: 2.12.4 from /usr/lib/python2.7/dist-packages
    mutagen>=1.34: 1.42.0 from /usr/local/lib/python2.7/dist-packages
    MechanicalSoup>=0.4.0: 0.11.0 from /usr/local/lib/python2.7/dist-packages
      beautifulsoup4: 4.7.1 from /usr/local/lib/python2.7/dist-packages
        soupsieve>=1.2: 1.9.1 from /usr/local/lib/python2.7/dist-packages
          backports.functools-lru-cache; python_version < "3": 1.5 from /usr/local/lib/python2.7/dist-packages
      requests>=2.0: 2.12.4 from /usr/lib/python2.7/dist-packages
      lxml: 4.3.4 from /usr/local/lib/python2.7/dist-packages
      six>=1.4: 1.12.0 from /usr/lib/python2.7/dist-packages
  Pykka>=1.1: 1.2.1 from /usr/lib/python2.7/dist-packages
  Mopidy>=1.0: 2.2.2 from /usr/lib/python2.7/dist-packages
Mopidy-Spotify: 3.1.0 from /usr/lib/python2.7/dist-packages
  Mopidy>=2.0: 2.2.2 from /usr/lib/python2.7/dist-packages
  Pykka>=1.1: 1.2.1 from /usr/lib/python2.7/dist-packages
  pyspotify>=2.0.5: 2.0.5 from /usr/lib/python2.7/dist-packages
    cffi>=1.0.0: 1.9.1 from /usr/lib/python2.7/dist-packages
  requests>=2.0: 2.12.4 from /usr/lib/python2.7/dist-packages
GStreamer: 1.10.4.0 from /usr/lib/python2.7/dist-packages/gi
  Detailed information:
    Python wrapper: python-gi 3.22.0
    Relevant elements:
      Found:
        uridecodebin
        souphttpsrc
        appsrc
        alsasink
        osssink
        oss4sink
        pulsesink
        id3demux
        id3v2mux
        lamemp3enc
        mad
        mpegaudioparse
        mpg123audiodec
        vorbisdec
        vorbisenc
        vorbisparse
        oggdemux
        oggmux
        oggparse
        flacdec
        flacparse
        shout2send
      Not found:
        flump3dec
mminklet commented 5 years ago

sudo mopidy config output

Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf config" as user mopidy
[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
color = true
console_format = %(levelname)-8s %(message)s
debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n  %(message)s
debug_file = /var/log/mopidy/mopidy-debug.log
config_file = /etc/mopidy/logging.conf

[audio]
mixer = software
mixer_volume =
output = autoaudiosink
buffer_time =

[proxy]
scheme =
hostname =
port =
username =
password =

[gmusic]
enabled = true
username = mike@foobar.com
password = ********
bitrate = 160
deviceid =
all_access = true
refresh_library = 1440
refresh_playlists = 60
radio_stations_in_browse = true
radio_stations_as_playlists = false
radio_stations_count =
radio_tracks_count = 25
top_tracks_count = 20

[mpd]
enabled = true
hostname = 127.0.0.1
port = 6600
password =
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist =
  listall
  listallinfo
default_playlist_scheme = m3u

[http]
enabled = true
hostname = 0.0.0.0
port = 6680
static_dir =
zeroconf = Mopidy HTTP server on $hostname
allowed_origins =
csrf_protection = true

[stream]
enabled = true
protocols =
  http
  https
  mms
  rtmp
  rtmps
  rtsp
metadata_blacklist =
timeout = 5000

[m3u]
enabled = true
base_dir =
default_encoding = latin-1
default_extension = .m3u8
playlists_dir = /var/lib/mopidy/playlists

[softwaremixer]
enabled = true

[file]
enabled = true
media_dirs =
  $XDG_MUSIC_DIR|Music
  ~/|Home
excluded_file_extensions =
  .jpg
  .jpeg
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[local]
enabled = true
library = json
media_dir = /media/main/Transfer/My Music/Various
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
excluded_file_extensions =
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .png
  .txt
  .ini

[spotify]
enabled = true
username = foobar
password = ********
client_id = 03ae6200-5b32-4fd2-bb84-57cf2380c4dd
client_secret = ********
bitrate = 160
volume_normalization = true
private_session = false
timeout = 10
allow_cache = true
allow_network = true
allow_playlists = true
search_album_count = 20
search_artist_count = 10
search_track_count = 50
toplist_countries =
jacobobryant commented 5 years ago

Looks like this is because the username/password login was deprecated (#212). But if you install this extension from the master branch (pip install https://github.com/mopidy/mopidy-gmusic/archive/master.zip), then you can:

  1. run mopidy, and click on the link in the log output to get an auth code from google. then put this as the value of initial_code in your config.
  2. run mopidy again. There'll be a refresh token in the log output; put that as the value of refresh_token in your config.
mrki0620 commented 5 years ago

Hi jacobobryant. Thanks for the explanation, works like a charm.

kingosticks commented 5 years ago

Can we make this any easier if we do something similar to what Spotify and soundcloud have at https://www.mopidy.com/authenticate/ ?

jacobobryant commented 5 years ago

221 will make this a lot easier once it's merged; then you'd just have to do mopidy gmusic login. I'm not familiar enough with the gmusic api to know if it would be much extra effort do it from javascript instead.

jodal commented 3 years ago

Closing because Google Play Music has been shut down, and this project is being discontinued.