[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [emms-help] Sorting by natural order
From: |
William Xu |
Subject: |
Re: [emms-help] Sorting by natural order |
Date: |
Fri, 14 Apr 2006 19:55:59 +0800 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
Matthew Kennedy <address@hidden> writes:
> Natural track order is the order in which you were meant to hear the
> tracks on a CD. This means sort by album name *and then* by track
> number.
Nifty idea !
> Here's what I implemented to achieve a natural order sort. It might
> be nice to include something like it in Emms though...
Thanks. I've added this to `emms-playlist-sort.el' and sent the
patch. Next time you may send a patch directly to forcer or
address@hidden
> (defun emms-sort-natural-order-less-p (a b)
> "Sort two tracks by natural order.
> This is the order in which albums where intended to be played.
> ie. by album name and then by track number."
> (or (emms-string> (emms-track-get a 'info-album)
> (emms-track-get b 'info-album))
> (and (string= (emms-track-get a 'info-album)
> (emms-track-get b 'info-album))
> (< (string-to-number (emms-track-get a 'info-tracknumber))
> (string-to-number (emms-track-get b 'info-tracknumber))))))
Here, an error will occur in `string-to-number' when `emms-track-get'
returns nil. I've modified it to,
(< (string-to-number (or (emms-track-get a 'info-tracknumber)
"0"))
(string-to-number (or (emms-track-get b 'info-tracknumber)
"0"))))))
--
William