Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load playlist or search for a track #61

Open
dsylla opened this issue Dec 14, 2020 · 7 comments
Open

Unable to load playlist or search for a track #61

dsylla opened this issue Dec 14, 2020 · 7 comments

Comments

@dsylla
Copy link

dsylla commented Dec 14, 2020

Hello,

I'm having an issue during the connexion process

M-x spotify-my-playlist
M-x spotify-search-track
M-x spotify-select-playlist

I'm on MacOS Big Sur 11.1 with GNU Emacs 27.1

my config.el

(setq debug-on-error 1)
(add-load-path! "private/spotify-dot-el")
(require 'spotify)
(setq spotify-oauth2-client-id "********************"
      spotify-oauth2-client-secret "*****************")
(setq spotify-transport 'connect)
(define-key spotify-mode-map (kbd "C-c .") 'spotify-command-map)

This is the output I get after a while in *Backtrace*

Debugger entered--Lisp error: (wrong-type-argument hash-table-p nil)
  gethash(devices nil)
  (and t (gethash 'devices json))
  (let* ((devices (and t (gethash 'devices json)))) (if devices (while (let* ((device (car devices)) (is-active (spotify-get-device-is-active device))) (progn (if (and device is-active) (progn (progn ... ...))) (setq devices (cdr devices)) (and device (not is-active))))) nil))
  (closure (spotify-device-select-mode-abbrev-table spotify-device-select-mode-syntax-table t) (json) (let* ((devices (and t (gethash 'devices json)))) (if devices (while (let* ((device ...) (is-active ...)) (progn (if ... ...) (setq devices ...) (and device ...)))) nil)))(nil)
  funcall((closure (spotify-device-select-mode-abbrev-table spotify-device-select-mode-syntax-table t) (json) (let* ((devices (and t (gethash 'devices json)))) (if devices (while (let* ((device ...) (is-active ...)) (progn (if ... ...) (setq devices ...) (and device ...)))) nil))) nil)
  (progn (funcall callback nil))
  (if callback (progn (funcall callback nil)))
  (condition-case _ (if (search-forward-regexp "^$" nil t) (progn (let* ((json-object-type 'hash-table) (json-array-type 'list) (json-key-type 'symbol) (json (json-read)) (error-json (gethash 'error json))) (kill-buffer) (if (and (hash-table-p error-json) (eq 401 (gethash ... error-json)) (not is-retry)) (spotify-api-call-async method uri data callback t) (if callback (progn (funcall callback json))))))) (end-of-file (kill-buffer) (if callback (progn (funcall callback nil)))))
  (closure ((is-retry) (callback closure (spotify-device-select-mode-abbrev-table spotify-device-select-mode-syntax-table t) (json) (let* ((devices (and t ...))) (if devices (while (let* ... ...)) nil))) (data) (uri . "/me/player/devices") (method . "GET") t) (_) (toggle-enable-multibyte-characters t) (goto-char (point-min)) (condition-case _ (if (search-forward-regexp "^$" nil t) (progn (let* ((json-object-type ...) (json-array-type ...) (json-key-type ...) (json ...) (error-json ...)) (kill-buffer) (if (and ... ... ...) (spotify-api-call-async method uri data callback t) (if callback ...))))) (end-of-file (kill-buffer) (if callback (progn (funcall callback nil))))))((:error (error connection-failed "connect" :host "api.spotify.com" :service 443)))
  apply((closure ((is-retry) (callback closure (spotify-device-select-mode-abbrev-table spotify-device-select-mode-syntax-table t) (json) (let* ((devices (and t ...))) (if devices (while (let* ... ...)) nil))) (data) (uri . "/me/player/devices") (method . "GET") t) (_) (toggle-enable-multibyte-characters t) (goto-char (point-min)) (condition-case _ (if (search-forward-regexp "^$" nil t) (progn (let* ((json-object-type ...) (json-array-type ...) (json-key-type ...) (json ...) (error-json ...)) (kill-buffer) (if (and ... ... ...) (spotify-api-call-async method uri data callback t) (if callback ...))))) (end-of-file (kill-buffer) (if callback (progn (funcall callback nil)))))) (:error (error connection-failed "connect" :host "api.spotify.com" :service 443)))
  url-http-activate-callback()
  url-http-async-sentinel(#<process api.spotify.com<15>> "connect")

Thanks in advance

@dsylla dsylla changed the title Unable to load playlist of search for a track Unable to load playlist or search for a track Dec 14, 2020
@danielfm
Copy link
Owner

Unfortunately I don't have access to a similar hardware and OS in order to debug this. Other people who do might be able to help.

@elken
Copy link

elken commented Dec 22, 2020

I'm having the same behaviour on Linux except I'm not getting a *Backtrace* it just silently fails. I can access my playlists fine so there's no auth issue.

EDIT: with debug-on-error on I also get a failure relating to /me/player/devices

EDIT 2: Managed to capture output from *URL-DEBUG* https://gist.github.com/elken/4df5a2dc38506ed0c2da7318018821e7

EDIT 3: It actually seems to fail on Spotify's end too :/ https://developer.spotify.com/console/get-user-player/ fails for me with an unfulfilled promise

EDIT 4: Issue located, if there is no applicable device to play music on, /me/player returns a 204 which should probably be handled

@dsylla
Copy link
Author

dsylla commented Dec 23, 2020

Yes @elken I think the *Backtrace* buffer is from my "distribution" of Emacs (Doom Emacs).

Maybe the issue is not only from the package itself ... I'm not that good in Elisp so I'm not sure but from your output it seems like a there is also an issue with SSL ?

@dsylla
Copy link
Author

dsylla commented Dec 23, 2020

UPDATE: I'm now able to load my playlists and a specific playlist but when I try to play a song nothing appends, and this time no error or trace whatsoever.

Nothing changed on my computer since my initial report. This leads me to think that maybe the issue is with Spotify API itself ...

@elken
Copy link

elken commented Dec 23, 2020

You have to have at least 1 device with Spotify open/able to stream to

@jkdufair
Copy link
Contributor

jkdufair commented Feb 9, 2021

Hi @dsylla -

I was getting this issue as well and have found some issues with Emacs' http request libraries. I've got a pull request submitted that uses request.el instead and it's behaving well. Maybe keep an eye on that and/or test it out?

@jkdufair
Copy link
Contributor

@dsylla with the last PR merge, this issue should be resolved

@ykgoon ykgoon mentioned this issue May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants