[Music] Simplify call to git-annex-find
And also make it more secure, because no shell is involved anymore.
This commit is contained in:
parent
f8c71d96e9
commit
29d138f968
@ -46,19 +46,23 @@ are match it. Assumes `emms-source-file-default-directory’ to be
|
|||||||
part of a git-annex repository, and will complain otherwise."
|
part of a git-annex repository, and will complain otherwise."
|
||||||
(interactive "smatch expression: ")
|
(interactive "smatch expression: ")
|
||||||
;; XXX check for git-annex
|
;; XXX check for git-annex
|
||||||
(let* ((default-directory emms-source-file-default-directory)
|
(let* ((default-directory emms-source-file-default-directory))
|
||||||
;; XXX sanitize MATCH-EXPRESSION
|
(db/-emms-playlist-from-files
|
||||||
(list-of-files (->> (split-string (shell-command-to-string
|
(->> (split-string (with-output-to-string
|
||||||
(concat "git annex find " match-expression))
|
(with-current-buffer standard-output
|
||||||
"\n")
|
(apply #'call-process
|
||||||
(cl-remove-if-not #'(lambda (path)
|
"git" nil t nil
|
||||||
(and (not (string-empty-p path))
|
"annex" "find"
|
||||||
(file-exists-p path)
|
(split-string match-expression))))
|
||||||
(file-readable-p path))))
|
"\n")
|
||||||
(mapcar #'(lambda (path)
|
(cl-remove-if-not #'(lambda (path)
|
||||||
(expand-file-name path
|
(and (not (string-empty-p path))
|
||||||
emms-source-file-default-directory))))))
|
(file-exists-p path)
|
||||||
(db/-emms-playlist-from-files list-of-files)))
|
(file-readable-p path))))
|
||||||
|
(mapcar #'(lambda (path)
|
||||||
|
(expand-file-name
|
||||||
|
path
|
||||||
|
emms-source-file-default-directory)))))))
|
||||||
|
|
||||||
(defun db/update-playlist-from-directory (directory)
|
(defun db/update-playlist-from-directory (directory)
|
||||||
"Recursively traverse DIRECTORY and update `db/playlist’.
|
"Recursively traverse DIRECTORY and update `db/playlist’.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user