diff options
-rw-r--r-- | media/espotify.org | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/media/espotify.org b/media/espotify.org index 1548c71..02abf65 100644 --- a/media/espotify.org +++ b/media/espotify.org @@ -135,11 +135,13 @@ Let's start with an umbrella customization group: to a given query, specified as a triple of term, types and filter: #+begin_src emacs-lisp - (defun espotify-search (callback term types &optional filter) - (let ((query-url (espotify--make-search-url term types filter))) - (espotify--with-auth-token + (defun espotify-get (callback url) + (espotify--with-auth-token (lambda (token) - (espotify--with-query-results token query-url callback))))) + (espotify--with-query-results token url callback)))) + + (defun espotify-search (callback term types &optional filter) + (espotify-get callback (espotify--make-search-url term types filter))) #+end_src For instance: @@ -302,15 +304,15 @@ Let's start with an umbrella customization group: (lambda (action) (pcase action ((pred stringp) - (if (string-suffix-p espotify-search-suffix action) - (espotify-search-all - (lambda (x) - (funcall next 'flush) - (funcall next x)) - (substring action 0 (- (length action) - (length espotify-search-suffix))) - type - filter))) + (when (string-suffix-p espotify-search-suffix action) + (espotify-search-all + (lambda (x) + (funcall next 'flush) + (funcall next x)) + (substring action 0 (- (length action) + (length espotify-search-suffix))) + type + filter))) (_ (funcall next action))))) #+end_src |