diff options
| author | Yuchen Pei <id@ypei.org> | 2025-12-06 11:44:55 +1100 |
|---|---|---|
| committer | Yuchen Pei <id@ypei.org> | 2025-12-06 11:44:55 +1100 |
| commit | 0782e0efec9e44b92f5b295fef1872f169e98702 (patch) | |
| tree | dd6c3940ae89e9293ae2f200a1f7206523c739af /emacs/.emacs.d/lisp/my/my-emms.el | |
| parent | d88a029955cb50eb6eb138542f47715c60b62584 (diff) | |
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-emms.el')
| -rw-r--r-- | emacs/.emacs.d/lisp/my/my-emms.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-emms.el b/emacs/.emacs.d/lisp/my/my-emms.el index 0a42efe..91065a2 100644 --- a/emacs/.emacs.d/lisp/my/my-emms.el +++ b/emacs/.emacs.d/lisp/my/my-emms.el @@ -157,7 +157,11 @@ either 'audio or 'video (let ((emms-track-initialize-functions nil)) (my-emms-add-url-lists from (alist-get type my-extension-types))) - (with-current-buffer to (emms-sort)))) + (with-current-buffer to + (goto-char (point-min)) + (let ((inhibit-read-only t)) + (flush-lines "/Music/Archived/")) + (emms-sort)))) (defun my-emms-players-preference (track players) "If audio, use first player, otherwise second." @@ -651,15 +655,15 @@ If the last command is `emms-playlist-mode-play-smart', then set (setq last-command nil)) ) -(defun my-emms-wrapped () +(defun my-emms-wrapped (&optional n) "Print top 10 scored tracks." - (interactive) + (interactive "p") (let (keys) (maphash (lambda (k _) (push k keys)) emms-score-hash) (sort keys (lambda (k1 k2) (> (cl-second (gethash k1 emms-score-hash)) (cl-second (gethash k2 emms-score-hash))))) - (message "Top 10: %s" (string-join (take 10 keys) "\n")))) + (message "Top %s: %s" (or n 10) (string-join (take (or n 10) keys) "\n")))) (defun my-emms-maybe-get-duration-for-current-track () "Get duration for the current track. |
