Code

ncmpc.git
15 years agocharset: make utf8_with() "pure"
Max Kellermann [Sun, 11 Oct 2009 17:20:49 +0000 (19:20 +0200)]
charset: make utf8_with() "pure"

This allows gcc to optimize further.

15 years agoscreen_queue: check current song only if PLAYER idle event is set
Max Kellermann [Sun, 11 Oct 2009 17:01:57 +0000 (19:01 +0200)]
screen_queue: check current song only if PLAYER idle event is set

15 years agoscreen_outputs: paint "enabled" checkbox
Max Kellermann [Sun, 11 Oct 2009 16:52:21 +0000 (18:52 +0200)]
screen_outputs: paint "enabled" checkbox

Instead of painting names in highlighted color, show the "enabled"
state with a checkbox.

15 years agoscreen_browser: moved paint_song() to song_paint.c
Max Kellermann [Sun, 11 Oct 2009 16:20:49 +0000 (18:20 +0200)]
screen_browser: moved paint_song() to song_paint.c

15 years agorenamed screen_play.c to screen_queue.c
Max Kellermann [Sun, 11 Oct 2009 16:16:05 +0000 (18:16 +0200)]
renamed screen_play.c to screen_queue.c

15 years agoscreen_browser: display song duration
Max Kellermann [Sun, 11 Oct 2009 13:41:34 +0000 (15:41 +0200)]
screen_browser: display song duration

15 years agoscreen_browser: don't return directory name with square brackets
Max Kellermann [Sun, 11 Oct 2009 12:55:53 +0000 (14:55 +0200)]
screen_browser: don't return directory name with square brackets

Since the browser_lw_callback() isn't used for rendering anymore (only
for searching), we can remove the page breaks.

15 years agoscreen_browser: added custom list painting function
Max Kellermann [Sun, 11 Oct 2009 12:55:23 +0000 (14:55 +0200)]
screen_browser: added custom list painting function

Side effect: playlists and directories are rendered with different
colors (configuration "browser-directory" and "browser-playlist").

15 years agolist_window: added callback function for row painting
Max Kellermann [Sun, 11 Oct 2009 12:53:28 +0000 (14:53 +0200)]
list_window: added callback function for row painting

With the function list_window_paint2(), callers can customize how a
row is painted.  The usual callback function is not used anymore.

15 years agolist_window: moved painting utilities to paint.h
Max Kellermann [Sun, 11 Oct 2009 12:15:38 +0000 (14:15 +0200)]
list_window: moved painting utilities to paint.h

Minor optimization: pass the full row width to whline().  This way,
ncurses performs clipping for us, and we don't have to call
utf8_width().

15 years agoscreen_browser: added wrapper function screen_browser_paint()
Max Kellermann [Sat, 10 Oct 2009 18:25:46 +0000 (20:25 +0200)]
screen_browser: added wrapper function screen_browser_paint()

Don't export browser_lw_callback().

15 years agolist_window: simplified narrow cursor drawing
Max Kellermann [Sat, 10 Oct 2009 18:20:24 +0000 (20:20 +0200)]
list_window: simplified narrow cursor drawing

Clear the space after the text before drawing the second column.  The
continue drawing the second column.

15 years agolist_window: simplify show_cursor formula
Max Kellermann [Sat, 10 Oct 2009 17:37:58 +0000 (19:37 +0200)]
list_window: simplify show_cursor formula

And call list_window_get_range() only if show_cursor is true.

15 years agolist_window: removed selected_start, selected_end
Max Kellermann [Sat, 10 Oct 2009 17:36:13 +0000 (19:36 +0200)]
list_window: removed selected_start, selected_end

Calculate those two variables on demand.  This simplifies a lot of
code, and saves some memory and CPU cycles.

15 years agompdclient: fall back to simple "deleteid" if range is 1
Max Kellermann [Sat, 10 Oct 2009 17:09:26 +0000 (19:09 +0200)]
mpdclient: fall back to simple "deleteid" if range is 1

15 years agooptions: removed deprecated password code
Max Kellermann [Sat, 10 Oct 2009 16:54:24 +0000 (18:54 +0200)]
options: removed deprecated password code

libmpdclient2 parses the password from the host name.

15 years agolist_window: eliminate redundant code in list_window_fetch_cursor()
Max Kellermann [Sat, 10 Oct 2009 16:51:36 +0000 (18:51 +0200)]
list_window: eliminate redundant code in list_window_fetch_cursor()

Use list_window_move_cursor() to eliminate redundant code.

15 years agolist_window: removed redundant range_base checks
Max Kellermann [Sat, 10 Oct 2009 16:46:04 +0000 (18:46 +0200)]
list_window: removed redundant range_base checks

No need to check range_base in list_window_check_selected().

15 years agolist_window: moved checks to list_window_validate_index()
Max Kellermann [Sat, 10 Oct 2009 16:39:37 +0000 (18:39 +0200)]
list_window: moved checks to list_window_validate_index()

15 years agolist_window: removed scrolling from list_window_check_selected()
Max Kellermann [Sat, 10 Oct 2009 16:37:18 +0000 (18:37 +0200)]
list_window: removed scrolling from list_window_check_selected()

This broke CMD_LIST_FIRST.

15 years agoscreen_artist.c: use libmpdclient to obtain artist/album list
Max Kellermann [Sat, 10 Oct 2009 16:30:21 +0000 (18:30 +0200)]
screen_artist.c: use libmpdclient to obtain artist/album list

Moved the mpdclient_get_artists/albums() code from mpdclient.c to
screen_artist.c.

15 years agoscreen_artist: don't pass mpdclient object to free_lists()
Max Kellermann [Sat, 10 Oct 2009 16:26:09 +0000 (18:26 +0200)]
screen_artist: don't pass mpdclient object to free_lists()

It's unused.

15 years agompdclient: merged duplicate code into recv_tag_values()
Max Kellermann [Sat, 10 Oct 2009 16:13:49 +0000 (18:13 +0200)]
mpdclient: merged duplicate code into recv_tag_values()

15 years agolist_window: fix list_window_check_origin() indentation
Max Kellermann [Sat, 10 Oct 2009 16:07:11 +0000 (18:07 +0200)]
list_window: fix list_window_check_origin() indentation

15 years agolist_window: fully disable highlighting code on --enable-mini
Max Kellermann [Sat, 10 Oct 2009 16:05:32 +0000 (18:05 +0200)]
list_window: fully disable highlighting code on --enable-mini

15 years agolist_window: moved code to jump_match()
Max Kellermann [Sat, 10 Oct 2009 15:56:11 +0000 (17:56 +0200)]
list_window: moved code to jump_match()

Simplify the list_window_jump() function.

15 years agolist_window: don't allow list_window_jump(NULL)
Max Kellermann [Sat, 10 Oct 2009 15:45:57 +0000 (17:45 +0200)]
list_window: don't allow list_window_jump(NULL)

Added an assertion, removed two runtime checks.  Same for
list_window_find() and list_window_rfind().

15 years agolist_window: moved auto-scrolling code to list_window_check_origin()
Max Kellermann [Sat, 10 Oct 2009 15:45:23 +0000 (17:45 +0200)]
list_window: moved auto-scrolling code to list_window_check_origin()

Moved code from list_window_paint().  Call it in list_window_resize(),
list_window_set_length(), list_window_set_cursor(),
list_window_move_cursor().  Now that all the modifying code has been
removed from list_window_paint(), we can pass a const object to that
function.

15 years agolist_window: added function list_window_resize()
Max Kellermann [Sat, 10 Oct 2009 15:45:19 +0000 (17:45 +0200)]
list_window: added function list_window_resize()

Call this function instead of manually setting the "cols" and "rows"
attributes.

15 years agolist_window: use list_window_move_cursor() in find functions
Max Kellermann [Sat, 10 Oct 2009 15:45:13 +0000 (17:45 +0200)]
list_window: use list_window_move_cursor() in find functions

Don't repeat the range selection code.

15 years agogidle: free all objects in mpd_glib_free()
Max Kellermann [Sat, 10 Oct 2009 14:36:30 +0000 (16:36 +0200)]
gidle: free all objects in mpd_glib_free()

The mpd_parser object was not freed, and neither was the
mpd_glib_source object.

15 years agostrfsong: support multiple values for a tag
Max Kellermann [Sat, 10 Oct 2009 14:36:10 +0000 (16:36 +0200)]
strfsong: support multiple values for a tag

Concatenate them with ", " in between.

15 years agoscreen_song: corrected list_window length
Max Kellermann [Sat, 10 Oct 2009 14:23:03 +0000 (16:23 +0200)]
screen_song: corrected list_window length

15 years agolist_window: don't invoke callback out-of-range
Max Kellermann [Sat, 10 Oct 2009 14:13:55 +0000 (16:13 +0200)]
list_window: don't invoke callback out-of-range

For screen rows after the end of the list, don't invoke the callback.
We know the length of the list, and we know that the callback will
return NULL anyway.

Optimization: after the end of the list, call wclrtobot() to clear all
of the remaining visible (empty) lines.

15 years agolist_window: added attribute "length"
Max Kellermann [Sat, 10 Oct 2009 14:07:33 +0000 (16:07 +0200)]
list_window: added attribute "length"

Don't pass the number of list items to each and every function.
Instead, call list_window_set_length() each time the list contents
change.

15 years agoscreen_search: moved help text into a global variable
Max Kellermann [Sat, 10 Oct 2009 13:58:06 +0000 (15:58 +0200)]
screen_search: moved help text into a global variable

15 years agogidle: work around nested leave/enter problem
Max Kellermann [Sat, 10 Oct 2009 13:47:46 +0000 (15:47 +0200)]
gidle: work around nested leave/enter problem

Add the flag "leaving" which disables the mpd_glib_enter() function
while mpd_glib_leave() is running.

15 years agompdclient: set all idle events on disconnect
Max Kellermann [Sat, 10 Oct 2009 13:47:43 +0000 (15:47 +0200)]
mpdclient: set all idle events on disconnect

After a disconnect, all subsystems have to consider the "new data"
(i.e. nothing).

15 years agolist_window: disable support for second column on --enable-mini
Max Kellermann [Sat, 10 Oct 2009 13:47:35 +0000 (15:47 +0200)]
list_window: disable support for second column on --enable-mini

15 years agoscreen_keydef: call list_window_reset() after entering a command
Max Kellermann [Sat, 10 Oct 2009 12:50:57 +0000 (14:50 +0200)]
screen_keydef: call list_window_reset() after entering a command

15 years agoscreen_{play,keydef,text}: use list_window_set_cursor()
Max Kellermann [Fri, 9 Oct 2009 20:34:04 +0000 (22:34 +0200)]
screen_{play,keydef,text}: use list_window_set_cursor()

Don't write list_window.selected directly.

15 years agolist_window: moved code to list_window_fetch_cursor()
Max Kellermann [Fri, 9 Oct 2009 20:28:45 +0000 (22:28 +0200)]
list_window: moved code to list_window_fetch_cursor()

Merged code from screen_play.c and list_window_scroll_up(),
list_window_scroll_down().

15 years agolist_window: splitted function list_window_set_selected()
Max Kellermann [Fri, 9 Oct 2009 20:13:53 +0000 (22:13 +0200)]
list_window: splitted function list_window_set_selected()

list_window_set_selected() becomes list_window_move_cursor().
list_window_set_cursor() is the new public function, which sets the
cursor and disables range selection.

15 years agoscreen_text: start searching at window origin, not bottom
Max Kellermann [Fri, 9 Oct 2009 20:08:10 +0000 (22:08 +0200)]
screen_text: start searching at window origin, not bottom

Don't add "text->lw->rows" to the window origin.  This won't find text
displayed on the screen.  This patch affects the lyrics screen.

15 years agoscreen_play: repaint after the "select-playing" command
Max Kellermann [Fri, 9 Oct 2009 19:59:07 +0000 (21:59 +0200)]
screen_play: repaint after the "select-playing" command

When the cursor moves, we have to repaint the list.

15 years agolist_window: fix narrow cursor drawing
Max Kellermann [Fri, 9 Oct 2009 19:24:00 +0000 (21:24 +0200)]
list_window: fix narrow cursor drawing

When there's a second column (e.g. in the playlist screen), the space
between the two columns isn't cleared properly, because the cursor
position was changed by the second column renderer.

Side effect of this patch: space drawing is a little bit optimized,
because it won't clear the second column (in wide-cursor mode) only to
draw the second column text on top of it.

15 years agolist_window: optimize second column drawing
Max Kellermann [Fri, 9 Oct 2009 19:23:03 +0000 (21:23 +0200)]
list_window: optimize second column drawing

Paint the space with waddch() instead of waddstr().  Removed the
second cursor movement, it's redundant.

15 years agolist_window: moved code to list_window_paint_row()
Max Kellermann [Fri, 9 Oct 2009 18:54:27 +0000 (20:54 +0200)]
list_window: moved code to list_window_paint_row()

15 years agolist_window: simplified the selection painting code
Max Kellermann [Fri, 9 Oct 2009 18:48:19 +0000 (20:48 +0200)]
list_window: simplified the selection painting code

Combine all the checks in the two boolean variables "show_cursor" and
"selected".

15 years agolist_window: removed the list_window_t typedef
Max Kellermann [Fri, 9 Oct 2009 18:28:25 +0000 (20:28 +0200)]
list_window: removed the list_window_t typedef

Use the plain struct name "list_window".

15 years agolist_window: don't allow list_window_free(NULL)
Max Kellermann [Fri, 9 Oct 2009 18:27:43 +0000 (20:27 +0200)]
list_window: don't allow list_window_free(NULL)

Also don't clear the list_window object.

15 years agolyrics: replaced asserts with error handler
Thomas Jansen [Wed, 7 Oct 2009 21:33:34 +0000 (23:33 +0200)]
lyrics: replaced asserts with error handler

Handle missing artist and/or title for lyrics by defining an empty list of
plugins that fails almost immediately. Note that args in lyrics_load may now
start with NULL as the first array element. make_argv() in plugin.c made the
assumption that at least one argument is passed. If the first argument is
NULL a bogus pointer is returned by make_argv(). By converting do {} while
into while {}, we allow the first argument to be NULL.

15 years agopo: updated French translation
François Blondel [Mon, 5 Oct 2009 05:27:59 +0000 (07:27 +0200)]
po: updated French translation

15 years agooptions: convert timedisplay_type into a bool variable
Max Kellermann [Sun, 4 Oct 2009 16:59:00 +0000 (18:59 +0200)]
options: convert timedisplay_type into a bool variable

Save some CPU and memory by using bool instead of a string.  This
patch also removes the compile-time option
--with-default-timedisplay_type.

15 years agooptions: disable the status bar clock by default
Max Kellermann [Sun, 4 Oct 2009 16:41:14 +0000 (18:41 +0200)]
options: disable the status bar clock by default

15 years agomain: don't call mpdclient_update() for clock update
Max Kellermann [Sun, 4 Oct 2009 16:24:00 +0000 (18:24 +0200)]
main: don't call mpdclient_update() for clock update

When the "update timer" is running because the clock is enabled, don't
call mpdclient_update() in each tick.  For the clock, it's enough to
update MPD only when an idle event occurs.  While MPD is playing, we
still need MPD updates, beacuse we need the new "elapsed" time.

15 years agoscreen: force repaint progress window in screen_paint()
Max Kellermann [Sun, 4 Oct 2009 15:51:46 +0000 (17:51 +0200)]
screen: force repaint progress window in screen_paint()

15 years agocharset: removed duplicate return
Thomas Jansen [Sun, 4 Oct 2009 09:38:37 +0000 (11:38 +0200)]
charset: removed duplicate return

15 years agoleoslyrics plugin: handle parser exceptions
Thomas Jansen [Sun, 4 Oct 2009 08:55:56 +0000 (10:55 +0200)]
leoslyrics plugin: handle parser exceptions

Should fix bug #2286. Added exception handling for both calls of the SAX
XML parser. Also removed trailing newlines from the result to keep us from
scrolling down further than the last line.

15 years agompdclient: use the "idle" command to reduce CPU and network usage
Max Kellermann [Sat, 3 Oct 2009 23:18:35 +0000 (01:18 +0200)]
mpdclient: use the "idle" command to reduce CPU and network usage

This patch makes mpdclient and the rest of ncmpc use the new
mpd_glib_source class.  When mpdclient_get_connection() is called, it
sends the "noidle" command to MPD.  Upon mpdclient_put_connection()
(which is called before returning control back to GLib), mpdclient.c
re-enters "idle" mode.  The "idle" event handler lives in main.c, and
replaces timer_mpd_update().

Currently, the update timer is still used when MPD is playing, to keep
the progress bar and the time up to date.  This is subject to change
soon.

Servers which do not support "idle" are detected automatically.

15 years agogidle: new GLib/libmpdclient integration library
Max Kellermann [Sat, 3 Oct 2009 23:18:19 +0000 (01:18 +0200)]
gidle: new GLib/libmpdclient integration library

This library acts as a GLib source, and invokes a callback whenever
MPD sends an idle response.

It is BSD licensed, because it may be moved to libmpdclient one day.

15 years agompdclient: wrap access in mpdclient_get_connection()
Max Kellermann [Sat, 3 Oct 2009 23:18:06 +0000 (01:18 +0200)]
mpdclient: wrap access in mpdclient_get_connection()

Added mpdclient_put_connection() to release the connection before
control is returned to the GLib main loop.

15 years agomain: enable the update timer on demand
Max Kellermann [Sat, 3 Oct 2009 23:10:29 +0000 (01:10 +0200)]
main: enable the update timer on demand

We don't need the timer when ncmpc is not connected and the clock is
disabled.

15 years agomain: update within timer_reconnect()
Max Kellermann [Sat, 3 Oct 2009 23:10:28 +0000 (01:10 +0200)]
main: update within timer_reconnect()

Don't schedule the timer_mpd_update() call.  Always return "true" from
timer_mpd_update().

This sets the full event mask after a connection was established.  The
"database updated" message appears only if the connection existed
before.

15 years agomain: check for connection lost in end_input_event()
Max Kellermann [Sat, 3 Oct 2009 23:10:26 +0000 (01:10 +0200)]
main: check for connection lost in end_input_event()

Every GLib event callback which may affect the connection should
detect a lost connection.

15 years agomain: reconnect at the end of timer_mpd_update()
Max Kellermann [Sat, 3 Oct 2009 23:10:23 +0000 (01:10 +0200)]
main: reconnect at the end of timer_mpd_update()

During timer_mpd_update(), the MPD connection may get lost.  Move that
reconnect test to the end of timer_mpd_update(), so we can catch it as
soon as possible.  There is no advantage in having it at the
beginning.

15 years agostatus_bar: fixed visible_bitrate check
Max Kellermann [Sat, 3 Oct 2009 23:09:56 +0000 (01:09 +0200)]
status_bar: fixed visible_bitrate check

Don't render the bit rate if total_time is unknown, and the
visible_bitrate is disabled.

15 years agomain: clear mpdclient.events in end_input_event()
Max Kellermann [Sat, 3 Oct 2009 21:58:10 +0000 (23:58 +0200)]
main: clear mpdclient.events in end_input_event()

The events bit mask should be cleared after every screen_update()
call.

15 years agomain: assign reconnect_source_id when retrying to reconnect
Max Kellermann [Sat, 3 Oct 2009 21:22:57 +0000 (23:22 +0200)]
main: assign reconnect_source_id when retrying to reconnect

Keep track of the current source id, and unregister it on exit.

15 years agoscreen_play, status_bar: update scrolling with a GLib timer
Max Kellermann [Sat, 3 Oct 2009 20:05:09 +0000 (22:05 +0200)]
screen_play, status_bar: update scrolling with a GLib timer

15 years agostatus_bar: moved hscroll object to struct status_bar
Max Kellermann [Sat, 3 Oct 2009 20:04:54 +0000 (22:04 +0200)]
status_bar: moved hscroll object to struct status_bar

15 years agoscreen: don't use/define "welcome" stuff in --enable-mini
Max Kellermann [Sat, 3 Oct 2009 20:04:32 +0000 (22:04 +0200)]
screen: don't use/define "welcome" stuff in --enable-mini

15 years agoscreen_play: make the scroll_stat variable global
Max Kellermann [Sat, 3 Oct 2009 19:45:38 +0000 (21:45 +0200)]
screen_play: make the scroll_stat variable global

15 years agohscroll: wrap attribute access added helper functions
Max Kellermann [Sat, 3 Oct 2009 19:44:22 +0000 (21:44 +0200)]
hscroll: wrap attribute access added helper functions

15 years agohscroll: changed hscroll_state_t typedef to a struct
Max Kellermann [Sat, 3 Oct 2009 19:42:32 +0000 (21:42 +0200)]
hscroll: changed hscroll_state_t typedef to a struct

15 years agoscreen: disable the welcome screen list with a GLib timer
Max Kellermann [Sat, 3 Oct 2009 19:23:07 +0000 (21:23 +0200)]
screen: disable the welcome screen list with a GLib timer

15 years agomain: added functions dis/enable_update_timer()
Max Kellermann [Sat, 3 Oct 2009 19:11:22 +0000 (21:11 +0200)]
main: added functions dis/enable_update_timer()

15 years agoplaylist: removed unused macros
Max Kellermann [Sat, 3 Oct 2009 18:45:33 +0000 (20:45 +0200)]
playlist: removed unused macros

Removed ENABLE_PLCHANGES and MPD_ERROR.

15 years agoscreen_search: eliminate duplicate results
Max Kellermann [Sat, 3 Oct 2009 18:18:50 +0000 (20:18 +0200)]
screen_search: eliminate duplicate results

15 years agoMerge branch 'master' of git://git.musicpd.org/mithi/ncmpc
Max Kellermann [Sat, 3 Oct 2009 18:18:02 +0000 (20:18 +0200)]
Merge branch 'master' of git://git.musicpd.org/mithi/ncmpc

15 years agoscreen_search: moved code to screen_search_reload()
Max Kellermann [Sat, 3 Oct 2009 18:13:16 +0000 (20:13 +0200)]
screen_search: moved code to screen_search_reload()

This function creates an empty list when the search query has failed.
It is now used on CMD_SCREEN_UPDATE.

15 years agoscreen_search: check for SEARCH_URI in search_simple_query()
Max Kellermann [Sat, 3 Oct 2009 18:13:13 +0000 (20:13 +0200)]
screen_search: check for SEARCH_URI in search_simple_query()

Call mpd_search_add_uri_constraint() in this case.

15 years agolyricwiki plugin: updated to their latest layout
Thomas Jansen [Sat, 3 Oct 2009 18:09:25 +0000 (20:09 +0200)]
lyricwiki plugin: updated to their latest layout

15 years agohd plugin: fix exit code
Thomas Jansen [Sat, 3 Oct 2009 18:09:24 +0000 (20:09 +0200)]
hd plugin: fix exit code

15 years agompdclient: removed mpdclient_filelist_get()
Max Kellermann [Sat, 3 Oct 2009 17:19:46 +0000 (19:19 +0200)]
mpdclient: removed mpdclient_filelist_get()

Not used anymore.

15 years agoutils: don't use mpdclient_filelist_get() in gcmp_list_from_path()
Max Kellermann [Sat, 3 Oct 2009 17:19:08 +0000 (19:19 +0200)]
utils: don't use mpdclient_filelist_get() in gcmp_list_from_path()

Use libmpdclient's mpd_send_list_meta() instead.  This way, we can
stream MPD's response into the GList, and we don't need to read the
full filelist response.

15 years agofilelist: removed filelist_prepend()
Max Kellermann [Sat, 3 Oct 2009 17:19:05 +0000 (19:19 +0200)]
filelist: removed filelist_prepend()

This hack isn't used anymore.

15 years agoscreen_file: don't use mpdclient_filelist_get()
Max Kellermann [Sat, 3 Oct 2009 17:18:59 +0000 (19:18 +0200)]
screen_file: don't use mpdclient_filelist_get()

Use libmpdclient's mpd_send_list_meta() instead.  This way, we don't
have to use filelist_prepend() to the first NULL entry.

15 years agompdclient: moved compare_filelistentry() to filelist.c
Max Kellermann [Sat, 3 Oct 2009 17:18:04 +0000 (19:18 +0200)]
mpdclient: moved compare_filelistentry() to filelist.c

15 years agoutils: simplify gcmp_list_from_path() with "continue"
Max Kellermann [Sat, 3 Oct 2009 16:35:44 +0000 (18:35 +0200)]
utils: simplify gcmp_list_from_path() with "continue"

"continue" the loop when one condition fails.  This simplifies the
"if" conditions.

15 years agoutils: removed filelist_get()!=NULL check
Max Kellermann [Sat, 3 Oct 2009 16:32:17 +0000 (18:32 +0200)]
utils: removed filelist_get()!=NULL check

A filelist object can never have NULL objects (but an entry's entity
object may be NULL).

15 years agoscreen_artist: don't use filelist_prepend()
Max Kellermann [Sat, 3 Oct 2009 16:28:18 +0000 (18:28 +0200)]
screen_artist: don't use filelist_prepend()

filelist_prepend() is quite expensive.  Let's insert the NULL entry
first, and append all entries while they are received.

15 years agompdclient: removed mpdclient_filelist_search()
Max Kellermann [Sat, 3 Oct 2009 16:26:51 +0000 (18:26 +0200)]
mpdclient: removed mpdclient_filelist_search()

It's unused.

15 years agoscreen_artist: check cursor position in cmd() method
Max Kellermann [Sat, 3 Oct 2009 16:21:15 +0000 (18:21 +0200)]
screen_artist: check cursor position in cmd() method

Fix segmentation faults when the list is empty.

15 years agoscreen_artist: removed superfluous braces
Max Kellermann [Sat, 3 Oct 2009 16:21:09 +0000 (18:21 +0200)]
screen_artist: removed superfluous braces

15 years agoscreen_artist: don't use mpdclient_filelist_search()
Max Kellermann [Sat, 3 Oct 2009 16:20:47 +0000 (18:20 +0200)]
screen_artist: don't use mpdclient_filelist_search()

Use libmpdclient directly.  Side effect is that the listing of an
album includes the artist filter, too.  Same album name of different
artists doesn't mix anymore.

15 years agoscreen_browser: select next item after select/add
Max Kellermann [Sat, 3 Oct 2009 16:20:42 +0000 (18:20 +0200)]
screen_browser: select next item after select/add

Commit d08e14fa broke this: previously, the assignment
"cmd=CMD_LIST_NEXT" was passed to list_window_cmd().  With this patch,
list_window_cmd() was called before.  Thanks to Thomas Jansen for
finding this one.

15 years agoplugin: handle stderr messages of lyrics plugins
Thomas Jansen [Sat, 3 Oct 2009 13:32:06 +0000 (15:32 +0200)]
plugin: handle stderr messages of lyrics plugins

Use a second pipe to capture error messages generated by lyrics plugins. If
one plugin succeeds to retrieve some lyrics, we display them and discard the
error messages. If no plugin succeeds, we show the error messages of all
plugins that failed with an exit code other than 69 (EX_UNAVAILABLE,
sysexits.h).

All plugins use exit code 0 to indicate success (i.e. they are able to provide
lyrics on stdout). Exit code 69 indicates failure to retrieve lyrics, but
otherwise normal operation of the plugin. A plugin returning exit code 69 is
not listed as a failed plugin. Other exit codes indicate an internal error in
the plugin. Those plugins are listed as failed along with the output they
provide on stderr.

15 years agompdclient: don't check mpd_song_get_uri()!=NULL
Max Kellermann [Fri, 2 Oct 2009 17:57:22 +0000 (19:57 +0200)]
mpdclient: don't check mpd_song_get_uri()!=NULL

libmpdclient guarantees that this function always returns non-NULL.

15 years agoscreen_search: pass libmpdclient object to search_simple_query()
Max Kellermann [Fri, 2 Oct 2009 17:54:50 +0000 (19:54 +0200)]
screen_search: pass libmpdclient object to search_simple_query()

Pass mpd_connection instead of mpdclient.  Let the caller handle
errors.