Methods
int debug_mode()
Returns 1 if the client is running in debug mode

object busy()
Set the 'busy' status of the client as long as you keep your reference to the returned object.

Normal usage:

       {
         object handle = busy();
         .. do something that takes some time
       } /* handle falls out of scope here, thus no more busy */
    

array(Luke.db.Favourites) get_favourites()
Returns an array of all favourites (there can be more than one favourite list, since there are more than one database server. There is only one favourite per database server, though)

array(Luke.db.Favourites) get_playlists()
Returns an array with all playlists. The playlists are actually favourite objects, but they are not returned by get_favourites

void save_playlists( array(Luke.db.Favourites) lists)
Save the list of playlists in the database

array get_drag_icon( object dbobj )
Returns an icon, suitable to use as a drag icon, and a mask. The icon is a pixmap, and the mask is a bitmap. Normally you do not have to use this, even if you provide drag'n'drop functionallity in your widget, see unified_mouse_event and unified_drag_begin with friends.

mapping icon_objects_for( object dbo, int faded, int height )
Return a mapping with an 'img' and 'alpha' member. The alpha member can be 0.

If faded is true, the icon will be toned down to appear more 'transparent'.

If height is specified, the icon will be exactly that number of pixels high, scaled if nessesary

mapping small_icon_objects_for( object dbo, int faded, int height )
Like icon_objects_for, but smaller. :-)

Each object in the database has two icons, one large and one small. The small one is suitable for lists (such as the artist list in the gjuke client) and the large one for drag and drop, and the larger icon in the info field in the gjuke client.

void show_menu_for( Luke.db.DBObj obj )
Show the context menu for the specified object. Normally you do not have to use this function, you can instead use the unified_mouse_event function

void unified_mouse_event(mapping e, object drag_obj)
Use like this:
     
        Luke.db.DBObj drag_object;

        void drag_begin( int q, object w, object ctx )
        {
          cfg->unified_drag_begin( drag_object, ctx );
        }

        void mouse_fiddler( int q, object in, mapping e )
        {
          drag_object = find_dbobject_below_mouse( e );
          cfg->unified_mouse_event( e, drag_object );
        }

       ... in your create ...
      
        signal_connect( GTK.s_button_press_event, mouse_fiddler );
        signal_connect( GTK.s_drag_begin, drag_begin );
      

void unified_drag_begin(mapping e, object drag_obj)
See unified_mouse_event

Luke.db.DBObj query_selection()
Returns the currently selected object

Luke.db.DBObj query_selection_artist()
Returns the currently selected artist, if any.

If the user selects a collection, this can be used to filter which of the songs in the collections should be visible.

void select( Luke.db.DBObj what )
Select the specified object. Will emit a signal.

void vote( Luke.db.DBObj what, int|function score, object|void artist )
Vote on the specified object (any object works, collections, favourites and user objects included) with the specified score, if the score is a function, it will be called for each song that will be voted on in the end (when all songs in what has been located using a recursive function) to get the actuall score.

If the artist is specified, only songs that the artist in question has created will be played.

void vote_add( Luke.db.DBObj what, int|function score, object|void artist )
Exactly like vote, with one difference: The score will be added to the score the user already has on the objects

object get_dbd()
Return the 'home' database server of the current user

void pause(int enable)
If enable is true, ask the playd to pause playback, otherwise to continue playback.

void set_pan( float to )
Set front/back pan to to, range == -1.0 to 1.0

void set_balance( float to )
Set left/right pan to to, range == -1.0 to 1.0

void set_volume( float to )
Set the volume, range == 0.0 to 1.0. Multiplied with the song volume.

void set_song( float to )
Set the song local volume, range == 0.0 to 2.0. Multiplied with the song main volume.

void set_channel_volume( int channel, float volume )
Set the volume of channel n to volume, range == 0.0 to +Inf. This is multiplied with the product of the song volume and the main volume to get the final channel volume.

array(float) get_channel_volumes()
Return the volume of all channels. The number of channels is between 0 and 2^31 in the current protocol, non inclusive.

void set_channel_volumes( array(float) to )
Set the volume of all channels with one call

mixed query( string varname )
Query the value of a configuration variable.

mixed set( string varname, mixed value )
Set the value of a configuration variable. Only strings, integers and floats are allowed as values.

void save_config()
Save the configuration variables

array(Luke.db.DBObj) recursively_get_children( Luke.db.DBObj from )
Return all children (songs) in the specified object.

void add_perm_playlist( Luke.DB.DBObj list ) and add_perm_killlist( Luke.DB.DBObj list )
Add a permanent play or killlist. Permanent lists are automatically activated when the client is restarted

void add_playlist( Luke.DB.DBObj list ) and add_killlist( Luke.DB.DBObj list )
Add a play or killlist.

void remove_playlist( Luke.DB.DBObj list ) and remove_killlist( Luke.DB.DBObj list )
Remove a play or kill-list (deactivate it). Also works on permanent playlists and kill-lists.

int playlist_is_killlist( Luke.db.DBObj list )
Returns 1 if the playlist is activated, and is a kill-list

int playlist_is_active( Luke.db.DBObj list )
Returns 1 if the playlist is activated

Signals
Connect to the signals as you would connect to a GTK signal:
conf->signal_connect( "name", your_function[, your_arg] )

Your signal callback function will be called like this:
your_function( mixed your_arg, object configuration, signal specific arguments )

All signals
status name="status" args="string status" Emitted when the 'status' information is changed.
luke_debug name="luke_debug" args="string message" Emitted when a Luke object (such as a song, artist etc) is fetched from the database.


busy name="busy" args="int is_busy" Emitted when the client is either entering busy state, or leaving it.


elapsed name="elapsed" args="float seconds" Elapse time for the currently playing song


buffer name="buffer" args="int prefetch,
int bytes,
int done"
The size of the buffer in the player daemon. If prefetch is true, it is not the song currently playing that has the buffer, but the song that will play after it. If done is true, all data has been fetched


volume name="volume" args="float new_volume,
string who"
A new volume has been set by who


song_volume name="song_volume" args="float new_volume,
string who"
A new song volume has been set by who


channel_volumes name="channel_volumes" args="array(float) channels,
string who"
New channel volumes have been set.


front_back name="front_back" args="float new_balance,
string who"
A new front/back balance has been set by who Generated from the channel volumes.


left_right name="left_right" args="float new_balance,
string who"
A new front/back balance has been set by who Generated from the channel volumes.


diagonal name="diagonal" args="float new_balance,
string who"
A new front/back balance has been set by who. Generated from the channel volumes.


waiting name="waiting" args="Luke.db.Song song" The specified song is waiting for more data to become available in the buffer before it is started.


song_start name="song_start" args="Luke.db.Song song" The specified song has just started playing


song_stop name="song_stop" args="Luke.db.Song song" The specified song has just stopped playing


user_points name="user_points" args="int points" The user has points available points to vote with


queue name="queue" args="array(Luke.db.Song) songs,
array(mapping) votes,
string me"
The queue has changed.

The first argument is the array of songs, the votes are on the form of ([ "user":num_votes, ... ]), me is the user identifier for the current user.


user_selection name="user_selection" args="Luke.db.DBObj what" The specified object has been selected by the user. If you handle selection of objects in your widget, you should handle this signal, and also call conf->select( object ) when the user selects an object using your widget.


add_playlist name="add_playlist" args="Luke.db.Favourites list" The specified playlist has been added to the curently activated lists


add_killist name="add_killist" args="Luke.db.Favourites list" The specified kill list has been added to the curently activated lists


remove_playlist name="remove_playlist" args="Luke.db.Favourites list" The specified playlist has been removed from the curently activated lists


remove_killist name="remove_killist" args="Luke.db.Favourites list" The specified kill list has been removed from the curently activated lists


<variable>_changed name="&lt;variable&gt;_changed" args="mixed new_value" The specified configuration variable has a new value. (see the functions query and set)


apply_preferences name="apply_preferences" args="" The preferences (see set and query) has been changed, and you might want to rethink your layout or something similar.