CAJUN Usage

Using the CAJUN Core

The CAJUN core is normally started at bootup by launching the /usr/share/cajun/bin/cajun program. It consults the database, determines which devices should be present, and launches a separate driver program to handle them. All drivers contact the CAJUN core when they start. When all devices have connected, CAJUN is ready for use.

In the event that you need to run more than 1 copy of CAJUN on the same machine, you can pass the database name in as a paramater when starting CAJUN. CAJUN will only use the database named on the command line (default 'cajun').

Although all input and output devices are constantly running, only one audio device may be active at any one time. To choose a new audio device, hit the button that you've assigned to the 'audioMenu' function, and a list of audio devices will appear. Scroll up and down, and hit the 'audioMenu' function again. The old device will be silenced, and the new device will initialize. Note that once you activate the audioMenu, you must select a new device; there is currently no way to cancel the operation.

Using the FilePlayer audio device

The FilePlayer module is used for playing MP3 and Ogg Vorbis files. You'll need to load music before you can play it.

Step 1: load the music on the machine.

Get the MP3s/oggs on your machine any way you can. Copy them over the network using samba, ftp, scp. You can also rip them directly; go to http://www.freshmeat.net and download the 'cdparanoia' and 'bladeenc' or 'oggenc' programs (but check to make sure they're not already on your machine first).

Step 2: Import the music.

CAJUN stores information about each song in the MySQL database. To import the music, follow these steps:

  1. Organize your music

    Songs are stored in 'repositories', which are just directories, like '/mp3/'. Unless you have a reason, you'll probably store all of your music in a single repository.

    Once it's there, you need to organize your songs into a hierarchy that describes additional information (i.e., metadata). It's been a tradition, since the days of CAJUN version 3, to store the files on your disk in the 'CAJUN3' format:

    /mp3/{Artist_Name}/{Group_Name}/01_Songname.mp3
    /mp3/{Artist_Name}/{Group_Name}/02_Another_Songname.mp3
    /mp3/{Artist_Name}/{Group_Name}/03_Still_Another_Songname.mp3
    

    From CAJUN 4.1 and onwards, a fourth field is added - genre. So let's generically call this format 'CAJUN4':

    /mp3/{Genre}/{Artist_Name}/{Group_Name}/01_Songname.mp3
    /mp3/{Genre}/{Artist_Name}/{Group_Name}/02_Another_Songname.mp3
    /mp3/{Genre}/{Artist_Name}/{Group_Name}/03_Still_Another_Songname.mp3
    

    You certainly don't have to store your music in this format, but you'll find it will make life easier for you. Also, to make your life even easier, filenames should have no spaces (replace them with underscores), and start each track with a two-digit number that indicates which track number it is on the disc. Misc songs that are not part of an album don't apply, of course.

    You'll see a list of all of your repositories in the 'Repository' page. To add a repository, you'll need to type in a Repository Pattern. This is just the full pathname where the songs are stored, with the important bits labeled. For example, here's my main repository pattern:

    /music/tracks/{GENRE}/{ARTIST}/{DISC}/{SONG}

    You may use the constants GENRE, ARTIST, DISC, SONG, and YEAR in your patterns.

  2. Tag your music

    CAJUN will read the mp3/ogg tags from the songs during import. But how do the tags get in there? That's up to you. You can use a freeware or commercial tag editor, or use the CAJUN tagger utility. Our utility relies on the hierarchy to store information in tags. For example, when you declared your pattern, you described how the directories contain metadata. The tagger will copy the metadata into the song tags.

    Before running the tagger, make sure the apache process has write access to the repository. You'll probably have to type 'chown -R apache /mp3'.

    To tag the repository, just hit 'Tag' on your repository from the 'Tag/Import' menu. Note that tagging can take a very long time, since each of the files must have their tags rewritten.

    Any time you add files to the repository (or otherwise have songs with incorrect tag information), you'll want to re-tag the repository.

  3. Import your music

    Now you have a repository of music with correct tags. You may import them by hitting 'Import' on your repository from the 'Tag/Import' menu. Importing is quite a bit quicker than tagging. This process will update the MySQL database with song information stored in the song MP3/Ogg tags.

    Any time you add, remove, or change files in the repository, you'll want to re-import them. If you've removed songs, they'll also be removed from the SQL database.

But Wait, you say, I have hundreds of misc. MP3s that don't fit the CAJUN3 or CAJUN4 format!

Yes, we know about this one. It's been a major sticking point for a long time, as songs like this don't organize easily. One way to handle them that seems to work for a lot of people is to create a 'Misc' directory, and create sub-directories 'Rock', 'Comedy', 'Ambient', etc. such as:

/mp3/Alternative/Misc/Rock/Joe_Satriani_-_Ice_9.mp3

Yes, you can break the no-spaces rule if you want, and the no leading track number (since it doesn't apply here). For albums, though, you'll want to adhere to the format whenever possible.

Once you've imported your music, fire up CAJUN. To operate the Fileplayer,

  • Start from the "stopped" state.
  • Hit the 'selectin' button.
  • Using selectup/down, scroll the display. Make your search more specific by hitting 'selectin' on an item, or less specific (i.e., you'll back out of the hierarchy) by hitting 'selectout'. Open or close containers with the 'select' button. You can use the 'jump' buttons to scroll thru the display more quickly.
  • Once you've located a song, hit 'selectin'. The display switches to the 'playing' state. CAJUN will play from that song to the end of the list.
  • While the songs are playing, you can hit 'selectout' to bring up the selection screen, and choose a new song to play. You can hit 'stop' to return to the 'playing' screen.

    FilePlayer allows you to build On-The-Fly playlists. Simply cruise through the selections, and mark files and containers with the 'otfSelect' button. You'll see asterisks appear next to songs in the OTF playlist. When you're ready to play those songs, hit 'otfPlay'. You can hit 'otfClear' at any time to clear the asterisks.

    OTF has a special feature - if you hit 'otfPlay' on a container-type item (i.e., not a song) in the display when the OTF list is empty and no asterisks are visible, the entire contents of that container will be played. You don't need to mark them first.

    While in the 'playing' state, you can hit 'shuffle' to randomize the tracks.

    Using the Playlist links in the left-hand index, you can create playlists of your favorite songs. Simply hit 'Manage Playlist' on the left-hand index, assign a name to a new list, and go to "Add Songs". Find the containers or songs you want to add, and select the playlist you want to add them to. Each song or container of songs will be added to the playlist. You can then return to the playlist administration screen and review your entries.

    Once you've built your playlists, start CAJUN and activate the FilePlayer module. Hit the 'playlistselect' button or choose 'Playlists' from the top menu, and you'll see a list of the playlists defined. Choose the one you want and hit 'selectin'. All of the songs in that list will load. Don't forget that you can now hit 'shuffle' to randomize the list.

    Using the CDplayer audio device

    The CDplayer audio device functions just like a regular CD player would. The list of actions should be familliar to you, and include Stop, Play, NextTrack, PrevTrac, etc.

    Note that if you have more than one CDrom device in your computer, it may take some experimenting to find out which one is number '0', which one is number '1', etc.

    Using the FM Radio audio device

    The FM Radio audio device functions just like an FM radio. You can change the station or pick a preset. The program features a clock, since there's extra space on the display.

    Using the Icecast Client audio device

    The Icecast Client audio device allows you to tune into the hundreds of stations transmitting on the internet right now. Of course, this only works if you're building a HAJUN (Home Audio JukeBox for Unix), unless you've got satellite Internet service to your car.

    The program gets its station information from different sources, and we can add to them when they become available:

  • Shoutcast: The http://www.shoutcast.com website lists several stations that are broadcasting. The CAJUN software reads the website and determines who they are, and at what bitrate they are transmitting at. Because the data requires web site fetches, it can take up to 5 seconds after your keypress to display the data. Be patient - the data will appear on your screen shortly. We cache the pages so once you've visited an area, you won't have to wait for it to be displayed again. Note that since stations come online and go offline all the time, we expire the data after a certain time (configurable).

  • User Configuration: You can add your own stations to a file on disk, and it will be read and displayed when you use the client.

    The application features three states, or modes: stopped, selecting, or playing. When selecting a station, you need to choose from three levels:

  • First, choose a group. As of this writing, you can choose between Shoutcast and User-defined sites.
  • Next, choose a genre.
  • Last, choose a station. This starts the audio playing.

    You make a choice and decend to the next level by hitting the 'selectin' key, and back out to a previous level by hitting the 'selectout' key. For convenience, they can be assigned to the rewind/fast forward buttons on your remote, if you have one.

    Once a station is playing, you can hit selectout to return to the selection screen and find another station to listen to - all without interrupting your music.

    Using manually-started devices

    There are a few devices that CAJUN cannot start by itself; they are missing a checkmark in the 'Load at bootup' field in the Device Setting web menu. For example, if you configure an Xterm window for output (instead of a physical LCD display), you'll need to start CAJUN first, and then attach the device driver inside of an Xterm window:

    /usr/share/cajun/bin/device _devId XXX basedir /usr/share/cajun dbname cajun
    

    Where 'XXX' is the device id listed in the Device Settings menu.