[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/listen 2cf52c87fe 16/16: Add: (listen-queue-deduplicate
From: |
ELPA Syncer |
Subject: |
[elpa] externals/listen 2cf52c87fe 16/16: Add: (listen-queue-deduplicate) |
Date: |
Thu, 29 Feb 2024 06:58:31 -0500 (EST) |
branch: externals/listen
commit 2cf52c87fe5d1b68f987c8ad8af810b948f01a82
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Add: (listen-queue-deduplicate)
---
README.org | 3 ++-
listen-queue.el | 28 ++++++++++++++++++++++++++++
listen.el | 2 ++
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/README.org b/README.org
index 8a7de82136..2d408c52e5 100644
--- a/README.org
+++ b/README.org
@@ -67,7 +67,8 @@ Use the command ~listen~ to show the Transient menu. From
there, it is--hopeful
** v0.4-pre
-Nothing new yet.
+*Additions*
++ Command ~listen-queue-deduplicate~ removes duplicate tracks from a queue (by
comparing artist, album, and title metadata case-insensitively).
** v0.3
diff --git a/listen-queue.el b/listen-queue.el
index bfcf20fc53..6313ae94f0 100644
--- a/listen-queue.el
+++ b/listen-queue.el
@@ -390,6 +390,34 @@ buffer, if any)."
(setf (listen-queue-tracks queue) tracks))
(listen-queue--update-buffer queue))
+(cl-defun listen-queue-deduplicate (queue)
+ "Remove duplicate tracks from QUEUE.
+Tracks that appear to have the same metadata (artist, album, and
+title, compared case-insensitively) are deduplicated."
+ (interactive (list (listen-queue-complete)))
+ (setf (listen-queue-tracks queue)
+ (cl-remove-duplicates
+ (listen-queue-tracks queue)
+ :test (lambda (a b)
+ (pcase-let ((( cl-struct listen-track
+ (artist a-artist) (album a-album) (title
a-title)) a)
+ (( cl-struct listen-track
+ (artist b-artist) (album b-album) (title
b-title)) b))
+ (and (or (and a-artist b-artist)
+ (and a-album b-album)
+ (and a-title b-title))
+ ;; Tracks have at least one common metadata field:
compare them.
+ (if (and a-artist b-artist)
+ (string-equal-ignore-case a-artist b-artist)
+ t)
+ (if (and a-album b-album)
+ (string-equal-ignore-case a-album b-album)
+ t)
+ (if (and a-title b-title)
+ (string-equal-ignore-case a-title b-title)
+ t))))))
+ (listen-queue--update-buffer queue))
+
(defun listen-queue-next (queue)
"Play next track in QUEUE."
(interactive (list (listen-queue-complete)))
diff --git a/listen.el b/listen.el
index b563dd4d9a..0b67a85ef0 100755
--- a/listen.el
+++ b/listen.el
@@ -348,6 +348,8 @@ TIME is a string like \"SS\", \"MM:SS\", or \"HH:MM:SS\"."
(let ((current-prefix-arg '(4)))
(call-interactively #'listen-queue-play)))
:transient t)
+ ("qd" "Deduplicate" listen-queue-deduplicate
+ :transient t)
("qs" "Shuffle" (lambda ()
"Shuffle queue."
(interactive)
- [elpa] externals/listen updated (f9d4157605 -> 2cf52c87fe), ELPA Syncer, 2024/02/29
- [elpa] externals/listen 94e5f7c0a8 01/16: Tidy: Indentation, ELPA Syncer, 2024/02/29
- [elpa] externals/listen 6f068ae6dc 04/16: Fix: (listen-queue--update-buffer) Preserve point, ELPA Syncer, 2024/02/29
- [elpa] externals/listen 944f3f6560 12/16: Fix: (listen-library-play-or-add) Prompt, ELPA Syncer, 2024/02/29
- [elpa] externals/listen 7cec46f690 05/16: Change: (listen-queue-complete) Add :allow-new-p argument, ELPA Syncer, 2024/02/29
- [elpa] externals/listen 215f506c76 11/16: Add: (listen-library-from-playlist-file), ELPA Syncer, 2024/02/29
- [elpa] externals/listen 75641cad05 02/16: Change: (listen) Library bindings, ELPA Syncer, 2024/02/29
- [elpa] externals/listen 2cf52c87fe 16/16: Add: (listen-queue-deduplicate),
ELPA Syncer <=
- [elpa] externals/listen 9ccf1ff0d1 09/16: Change: (listen-library-from-queue) Rename command, ELPA Syncer, 2024/02/29
- [elpa] externals/listen e2f39d0578 10/16: Add: (listen-queue-add-from-playlist-file), ELPA Syncer, 2024/02/29
- [elpa] externals/listen db94a21bfc 08/16: Change: (listen-queue-add-from-mpd) Allow new queue, ELPA Syncer, 2024/02/29
- [elpa] externals/listen d8e14f4c68 15/16: Meta: v0.4-pre, ELPA Syncer, 2024/02/29
- [elpa] externals/listen 643fbeb135 14/16: Release: v0.3, ELPA Syncer, 2024/02/29
- [elpa] externals/listen e98996c32e 03/16: Fix: (listen) Make "qc" conditional, ELPA Syncer, 2024/02/29
- [elpa] externals/listen f3ad8f8dcc 06/16: Change: Use (listen-queue-complete :allow-new-p) in commands, ELPA Syncer, 2024/02/29
- [elpa] externals/listen 9c0e1d2413 07/16: Change: (listen-queue-as-library) Use region or selected queue, ELPA Syncer, 2024/02/29
- [elpa] externals/listen 7c1e2957de 13/16: Tidy: Compiler warning, ELPA Syncer, 2024/02/29