branch: externals/listen
commit 27b4e24ed23c5d14e1c61f29306acfbf0f3984b6
Author: Adam Porter <[email protected]>
Commit: Adam Porter <[email protected]>
Fix: (listen--info MPV) Ignore when metadata isn't available
---
listen-mpv.el | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/listen-mpv.el b/listen-mpv.el
index 17fe3534e0..86a9130df8 100755
--- a/listen-mpv.el
+++ b/listen-mpv.el
@@ -43,11 +43,14 @@
;;;; Functions
(cl-defmethod listen--info ((player listen-player-mpv))
- (map-apply (lambda (key value)
- ;; TODO: Consider using symbols as keys (VLC returns strings,
MPV's decodes as
- ;; symbols).
- (cons (downcase (symbol-name key)) value))
- (listen-mpv--get-property player "metadata")))
+ "Return metadata from MPV PLAYER, or nil if a track is not playing."
+ ;; If the metadata property isn't available, ignore the error.
+ (when-let ((metadata (ignore-errors (listen-mpv--get-property player
"metadata"))))
+ (map-apply (lambda (key value)
+ ;; TODO: Consider using symbols as keys (VLC returns strings,
MPV's decodes as
+ ;; symbols).
+ (cons (downcase (symbol-name key)) value))
+ metadata)))
(cl-defmethod listen--filename ((player listen-player-mpv))
"Return filename of PLAYER's current track."