aboutsummaryrefslogtreecommitdiff
path: root/emms-lyrics.el
diff options
context:
space:
mode:
authorWilliam Xu <william.xwl@gmail.com>2008-02-12 06:48:00 +0000
committerWilliam Xu <william.xwl@gmail.com>2008-02-12 06:48:00 +0000
commiteb4229b372252d0e709760edcfc1ffe759367b70 (patch)
treeab1bedbc85a2e305b7f66f6b1a8f03af0c6fd75e /emms-lyrics.el
parent5f0591f7fe91bda35c44faa4134870a2296a9d5e (diff)
- emms-url.el: (emms-url-quote, emms-url-quote-plus), New functions
renamed from emms-lyrics-url-quote, emms-lyrics-url-quote-plus defined in emms-lyrics.el. - emms-url.el: (emms-escape-url, emms-url-specials), deleted, since they can only escape ASCII characters, emms-url-quote can handle all characters. - Update affected files accordingly. darcs-hash:20080212064822-cfa61-759d28b271024ab1a17bd23a2444c076d04e55e7.gz
Diffstat (limited to 'emms-lyrics.el')
-rw-r--r--emms-lyrics.el34
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