What can I do with 300 lines of Ruby?
Get the latest version!
This page is about an older version of Kesiev Chiefs
. Get the latest version here
is a small media player based on GTK2 and the famous Mplayer
It features a lot of things that you can find in a lot of other full-featured music players
that populate the internet. The only difference is that is brewed with only 300 lines of Ruby
code, using just the standard libs, except for the GUI. KesieV Chiefs
is just a proof-of-concept and is not
meant to be your default desktop player but, if you find it usable enough, can be your new best companion.
is less than 30k big, but has a lot of things inside.
Audio/Video playback, using Mplayer as backend
Simple music database, with Artist/Album/Song panels
User created playlists
LastFM stations and scrobbling
Shoutcast and TV streams
Basic music sharing, using HTTP
Basic podcast client features
Searches on Wikipedia, Google, Youtube...
Playlist shuffling and sorting
Cover art parsing from Amazon or LastFM
Tray icon and window hiding
libpurple compatible messenger status (i.e. Pidgin)
Optional cover browser
Easy plugin system
Some of these features needs some kind of configfile handling... No worry :)
Everybody loves screenshots. Mee too.
Install & Configuration
Since it is just an all-in-one Ruby script, you probably need just your installation of Ruby and the the
package (GTK2 only - the full GNOME packages aren't required). Desktop notifies requires the
package - but, if you can't find it
anywhere, you can use a plugin for calling the notify-send
command line tool for having your
You can configure a lot of things writing stuff in your ~/.kesievchiefs/settings
file, adding one or more of these lines.
If a key is not specified into your config file, the default value is used (described for each key).
Remember to make KesieV Chiefs
executable with the classic chmod +x kesievchiefs-0.1.rb
Your music library root: MP3s are indexed starting from this directory.
Default folders for covers and plugins. Installing a plugin is quite easy: copy the
plugin files into the plugin folder and restart KesieV Chiefs
Adds three example custom playlists: a sample podcast, a Favourites playlist and a localhost shared music
The default player's window size.
The size of the icons beside each item into the playlist box.
The default height of the Artist/Album filter box. You can hide the box, putting
a 0 into this configuration key and use the cover box as filter.
Enable or disable the automatic cover downloader.
The size of the cover shown into the playlist box into the
Enable and disable the big cover box under the toolbar and change
the default height of the box. It is possible to set the size of each
item into the cover box.
Enable and disable your Pidgin's status message while listening to the music.
Your LastFM account details, for scrobbling your music. Sorry, your PW is in clear.
These are the strings used for unknown
values of tags (unknown artist or unknown album) while
indexing and for searching all
artists or albums while filtering your library.
You can leave these to their default value.
The sequence of chars that is used as field separator. Leave it to his default value and change it
only if your music library contains the "#!#" somewhere.
The default port used for music sharing.
supports a number of different kinds of custom playlists: podcasts, shared folders,
editable playlists etc.
We will explain how to create some common items but keep in mind that different combination of attributes
creates more kinds of playlists (and adding plugins you can create even more playlists).
These lines are added into your config file too.
You can make a selection of your music, streaming stations and more creating a custom editable playlist.
Add this block to your configuration file for a sample user playlist.
# A sample user playlist
lists.file=<your kesievchiefs root>/rockmusic
A Rock Music playlist with a green apple as icon. Add as many of these you like!
Hitting the File
menu and then the Share/Unshare my music
you can share your music database to
other KesieV Cheif
users... and to anyone, since is shared turning on a simple webserver :).
Add these lines to the client's config file to see the server's shared music:
# A sample shared source
lists.root=http://<ip of remote server>:12345/
lists.file=http://<ip of remote server>:12345/songs
Quite simple, isn't it?
We can manage podcasts too, in a quick and dirty way ;)
Let's add a custom playlist like this:
# A sample podcast
Not every podcast item has an enclosure, so, if only an URL is available, it
is opened into your Firefox browser. And, for it, you can obviously put any RSS source ;)
If you don't find KesieV Chiefs
complete as you like, you can write your own
plugin, implementing your favourite feature.
You can have a look (and install) the funny Foobar plugin
explains some of the capabilities of the plugin system. Since are written in Ruby too and are based on
substituting some subs, you can virtually do anything you want. On the right side of this site there
is a number of different plugins (one of these - the only really useful since now - adds Audio CD support
to KesieV Chiefs
). Download these into your ~/.kesievchiefs/plugins folder and restart your
player. Some of these adds more kinds of user playlists: usually the instructions are into the comments on the
top of the plugin sources.
Did you wrote a funky plugin? Submit it here
! (obviously de-garbage the mail address ;) )
The 300 lines
Clicking the About
option into the Help
menu, this box appears
Since the scripts counts his lines by himself, you can say Yes, there are 300 lines of real code into KesieV Chiefs
This player was born just for learning the Ruby programming language
, which is a really
powerful language born and built using the objects paradigm.
I've started KesieV Chiefs
as a game: let's take some kind of software that can virtually grow forever and let's see how many
features I can fit into keeping the sources 300 lines long.
Playing this game (which I've already played with PHP - that time was a messenger) I think that you must
learn something on
the language you're studying, since, for example, learning that you can assign multiple variables in one line instead using multiple lines,
you can reduce the code for many lines that can be used for implementing more features. And this "wave" effect continue until the
remaining lines don't allow you to add features.
Probably the resulting code will be a bunch of unreadable oneliners (that is terribly wrong
in the Ruby philosophy) but since now,
you know more about what you can do with Ruby
. And this make you a better programmer.
So, I've chosen to make a media player based on the really powerful Mplayer: nowdays a player can be a box with play/pause or a
shopping cart with filters and tons of buttons.
You can understand that this will not be probably the ultimate media player
for Linux but... who knows? It does what is
written on the label and does this enough good for the small database into my EEEPc... Let's the plugin dance begin :)
You're probably trying to guess how this piece of software has such a weird name. That's because you don't know the Kaiser Chiefs
group and their Ruby
song, which is really nice and is featured in a lot of videogames (and I'm a f*cked gamer!).
The last lines of this page are for Bianca (my GF) and Ulrick (a gr8 friend) which listened me evangelizing 24/7 Ruby and listened to my "feature of the day" gibberish.