[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mp3player-bugs] Bug in playlist
From: |
Ulrik Jensen |
Subject: |
Re: [Mp3player-bugs] Bug in playlist |
Date: |
17 Nov 2003 05:48:55 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Hey
Lucas <address@hidden> writes:
> >From a Mp3player search result, when hitting "+" to add a dir to
> playlist :
I'm not capable of recreating this exact error (I get another error,
earlier than yours, more about that later), but from the backtrace I
think I've figured the problem out. It seems to me that it happens
because emacs isn't capable of reading from the file (maybe because it
has accents). In this case, `file-attributes' will return nil, and so
will `nth'.
So, try this version instead, which shouldn't give an error, although it
will just return an empty id3-tag.
(defun mp3player-get-comments-from-file-internal-mp3 (file)
"Get id3 information from FILE. Return a id3 structure."
(let ((size (nth 7 (file-attributes file))))
(if size
(progn
(with-temp-buffer
(insert-file-contents-literally file nil (- size 128) size)
(goto-char (point-min))
(if (string-match "TAG" (buffer-substring (point) (+ (point) 3)))
(progn
(flet ((retrieve-info (start end)
(mp3player-trim-right
(car
(split-string
(buffer-substring
(+ (point) start)
(+ (point) end))
"\x0")))))
(make-id3
:song (retrieve-info 3 33)
:artist (retrieve-info 33 63)
:album (retrieve-info 63 93)
:note (retrieve-info 93 97)
:year (retrieve-info 97 127)
:genre (mp3player-get-genre-description
(string-to-char
(buffer-substring (+ (point) 127)
(+ (point) 128))))
:file file))))))
(make-id3 :song "" :artist "" :album "" :note "" :genre "" :file ""))))
Meanwhile, I'm getting a different error trying to recreate yours, which
I can't quite figure out, but I'll keep at it a bit yet :)
--
Ulrik Jensen -- address@hidden -- http://www.terryp.tk