~amk/subsonic.el

a070cff3f802796dd0dbab4b2ebfbb9f05c36b0b — Alex McGrath a month ago f6af586 master
Add option for setting the size of art downloaded
1 files changed, 12 insertions(+), 3 deletions(-)

M subsonic.el
M subsonic.el => subsonic.el +12 -3
@@ 61,6 61,11 @@ Used to find the correct authinfo entry."
  :type 'boolean
  :group 'subsonic)

(defcustom subsonic-art-size 100
  "Set size for the subsonic album art download query."
  :type 'integer
  :group 'subsonic)

(defcustom subsonic-art-cache-path (expand-file-name "subsonic-cache" user-emacs-directory)
  "Path to store cached subsonic art."
  :type 'string


@@ 188,7 193,9 @@ reverted upon image load and N specifies the index"
  (if (file-exists-p (expand-file-name id subsonic-art-cache-path))
    (aset vec n (subsonic-image-propertize id))
    (url-retrieve
      (subsonic-build-url "/getCoverArt.view" `(("id" . ,id)))
      (subsonic-build-url
        "/getCoverArt.view"
        `(("id" . ,id) ("size" . ,(int-to-string subsonic-art-size))))
      (lambda (_status)
        (write-region
          (+ url-http-end-of-headers 1)


@@ 199,7 206,6 @@ reverted upon image load and N specifies the index"
        (when (derived-mode-p 'tabulated-list-mode)
          (tabulated-list-revert))))))


(defun subsonic-curl-images (entries n buff)
  "Use curl to download images for each of the ENTRIES.
N specifies the tablist index and BUFF is the buffer to be


@@ 220,7 226,10 @@ reverted."
              `
              ("-o"
                ,(expand-file-name id subsonic-art-cache-path)
                ,(subsonic-build-url "/getCoverArt.view" `(("id" . ,id)))))))))
                ,
                (subsonic-build-url
                  "/getCoverArt.view"
                  `(("id" . ,id) ("size" . ,(int-to-string subsonic-art-size))))))))))
    (let ((curl-process (apply #'start-process (append (list "subsonic-curl" nil) curl-args))))
      (set-process-sentinel
        curl-process