diff options
Diffstat (limited to 'emms-lyrics.el')
-rw-r--r-- | emms-lyrics.el | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/emms-lyrics.el b/emms-lyrics.el index a9ed2fd..f79a550 100644 --- a/emms-lyrics.el +++ b/emms-lyrics.el @@ -65,6 +65,7 @@ (require 'emms-player-simple) (require 'emms-source-file) (require 'time-date) +(require 'emms-url) ;;; User Customization @@ -218,12 +219,12 @@ If we can't find it from local disk, then search it from internet." ;; systems, we'd better fall back on filename. (setq url (format "http://mp3.baidu.com/m?f=ms&rn=10&tn=baidump3lyric&ct=150994944&word=%s&lm=-1" - (emms-lyrics-url-quote-plus + (emms-url-quote-plus (encode-coding-string filename 'gb2312))))) (t ; english lyrics (setq url (format "http://search.lyrics.astraweb.com/?word=%s" ;;"http://www.lyrics007.com/cgi-bin/s.cgi?q=" - (emms-lyrics-url-quote-plus title))))) + (emms-url-quote-plus title))))) (browse-url url) (message "lyric file does not exist, search it from internet...done"))))) @@ -477,35 +478,6 @@ NEXT-LYRIC." (setq pos (1+ pos)))))) -;;; Utilities - -(defun emms-lyrics-url-quote (s &optional safe) - "Replace special characters in S using the `%xx' escape. -Characters in [a-zA-Z_.-/] and SAFE(default is \"\")) will never be -quoted. -e.g., - (url-quote \"abc def\") => \"abc%20def\"." - (or safe (setq safe "")) - (mapconcat (lambda (c) - (if (if (string-match "]" safe) - ;; ] should be place at the beginning inside [] - (string-match - (format "[]a-zA-Z_.-/%s]" - (replace-regexp-in-string "]" "" safe)) - (char-to-string c)) - (string-match (format "[a-zA-Z_.-/%s]" safe) - (char-to-string c))) - (char-to-string c) - (format "%%%02x" c))) - (string-to-list (encode-coding-string s 'utf-8)) - "")) - -(defun emms-lyrics-url-quote-plus (s &optional safe) - "Run (emms-url-quote s \" \"), then replace ` ' with `+'." - (replace-regexp-in-string - " " "+" (emms-lyrics-url-quote s (concat safe " ")))) - - ;;; emms-lyrics-mode (defvar emms-lyrics-mode-map |