[Music] Cosmetics

That’s important!
This commit is contained in:
Daniel Borchmann 2019-03-02 15:33:55 +01:00
parent f671a44939
commit 90445b6c3d
Signed by: exot
GPG Key ID: 4F63DB96D45AA9C6

View File

@ -41,29 +41,26 @@ exist anymore are removed from it."
(puthash (car track) (cdr track) playlist-hash))) (puthash (car track) (cdr track) playlist-hash)))
(let (new-playlist) (let (new-playlist)
;; iterate over files in DIRECTORY and add them to the playlist, with the ;; Iterate over files in DIRECTORY and add them to the playlist, with the
;; already known state whenever possible ;; already known state whenever possible
(dolist (file (directory-files-recursively directory "")) (dolist (file (directory-files-recursively directory ""))
(message "Checking %s" file) (message "Checking %s" file)
(push (if-let ((state (gethash file playlist-hash nil))) (push (cons file (gethash file playlist-hash :undecided))
(cons file state)
(cons file :undecided))
new-playlist) new-playlist)
(remhash file playlist-hash)) (remhash file playlist-hash))
;; keep all other tracks that are not in DIRECTORY ;; Keep all other tracks that are not in DIRECTORY
(maphash #'(lambda (track state) (maphash #'(lambda (track state)
(push (cons track state) new-playlist)) (push (cons track state) new-playlist))
playlist-hash) playlist-hash)
;; sort to keep version control happy ;; Sort to keep version control happy
(setq new-playlist (setq new-playlist
(sort new-playlist (sort new-playlist
#'(lambda (track-1 track-2) #'(lambda (track-1 track-2)
(string< (car track-1) (string< (car track-1) (car track-2)))))
(car track-2)))))
;; save it ;; Save and exit
(customize-save-variable 'db/playlist new-playlist)))) (customize-save-variable 'db/playlist new-playlist))))
(provide 'db-music) (provide 'db-music)