[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5f4bc14 058/272: counsel.el (counsel-rhythmbox-current-son
From: |
Oleh Krehel |
Subject: |
[elpa] master 5f4bc14 058/272: counsel.el (counsel-rhythmbox-current-song): Preselect the current song |
Date: |
Mon, 25 Apr 2016 10:13:16 +0000 |
branch: master
commit 5f4bc14db005ccf422fc64d8b0f9415b02f0f3d8
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-rhythmbox-current-song): Preselect the current song
* counsel.el (counsel-rhythmbox-current-song): New defun.
---
counsel.el | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/counsel.el b/counsel.el
index 9a3adcc..8ace5ba 100644
--- a/counsel.el
+++ b/counsel.el
@@ -973,6 +973,7 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
(defvar rhythmbox-library)
(declare-function rhythmbox-load-library "ext:helm-rhythmbox")
(declare-function dbus-call-method "dbus")
+(declare-function dbus-get-property "dbus")
(declare-function rhythmbox-song-uri "ext:helm-rhythmbox")
(declare-function helm-rhythmbox-candidates "ext:helm-rhythmbox")
@@ -987,6 +988,20 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
(defvar counsel-rhythmbox-history nil
"History for `counsel-rhythmbox'.")
+(defun counsel-rhythmbox-current-song ()
+ "Return the currently playing song title."
+ (ignore-errors
+ (let* ((entry (dbus-get-property
+ :session
+ "org.mpris.MediaPlayer2.rhythmbox"
+ "/org/mpris/MediaPlayer2"
+ "org.mpris.MediaPlayer2.Player"
+ "Metadata"))
+ (artist (caar (cadr (assoc "xesam:artist" entry))))
+ (album (cl-caadr (assoc "xesam:album" entry)))
+ (title (cl-caadr (assoc "xesam:title" entry))))
+ (format "%s - %s - %s" artist album title))))
+
;;;###autoload
(defun counsel-rhythmbox ()
"Choose a song from the Rhythmbox library to play or enqueue."
@@ -1000,6 +1015,7 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
(ivy-read "Rhythmbox: "
(helm-rhythmbox-candidates)
:history 'counsel-rhythmbox-history
+ :preselect (counsel-rhythmbox-current-song)
:action
'(1
("p" helm-rhythmbox-play-song "Play song")
- [elpa] master d996215 038/272: Add counsel-descbinds, (continued)
- [elpa] master d996215 038/272: Add counsel-descbinds, Oleh Krehel, 2016/04/25
- [elpa] master 9ef344d 062/272: use imenu API to jump to position. required by org-mode, Oleh Krehel, 2016/04/25
- [elpa] master 0a9780b 046/272: ivy.el (ivy--recompute-index): Update cl-position logic, Oleh Krehel, 2016/04/25
- [elpa] master 407ce2c 051/272: counsel.el (counsel-list-processes): New command, Oleh Krehel, 2016/04/25
- [elpa] master e3e1f51 052/272: ivy.el (ivy-ffap-url-functions): Customize "C-x C-f M-n", Oleh Krehel, 2016/04/25
- [elpa] master b39f409 056/272: counsel.el (counsel-unicode-char): Display hex codes in left column, Oleh Krehel, 2016/04/25
- [elpa] master eab714f 054/272: counsel.el (counsel-at-git-issue-p): New defun, Oleh Krehel, 2016/04/25
- [elpa] master 4696b89 057/272: ivy.el (ivy-switch-buffer-other-window): New command, Oleh Krehel, 2016/04/25
- [elpa] master 763d42b 048/272: Initialize `ivy-last` to empty state., Oleh Krehel, 2016/04/25
- [elpa] master c0c0f63 060/272: ivy.el (ivy-read): Fix extra actions for completing-read, Oleh Krehel, 2016/04/25
- [elpa] master 5f4bc14 058/272: counsel.el (counsel-rhythmbox-current-song): Preselect the current song,
Oleh Krehel <=
- [elpa] master 2877ae1 063/272: ivy.el (ivy-ignore-buffers): New defcustom, Oleh Krehel, 2016/04/25
- [elpa] master 480cc85 071/272: README.md: Update, Oleh Krehel, 2016/04/25
- [elpa] master 7b08db8 094/272: ivy.el (ivy-next-history-element): Use "\\_<" instead of "\\b", Oleh Krehel, 2016/04/25
- [elpa] master e94f13e 104/272: counsel.el (counsel-imenu): Add :preselect, Oleh Krehel, 2016/04/25
- [elpa] master 3799d3d 109/272: counsel.el: Shuffle functions and rename headings, Oleh Krehel, 2016/04/25
- [elpa] master 7dd85f5 122/272: counsel.el (counsel--async-sentinel): Recognize error codes other than 1, Oleh Krehel, 2016/04/25
- [elpa] master e85ad2c 116/272: counsel.el (counsel-find-file-ignore-regexp): Fixup :type, Oleh Krehel, 2016/04/25
- [elpa] master b8e373a 127/272: swiper.el (swiper-font-lock-ensure): Don't fail when font-lock is off, Oleh Krehel, 2016/04/25
- [elpa] master d8f04f0 061/272: Add melpa version badge, Oleh Krehel, 2016/04/25
- [elpa] master 00b009e 101/272: ivy.el (ivy-next-line-or-history): Update, Oleh Krehel, 2016/04/25