From b8ff03c88bd1683f387554c5c6f8ba5a9a38302f Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Sun, 7 Dec 2014 20:39:25 +0000 Subject: [PATCH] notifications on new song it's rough and ready but does work --- squeeze.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/squeeze.el b/squeeze.el index a255c60..16fdb83 100644 --- a/squeeze.el +++ b/squeeze.el @@ -98,6 +98,8 @@ (and current (max 0 (min 100 (+ current number))))) (setf (squeeze-player-volume player) number)))) +(require 'notifications) + (defun squeeze-update-state-from-line (string) (cond ((string-match "^players 0" string) @@ -110,6 +112,11 @@ (let ((substring (substring string (match-end 0))) (id (url-unhex-string (match-string 1 string)))) (cond + ((string-match "^playlist newsong \\(.*\\) \\([0-9]+\\)$" substring) + (let ((value (save-match-data (url-unhex-string (match-string 1 substring)))) + (index (url-unhex-string (match-string 2 substring)))) + (notifications-notify :title "Now playing" :body (encode-coding-string (format "%s: %s" index value) 'utf-8))) + t) ((string-match "^power\\(?: \\([01]\\)\\)?" substring) (let ((state (match-string 1 substring)) (player (squeeze-find-player id))) -- 2.39.5