Skip to content

Instantly share code, notes, and snippets.

@billyct
Forked from littlehaker/my-emacs-douban.el
Created August 28, 2016 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billyct/58eb54fe887a5d7a7abbfab9ea9b6d4a to your computer and use it in GitHub Desktop.
Save billyct/58eb54fe887a5d7a7abbfab9ea9b6d4a to your computer and use it in GitHub Desktop.
Emacs 豆瓣电台
(require 'ht)
(require 'web)
(require 'dash)
(defun my-emacs-douban-play ()
(interactive)
(web-http-get
(lambda (con header data)
;; local variables
(let* ((json (ht<-alist (json-read-from-string data)))
(songs (ht-get json 'song)))
(progn
(-map (lambda (song)
;; add url to emms
(emms-add-url (ht-get (ht<-alist song) 'url)))
songs)
;; start emms
(emms-start))))
:url "http://douban.fm/j/mine/playlist?type=n&channel=0"))
(provide 'my-emacs-douban)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment