Permalink
Browse files

Clean up the code.

  • Loading branch information...
1 parent 73a1052 commit 79fe916af9406c701645ef0ee2b503ea7bd5b9b1 Lars Magne Ingebrigtsen committed Apr 16, 2011
Showing with 12 additions and 16 deletions.
  1. +12 −16 musicbrainz.el
View
@@ -114,25 +114,21 @@
(mapconcat #'number-to-string (cdr (assq 'toc toc)) " "))
(cdr (assq 'id toc))))
(artist (cdr (assq 'artist cddb-entry)))
- (i 0))
+ (i 0)
+ elem)
(unless (equal artist "Various")
(setq url (concat url "&artist=" (musicbrainz-encode artist))))
(dolist (track (cdr (assq 'tracks cddb-entry)))
- (if (equal artist "Various")
- (let ((elem (split-string track " - ")))
- (if (> (length elem) 1)
- (setq url
- (concat
- url (format "&track%d=%s&artist%d=%s"
- i
- (musicbrainz-encode (cadr elem))
- i
- (musicbrainz-encode (car elem)))))
- (setq url (concat url (format "&track%d=%s"
- i
- (musicbrainz-encode track))))))
- (setq url (concat url (format "&track%d=%s"
- i (musicbrainz-encode track)))))
+ (setq url
+ (concat
+ url
+ (if (and (equal artist "Various")
+ (> (length (setq elem (split-string track " - "))) 1))
+ (format "&track%d=%s&artist%d=%s"
+ i (musicbrainz-encode (cadr elem))
+ i (musicbrainz-encode (car elem)))
+ (format "&track%d=%s"
+ i (musicbrainz-encode track)))))
(incf i))
(let* ((url-request-method "POST")
(url-request-extra-headers '(("Content-length" . "0")))

0 comments on commit 79fe916

Please sign in to comment.