Requirements for LSongs

python 2.3
PyQt
PyKDE (SEE NOTE 2 BELOW)
id3lib, pyid3lib (pyid3lib.sourceforge.net) - used to read/write MP3 tags (SEE NOTE 1 BELOW)
xine, pyxine - used to play all audio tracks - need plugins for supported media types, plus goom (SEE NOTE 3 BELOW)
cdparanoia,cdda2wav - used to rip CDs
lame, pylame - used to encode ripped CD tracks as MP3s
mpg321 - used to transcode MP3s into PCM audio for burning CDs
cdrecord - used for burning tracks to CDs (SEE NOTE 4 BELOW)
vorbis-tools - used to encode/transcode Ogg Vorbis tracks (ogginfo, oggenc)
libnjb - used to read/write to Dell Digital Jukebox (SEE NOTE 5 BELOW)
njbtools - used to read/write to the Dell Digital Jukebox 
pynjb - used to interface with the Dell Digital Jukebox (SEE NOTE 9 BELOW)
sox - used to transcode tracks
howl, mdnsresponder - used to advertise and find zeroconf(Rendezvous) services
howl-xml - a set of small command-line tools to use howl more easily (SEE NOTE 8 BELOW)
daapd - used to serve tracks and playlists to iTunes (requires plist-enabled version) (SEE NOTE 6 BELOW)
trmxml - a command-line tool interface to MusicBrainz (SEE NOTE 7 BELOW)
faad - used to transcode M4A files to PCM audio for burning to CDs

To build .po files from the Lsongs directory:

xgettext *.py --language=Python --keyword=i18n -j -o lsongs.po

---------------------------------------------------------------------
NOTE 1:

pyid3lib 0.5.1 has a memory leak which has been fixed in the Linspire build.  You may either
retrieve the modified source from Linspire's source pool, or apply the fix to your local version.

Here is the fix in file pyid3lib.cc, near the end of function id3_new():

    while ( (frame = titer->GetNext()) )
    {
        // unfortunately, we have to discard any frames that
        // id3lib doesn't recognize, due to a bug in its handling
        // of them.  hopefully this will change.
        if ( frame->GetID() != ID3FID_NOFRAME )
        {
            id3obj->frames[id3obj->size] = new ID3_Frame( *frame );
            ++id3obj->size;
        }
        id3obj->tag->RemoveFrame( frame );
        delete frame; // <------ add this line
    }


---------------------------------------------------------------------
NOTE 2:

There is a bug in PyKDE in any version after 3.8 up to the version at the time of this
writing (July 14 2004) that will cause a crash when showing the Stations view.  This bug has
been fixed in the version of PyKDE distributed for Linspire, however, other distributions will
very likely not work with a stock PyKDE.  The symptom is a segfault when clicking on the Stations
source icon.

If you wish to fix the bug on your favorite distribution, you will have to rebuild PyKDE from source.
Before building you'll need to edit the file "sip/kparts/event.sip" and comment out the entire
%ConvertToSubClassCode block within the class Event.  The author/maintainer of PyKDE has
been made aware of the issue and a similar fix should appear in PyKDE 3.12 and later.

Even after this patch, part of the bug is still there, however, Lsongs works around it.

--------------------------------------------------------------------
NOTE 3:

Note that for CD playback, you may need to install the appropriate plugin for Xine.

-------------------------------------------------------------------
NOTE 4:

For CD Recording from a user account, you must be sure to add the user to the group to which
cdrecord also belongs.

-------------------------------------------------------------------
NOTE 5:

For Dell Digital Jukebox support, you'll have to add a hotplug script to properly set permissions on the
usb device, and maintain the DDJ presence file.  The presence file is "/tmp/.ddj" and should contain
"1\n" if the Dell is present, or "0\n" if it is not.  Lsongs will believe this file only if its last modification
date is after the last boot time of the machine.

As an example, here's how to set up the hotplug script for Mandrake 9.2 - your will have to
consult with the documentation for your distribution for the particular steps.  You should be root.

1) Create the file "/usr/lib/hotplug/ddj/usb.usermap" with the contents:

usbddj 0x03 0x041e 0x0222 0 0 0 0 0 0 0 0 0
usbddj 0x03 0x041e 0x4100 0 0 0 0 0 0 0 0 0
usbddj 0x03 0x041e 0x4101 0 0 0 0 0 0 0 0 0
usbddj 0x03 0x041e 0x4108 0 0 0 0 0 0 0 0 0
usbddj 0x03 0x041e 0x4109 0 0 0 0 0 0 0 0 0
usbddj 0x03 0x041e 0x410b 0 0 0 0 0 0 0 0 0
usbddj 0x03 0x041e 0x4110 0 0 0 0 0 0 0 0 0
usbddj 0x03 0x041e 0x4111 0 0 0 0 0 0 0 0 0
usbddj 0x03 0x041e 0x411b 0 0 0 0 0 0 0 0 0
usbddj 0x03 0x041e 0x411e 0 0 0 0 0 0 0 0 0
usbddj 0x03 0x041e 0x4126 0 0 0 0 0 0 0 0 0
usbddj 0x03 0x041e 0x4127 0 0 0 0 0 0 0 0 0

Each of these lines corresponds to a particular model of Dell DJ or Creative Nomad.  Note that Lsongs only supports
"standard" players, not the newer "Plays For Sure" models, which use the proprietary Microsoft "MTP" protocol.

2) Create the file "/etc/hotplug/usb/usbddj" with the contents:

#!/bin/bash

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
    if [ -f /var/run/console.lock ]
    then
        CONSOLEOWNER=`cat /var/run/console.lock`
    elif [ -f /var/lock/console.lock ]
    then
        CONSOLEOWNER=`cat /var/lock/console.lock`
    else
        CONSOLEOWNER=
    fi
    if [ -n "$CONSOLEOWNER" ]
    then
        chmod 0000 "${DEVICE}"
        chown "$CONSOLEOWNER" "${DEVICE}"
        chmod 0644 "${DEVICE}"
    fi
fi

TOGGLEFILE=/tmp/.ddj

if [ "${ACTION}" = "add" ]; then
   cat > $TOGGLEFILE <<EOF
1
EOF
   cat > $REMOVER <<EOF
cat > $TOGGLEFILE <<XXX
0
XXX
EOF
   chmod +x $REMOVER
fi

3) chmod the "/etc/hotplug/usb/usbddj" file as executable

4) execute the command:

update-usb.usermap

5) plugin the DDJ and see if the file "/tmp/.ddj" is created and contains the value "1".

6) unplug the DDJ and see if the file "/tmp/.ddj" contains the value "0"

7) If there's a problem, look in the "/var/log/messages" file for logging information

The are known problems with trying to talk to the DDJ through a USB 2.0 port under kernel
versions 2.4.x and certain USB chipsets.  Some people have had some success with:

1) updating the firmware on the DDJ
2) putting the DDJ on the other side of an external USB 2.0 hub
3) using different USB ports on their machines
4) unloading the EHCI kernel module
5) using a 2.6.x kernel

-------------------------------------------------------------------
NOTE 6:

For sharing with iTunes, you will need to obtain a version of daapd which contains enhancements
to parse the iTunes Music Library XML format, which Lsongs also uses.  This is available from
the Linspire site if it's not available for your favorite distribution.

-------------------------------------------------------------------
NOTE 7:

trmxml is a modified version of trm that emits XML to stdout.  You may obtain the source for
this program from Linspire's source pool

-------------------------------------------------------------------
NOTE 8:

howlxml is a set of command line tools that interface with libhowl that emit XML.  You may obtain
the source for these tools from Linspire's source pool

-------------------------------------------------------------------
NOTE 9:

pynjb is a python binding to libnjb.  You may obtain the source for this tool from Linspire's
source pool
