A couple of patches
Erica Qi via <[email protected]> Wed, 27 Nov 2024 18:24:59 +0000
| Newsgroups | gmane.emacs.emms.user |
|---|---|
| Message-ID | <riZCWLz74Ffj2x8np1mbFoKXgWv79fM4CbDao87xq7DpGtffPUM6Wd4PAqEXfxnwd9RgqwlUG21nA9SL3c-eHcTSD49zYTA36mUp-vIakNY=@proton.me> |
Hello, Thank you for Emms. Here are a couple of patches. The first two are the code and doc to add the ability to lock the active playlist and then allow browsing of other playlists and sending songs to the current active playlist from them. Basically so you can have an active playlist that doesn't follow you around, but stays put and plays what you send it. You can also now send it songs from other playlists instead of just the cache. The third patch adds Album Artist to meta flac, the tag editor, and the playlist sort and limit functionalities. The doc is updated as well. Thank you, have a nice day. Erica Envoyé avec la messagerie sécurisée [Proton Mail.](https://proton.me/mail/home)
0001-Add-active-playlist-lock-browse-and-send-songs-from-.patch
(text/x-patch, 6.5 KB)
From 85412d93c99357425f27df4e921ba29e8932f5c2 Mon Sep 17 00:00:00 2001 From: ericalinag <[email protected]> Date: Wed, 27 Nov 2024 16:57:20 +0000 Subject: [PATCH 1/3] Add active playlist lock, browse and send songs from other playlists. --- emms-metaplaylist-mode.el | 17 +++++++--- emms-playlist-mode.el | 9 ++++++ emms.el | 68 +++++++++++++++++++++++++-------------- 3 files changed, 65 insertions(+), 29 deletions(-) diff --git a/emms-metaplaylist-mode.el b/emms-metaplaylist-mode.el index c221b7d..802a846 100644 --- a/emms-metaplaylist-mode.el +++ b/emms-metaplaylist-mode.el @@ -85,6 +85,7 @@ (define-key map (kbd "C-k") #'emms-metaplaylist-mode-kill-buffer) (define-key map (kbd "c") #'emms-metaplaylist-mode-center-current) (define-key map (kbd "q") #'kill-this-buffer) + (define-key map (kbd "v") #'emms-metaplaylist-mode-goto) (define-key map (kbd "?") #'describe-mode) map) "Keymap for `emms-metaplaylist-mode'.") @@ -99,8 +100,16 @@ (let ((buffer (get-buffer (buffer-substring (line-beginning-position) (line-end-position))))) - (emms-playlist-set-playlist-buffer buffer) - (switch-to-buffer buffer))) + (emms-playlist-set-playlist-buffer buffer) + (switch-to-buffer buffer))) + +(defun emms-metaplaylist-mode-goto () + "Visit the playlist without making it current." + (interactive) + (let ((buffer (get-buffer + (buffer-substring (line-beginning-position) + (line-end-position))))) + (switch-to-buffer buffer))) (defun emms-metaplaylist-mode-write (playlists) "Print the sorted list of PLAYLISTS." @@ -122,7 +131,7 @@ (defun emms-metaplaylist-mode-sorted-buffer-list () "Return a sorted list of playlist buffers." (sort - (copy-tree + (copy-tree (emms-playlist-buffer-list)) #'(lambda (a b) (string< (buffer-name a) @@ -202,7 +211,7 @@ (defun emms-metaplaylist-mode-set-active () "Set the buffer at point to be the active playlist." (interactive) - (emms-playlist-set-playlist-buffer + (emms-playlist-set-playlist-buffer (get-buffer (buffer-substring (line-beginning-position) (line-end-position)))) (emms-metaplaylist-mode-update)) diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el index ff57030..cef9fd1 100644 --- a/emms-playlist-mode.el +++ b/emms-playlist-mode.el @@ -147,6 +147,7 @@ This is true for every invocation of `emms-playlist-mode-go'." (define-key map (kbd "d") #'emms-playlist-mode-goto-dired-at-point) (define-key map (kbd "<mouse-2>") #'emms-playlist-mode-play-current-track) (define-key map (kbd "RET") #'emms-playlist-mode-play-smart) + (define-key map (kbd "i") #'emms-playlist-playlist-insert-track) map) "Keymap for `emms-playlist-mode'.") @@ -543,6 +544,14 @@ When NO-NEWLINE is non-nil, do not insert a newline after the track." (unless no-newline (insert "\n")))) +(defun emms-playlist-playlist-insert-track () + "Insert the track in playlist at point into the active playlist buffer." + (interactive) + (let ((track (emms-playlist-track-at))) + (with-current-emms-playlist + (goto-char (point-max)) + (emms-playlist-insert-track track)))) + (defun emms-playlist-mode-update-track-function () "Update the track display at point." (emms-playlist-ensure-playlist-buffer) diff --git a/emms.el b/emms.el index e8781c3..ad6e985 100644 --- a/emms.el +++ b/emms.el @@ -831,38 +831,56 @@ for that purpose.") "Non-nil if the current buffer is an EMMS playlist.") (make-variable-buffer-local 'emms-playlist-buffer-p) +(defvar emms-queue-lock nil + "The playlist name the active playlist queue is locked to, if any.") + (defun emms-playlist-ensure-playlist-buffer () "Throw an error if we're not in a playlist-buffer." (when (not emms-playlist-buffer-p) (error "Not an EMMS playlist buffer"))) +(defun emms-lock-queue () + "Lock the current active playlist." + (interactive) + (setq emms-queue-lock (buffer-name emms-playlist-buffer)) + (message (concat "Active queue playlist is locked to " emms-queue-lock))) + +(defun emms-unlock-queue () + "Unlock the current active playlist." + (interactive) + (setq emms-queue-lock nil) + (message "Active queue playlist is unlocked.")) + (defun emms-playlist-set-playlist-buffer (&optional buffer) - "Set the current playlist buffer." + "Set the current playlist buffer if the queue is not locked to it's playlist." (interactive - (list (let* ((buf-list (mapcar #'(lambda (buf) - (list (buffer-name buf))) - (emms-playlist-buffer-list))) - (sorted-buf-list (sort buf-list - #'(lambda (lbuf rbuf) - (< (length (car lbuf)) - (length (car rbuf)))))) - (default (or (and emms-playlist-buffer-p - ;; default to current buffer - (buffer-name)) - ;; pick shortest buffer name, since it is - ;; likely to be a shared prefix - (car sorted-buf-list)))) - (emms-completing-read "Playlist buffer to make current: " - sorted-buf-list nil t default)))) - (let ((buf (if buffer - (get-buffer buffer) - (current-buffer)))) - (with-current-buffer buf - (emms-playlist-ensure-playlist-buffer)) - (setq emms-playlist-buffer buf) - (when (called-interactively-p 'interactive) - (message "Set current EMMS playlist buffer")) - buf)) + (if (not emms-queue-lock) + (list (let* ((buf-list (mapcar #'(lambda (buf) + (list (buffer-name buf))) + (emms-playlist-buffer-list))) + (sorted-buf-list (sort buf-list + #'(lambda (lbuf rbuf) + (< (length (car lbuf)) + (length (car rbuf)))))) + (default (or (and emms-playlist-buffer-p + ;; default to current buffer + (buffer-name)) + ;; pick shortest buffer name, since it is + ;; likely to be a shared prefix + (car sorted-buf-list)))) + (emms-completing-read "Playlist buffer to make current: " + sorted-buf-list nil t default))))) + (if (not emms-queue-lock) + (let ((buf (if buffer + (get-buffer buffer) + (current-buffer)))) + (with-current-buffer buf + (emms-playlist-ensure-playlist-buffer)) + (setq emms-playlist-buffer buf) + (when (called-interactively-p 'interactive) + (message "Set current EMMS playlist buffer")) + buf) + (message (concat "The active playlist queue is locked to " emms-queue-lock)))) (defun emms-playlist-new (&optional name) "Create a new playlist buffer. -- 2.47.0
0002-Doc-for-active-playlist-lock-goto-and-send-songs.patch
(text/x-patch, 1.9 KB)
From ca37d44d04c2ee132ddfd651d661bbcd38eff4c3 Mon Sep 17 00:00:00 2001 From: ericalinag <[email protected]> Date: Wed, 27 Nov 2024 17:45:33 +0000 Subject: [PATCH 2/3] Doc for active playlist lock, goto and send songs. --- doc/emms.texinfo | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/emms.texinfo b/doc/emms.texinfo index 43d474d..7acf576 100644 --- a/doc/emms.texinfo +++ b/doc/emms.texinfo @@ -599,12 +599,19 @@ Shuffle the current playlist. This uses Sort the current playlist. This uses @var{emms-playlist-sort-function}. @end defun +@defun emms-lock-queue +Lock the current active playlist to its playlist. +@var{emms-playlist-sort-function}. +@end defun +@defun emms-unlock-queue +Unlock the current active playlist from its playlist. +@var{emms-playlist-sort-function}. +@end defun @defun emms-show &optional insertp Describe the current Emms track in the minibuffer. If @var{insertp} is non-nil, insert the description into the current buffer instead. This function uses @var{emms-show-format} to format the current track. @end defun - The command @command{emms-show-all} will pop up a window with the complete information about the track being played. @command{emms-show-all} is provided by @@ -1375,6 +1382,10 @@ Add files in the playlist at point to the current playlist buffer. If we are in the current playlist, make a new playlist buffer and set it as current. ++@item i ++@findex emms-playlist-playlist-insert-track ++Insert track at point into active playlist. + @item b @findex emms-playlist-set-playlist-buffer Set the current playlist buffer. @@ -2961,6 +2972,11 @@ available: @findex emms-metaplaylist-mode-goto-current Make the buffer at point the Emms playlist buffer and switch to it. ++@item V +@kindex v +@findex emms-metaplaylist-mode-goto +Visit the playlist at point. + @item SPC @kindex SPC @findex emms-metaplaylist-mode-set-active -- 2.47.0
0003-Add-album-artist-to-metaflac-tag-editor-playlist-sor.patch
(text/x-patch, 6.1 KB)
From e16200b4a18299204c9d8b54767135ce14ccddff Mon Sep 17 00:00:00 2001 From: ericalinag <[email protected]> Date: Wed, 27 Nov 2024 18:02:09 +0000 Subject: [PATCH 3/3] Add album artist to metaflac, tag editor, playlist sort and limit. --- doc/emms.texinfo | 12 ++++++++++++ emms-info-metaflac.el | 1 + emms-playlist-limit.el | 3 +++ emms-playlist-sort.el | 12 +++++++----- emms-tag-editor.el | 2 +- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/doc/emms.texinfo b/doc/emms.texinfo index 7acf576..d650338 100644 --- a/doc/emms.texinfo +++ b/doc/emms.texinfo @@ -2244,6 +2244,10 @@ prefix. `emms-playlist-sort' can be loaded by invoking: Sort by artist name. @end defun +@defun emms-playlist-sort-by-info-albumartist +Sort by albumartist name. +@end defun + @defun emms-playlist-sort-by-play-count Sort by number of times the track has been played. @end defun @@ -2523,6 +2527,14 @@ whose artist info field matches the given regular expression (default: the artist info field of the track at point). +@item / A +@kindex / A +@findex emms-playlist-limit-to-info-albumartist +Create a new playlist buffer and populate it with tracks +whose album artist info field matches the given regular +expression (default: the album artist info field of the +track at point). + @item / b @kindex / b @findex emms-playlist-limit-to-info-album diff --git a/emms-info-metaflac.el b/emms-info-metaflac.el index f03925f..e22d5e6 100644 --- a/emms-info-metaflac.el +++ b/emms-info-metaflac.el @@ -58,6 +58,7 @@ external metaflac program" '("--no-utf8-convert" "--show-tag=TITLE" "--show-tag=ARTIST" + "--show-tag=ALBUMARTIST" "--show-tag=ALBUM" "--show-tag=NOTE" "--show-tag=YEAR" diff --git a/emms-playlist-limit.el b/emms-playlist-limit.el index e635f9b..6839bc1 100644 --- a/emms-playlist-limit.el +++ b/emms-playlist-limit.el @@ -42,6 +42,7 @@ ;; ------------------------------------------------------------------ ;; / / emms-playlist-limit-to-all +;; / A emms-playlist-limit-to-info-albumartist ;; / a emms-playlist-limit-to-info-artist ;; / b emms-playlist-limit-to-info-album ;; / c emms-playlist-limit-to-info-composer @@ -102,6 +103,7 @@ the current playlist." attribute attribute) (emms-playlist-limit-do (quote ,attribute) regexp) (message "Limit cancelled: no regexp.")))) +(define-emms-playlist-limit info-albumartist) (define-emms-playlist-limit info-artist) (define-emms-playlist-limit info-composer) (define-emms-playlist-limit info-performer) @@ -132,6 +134,7 @@ If this playlist is current, make the playlist we switch to current." (bury-buffer old-buf)))) (define-key emms-playlist-mode-map (kbd "/ n") #'emms-playlist-limit-to-name) +(define-key emms-playlist-mode-map (kbd "/ A") #'emms-playlist-limit-to-info-albumartist) (define-key emms-playlist-mode-map (kbd "/ a") #'emms-playlist-limit-to-info-artist) (define-key emms-playlist-mode-map (kbd "/ c") #'emms-playlist-limit-to-info-composer) (define-key emms-playlist-mode-map (kbd "/ p") #'emms-playlist-limit-to-info-performer) diff --git a/emms-playlist-sort.el b/emms-playlist-sort.el index 7b69f1a..3d55a41 100644 --- a/emms-playlist-sort.el +++ b/emms-playlist-sort.el @@ -56,12 +56,13 @@ With a prefix argument, decreasingly." attribute) (interactive) (emms-playlist-sort '(lambda (a b) - (funcall + (funcall (if current-prefix-arg 'emms-string> 'emms-string<) (emms-track-get a (quote ,attribute)) (emms-track-get b (quote ,attribute))))))) (define-emms-playlist-sort name) +(define-emms-playlist-sort info-albumartist) (define-emms-playlist-sort info-artist) (define-emms-playlist-sort info-composer) (define-emms-playlist-sort info-performer) @@ -98,7 +99,7 @@ With a prefix argument, decreasingly." (interactive) (emms-playlist-sort '(lambda (a b) - (funcall + (funcall (if current-prefix-arg 'not 'identity) (time-less-p (or (emms-track-get a 'last-played) '(0 0 0)) @@ -110,7 +111,7 @@ With a prefix argument, decreasingly." (interactive) (emms-playlist-sort '(lambda (a b) - (funcall + (funcall (if current-prefix-arg 'not 'identity) (< (or (emms-track-get a 'play-count) 0) (or (emms-track-get b 'play-count) 0)))))) @@ -121,7 +122,7 @@ With a prefix argument, decreasingly." (interactive) (emms-playlist-sort '(lambda (a b) - (funcall + (funcall (if current-prefix-arg 'emms-string> 'emms-string<) (file-name-extension (emms-track-get a 'name)) (file-name-extension (emms-track-get b 'name)))))) @@ -148,6 +149,7 @@ With a prefix argument, oldest first." (let ((map (make-sparse-keymap))) (define-key map (kbd "n") #'emms-playlist-sort-by-natural-order) (define-key map (kbd "a") #'emms-playlist-sort-by-info-artist) + (define-key map (kbd "A") #'emms-playlist-sort-by-info-albumartist) (define-key map (kbd "c") #'emms-playlist-sort-by-play-count) (define-key map (kbd "b") #'emms-playlist-sort-by-info-album) (define-key map (kbd "l") #'emms-playlist-sort-by-last-played) @@ -165,7 +167,7 @@ With a prefix argument, oldest first." map)) (define-key emms-playlist-mode-map - emms-playlist-sort-prefix emms-playlist-sort-map)) + emms-playlist-sort-prefix emms-playlist-sort-map)) (setq emms-playlist-sort-map (emms-playlist-sort-map-setup)) diff --git a/emms-tag-editor.el b/emms-tag-editor.el index 8c50df5..401bca7 100644 --- a/emms-tag-editor.el +++ b/emms-tag-editor.el @@ -157,7 +157,7 @@ See also `emms-tag-editor-tag-file' and `emms-tag-editor-tag-ogg'.") "Commit changes to an FLAC file according to TRACK." (require 'emms-info-metaflac) (with-temp-buffer - (let ((tags '("artist" "composer" "performer" "title" "album" "tracknumber" "discnumber" "date" "genre" "note")) + (let ((tags '("albumartist" "artist" "composer" "performer" "title" "album" "tracknumber" "discnumber" "date" "genre" "note")) val) (mapc (lambda (tag) (let ((info-tag (intern (concat "info-" tag)))) -- 2.47.0