;;; Commentary:
-;; - listen & submit metadata to ListenBrainz
-;; - partial & incomplete
-;; - no error checks
-;; - sync -> async
+;; An interface to ListenBrainz, a project to store a record of the music that
+;; you listen to. The listening data, can be used to provide statistics,
+;; recommendations and general exploration.
+;;
+;; The package can be used programmatically (e.g. from a music player) to auto
+;; submit listening data `listenbrainz-submit-listen'. There are other entrypoints
+;; for reading user stats such as `listenbrainz-stats-artists' or
+;; `listenbrainz-listens'.
+;;
+;; Some API calls require a user token, which can be found in your ListenBrainz
+;; profile. Configure, set or `customize' the `listenbrainz-api-token' as needed.
+;;
+;; https://listenbrainz.readthedocs.io/
;;; Code:
;;
;;;; ; ;; ;
-
(defmacro listenbrainz--deformatter (name format-string format-args alist)
"Generate function with NAME to format data returned from an API call.
The function has the name `listenbrainz--format-NAME`.
;;
;;; ; ;; ; ; ;
-;;;###autoload
(defun listenbrainz-validate-token (token)
"Check if TOKEN is valid. Return a username or nil."
(message "listenbrainz: checking token %s" token)
:sync t
:success (cl-function
(lambda (&key data &allow-other-keys)
- (message "Listens for user: %s" username)))))))
+ (message "Listens for user: %s\n%s" username
+ (if data data ""))))))))
(princ (listenbrainz--format-listens response))))
:sync t
:success (cl-function
(lambda (&key data &allow-other-keys)
- (message "User playing now: %s" username)))))))
+ (message "User playing now: %s\n%s" username
+ (if data data ""))))))))
(princ (listenbrainz--format-playing response))))
:sync t
:success (cl-function
(lambda (&key data &allow-other-keys)
- (message "Top recordings for user: %s" username)))))))
+ (message "Top recordings for user: %s\n%s" username
+ (if data data ""))))))))
(princ (listenbrainz--format-stats-2 response))))
:sync t
:success (cl-function
(lambda (&key data &allow-other-keys)
- (message "Top releases for user: %s" username)))))))
+ (message "Top releases for user: %s\n%s" username
+ (if data data ""))))))))
(princ (listenbrainz--format-stats-0 response))))
:sync t
:success (cl-function
(lambda (&key data &allow-other-keys)
- (message "Top artists for user: %s" username)))))))
+ (message "Top artists for user: %s\n%s" username
+ (if data data ""))))))))
(princ (listenbrainz--format-stats-1 response))))
:sync t
:success (cl-function
(lambda (&key data &allow-other-keys)
- (message "Followers for %s" username)))))))
+ (message "Followers for %s\n%s" username
+ (if data data ""))))))))
(if (string= "graph" output)
- (princ (listenbrainz--format-followers-graph response))
- (princ (listenbrainz--format-followers-list response)))))
+ (princ (listenbrainz--format-followers-graph response))
+ (princ (listenbrainz--format-followers-list response)))))
;;;###autoload
(defun listenbrainz-following (username)
:sync t
:success (cl-function
(lambda (&key data &allow-other-keys)
- (message "Users %s is following" username)))))))
+ (message "Users %s is following\n%s" username
+ (if data data ""))))))))
(princ (listenbrainz--format-following response))))