summaryrefslogtreecommitdiffhomepage
path: root/media
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-01-20 00:25:00 +0000
committerjao <jao@gnu.org>2021-01-20 00:25:00 +0000
commit2b44cb9166714d523d781eae439061b02a5b5ee0 (patch)
tree180e874de94eef2ca0cec894a01c093cb0bca80c /media
parentf0845f06fbaffbbfa1c218adac14864b5f4429d4 (diff)
downloadelibs-2b44cb9166714d523d781eae439061b02a5b5ee0.tar.gz
elibs-2b44cb9166714d523d781eae439061b02a5b5ee0.tar.bz2
espotify: little cleanups
Diffstat (limited to 'media')
-rw-r--r--media/espotify.org28
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