M simple-mpc-query.el => simple-mpc-query.el +4 -2
@@ 114,7 114,9 @@ SEARCH-TYPE is a tag type, SEARCH-QUERY is the actual query."
When a region is active, add all the songs in the region to the
current playlist. When PLAY is non-nil, immediately play them."
(interactive)
- (let ((current-amount-in-playlist (simple-mpc-get-amount-of-songs-in-playlist)))
+ (let ((playlist-length 0))
+ (when (simple-mpc-extract-status 'playlist-length)
+ (setq playlist-length (string-to-number (simple-mpc-extract-status 'playlist-length))))
(if (use-region-p)
(let ((first-line-region (line-number-at-pos (region-beginning)))
(last-line-region (if (eq (region-end) (point-max))
@@ 137,7 139,7 @@ current playlist. When PLAY is non-nil, immediately play them."
(buffer-substring-no-properties (line-beginning-position) (line-end-position)))))
(forward-line))
(if play
- (simple-mpc-call-mpc nil (list "play" (number-to-string (1+ current-amount-in-playlist)))))))
+ (simple-mpc-call-mpc nil (list "play" (number-to-string (1+ playlist-length)))))))
(defun simple-mpc-query-sort (&optional reverse)
"Sort all query results alphabetically.
M simple-mpc-utils.el => simple-mpc-utils.el +0 -6
@@ 100,12 100,6 @@ output as a string."
(simple-mpc-call-mpc t mpc-args)
(buffer-string)))
-(defun simple-mpc-get-amount-of-songs-in-playlist ()
- "Return the number of songs in the current playlist."
- (with-temp-buffer
- (simple-mpc-call-mpc t "playlist")
- (count-lines (point-min) (point-max))))
-
(defun simple-mpc-extract-status (type)
"Return the mpc data corresponding to TYPE of current song. TYPE may be one of the keys of `simple-mpc-status-re-groups'."
(with-temp-buffer