This post originated from an RSS feed registered with Ruby Buzz
by Christian Neukirchen.
Original Post: The Samsung YP-U1X
Feed Title: chris blogs: Ruby stuff
Feed URL: http://chneukirchen.org/blog/category/ruby.atom
Feed Description: a weblog by christian neukirchen - Ruby stuff
Today I bought an MP3 player by Samsung, the
YP-U1X,
primarily because it not only plays MP3, but also Ogg
Vorbis (They are so humble, they don’t even
mention that outside the technical specification; it’s the killer
argument!). Since a significant part of my music collection is in
Ogg, this was an essential requirement to me. Also, it was pretty
cheap—77⬠for 512MB flash.
Overall, I’m very pleased with it. The display is sharp and has a
good backlight, the design is pleasing (okay, it’s not as nice as a
Nano, but not as butt-ugly as some random no-name player). Last but
not the least, the usability is fairly good, although this is no
reason not to ship with a printed version of the manual, Samsung!
Unfortunately, it has no direct encoding to MP3 while recording, but I
can live with that.
There is only one thing that bugs me, and it’s a rub a lot of MP3
players have. It’s about sorting the songs and the order they are
played in. My music is arranged like
~/Music/Artist/Album/Song. The
name doesn’t contain the track number, mostly because I use playlists
when I use XMMS and iTunes sorts the songs on its own anyway. I
really don’t understand why the players can’t do that too.
Anyway, Ruby to the rescue. The script
grok_order.rb takes directories as
parameters and makes a list of all music files contained in them.
Then, it orders them by their album and track and finally prefixes the
files with nnnn- to enforce the order for alphabetically-sorted
players.
Therefore, I just need to run
ruby grok_order.rb /Volumes/YP-U1X
and the tracks are in the order they appear on the albums. Enjoy.