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.
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.
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.
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.
screen_play: repaint after the "select-playing" command
When the cursor moves, we have to repaint the list.
When the cursor moves, we have to repaint the list.
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.
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.
list_window: optimize second column drawing
Paint the space with waddch() instead of waddstr(). Removed the
second cursor movement, it's redundant.
Paint the space with waddch() instead of waddstr(). Removed the
second cursor movement, it's redundant.
list_window: moved code to list_window_paint_row()
list_window: simplified the selection painting code
Combine all the checks in the two boolean variables "show_cursor" and
"selected".
Combine all the checks in the two boolean variables "show_cursor" and
"selected".
list_window: removed the list_window_t typedef
Use the plain struct name "list_window".
Use the plain struct name "list_window".
list_window: don't allow list_window_free(NULL)
Also don't clear the list_window object.
Also don't clear the list_window object.
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.
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.
po: updated French translation
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.
Save some CPU and memory by using bool instead of a string. This
patch also removes the compile-time option
--with-default-timedisplay_type.
options: disable the status bar clock by default
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.
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.
screen: force repaint progress window in screen_paint()
charset: removed duplicate return
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.
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.
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.
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.
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.
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.
mpdclient: wrap access in mpdclient_get_connection()
Added mpdclient_put_connection() to release the connection before
control is returned to the GLib main loop.
Added mpdclient_put_connection() to release the connection before
control is returned to the GLib main loop.
main: enable the update timer on demand
We don't need the timer when ncmpc is not connected and the clock is
disabled.
We don't need the timer when ncmpc is not connected and the clock is
disabled.
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.
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.
main: check for connection lost in end_input_event()
Every GLib event callback which may affect the connection should
detect a lost connection.
Every GLib event callback which may affect the connection should
detect a lost connection.
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.
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.
status_bar: fixed visible_bitrate check
Don't render the bit rate if total_time is unknown, and the
visible_bitrate is disabled.
Don't render the bit rate if total_time is unknown, and the
visible_bitrate is disabled.
main: clear mpdclient.events in end_input_event()
The events bit mask should be cleared after every screen_update()
call.
The events bit mask should be cleared after every screen_update()
call.
main: assign reconnect_source_id when retrying to reconnect
Keep track of the current source id, and unregister it on exit.
Keep track of the current source id, and unregister it on exit.
screen_play, status_bar: update scrolling with a GLib timer
status_bar: moved hscroll object to struct status_bar
screen: don't use/define "welcome" stuff in --enable-mini
screen_play: make the scroll_stat variable global
hscroll: wrap attribute access added helper functions
hscroll: changed hscroll_state_t typedef to a struct
screen: disable the welcome screen list with a GLib timer
main: added functions dis/enable_update_timer()
playlist: removed unused macros
Removed ENABLE_PLCHANGES and MPD_ERROR.
Removed ENABLE_PLCHANGES and MPD_ERROR.
screen_search: eliminate duplicate results
Merge branch 'master' of git://git.musicpd.org/mithi/ncmpc
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.
This function creates an empty list when the search query has failed.
It is now used on CMD_SCREEN_UPDATE.
screen_search: check for SEARCH_URI in search_simple_query()
Call mpd_search_add_uri_constraint() in this case.
Call mpd_search_add_uri_constraint() in this case.
lyricwiki plugin: updated to their latest layout
hd plugin: fix exit code
mpdclient: removed mpdclient_filelist_get()
Not used anymore.
Not used anymore.
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.
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.
filelist: removed filelist_prepend()
This hack isn't used anymore.
This hack isn't used anymore.
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.
Use libmpdclient's mpd_send_list_meta() instead. This way, we don't
have to use filelist_prepend() to the first NULL entry.
mpdclient: moved compare_filelistentry() to filelist.c
utils: simplify gcmp_list_from_path() with "continue"
"continue" the loop when one condition fails. This simplifies the
"if" conditions.
"continue" the loop when one condition fails. This simplifies the
"if" conditions.
utils: removed filelist_get()!=NULL check
A filelist object can never have NULL objects (but an entry's entity
object may be NULL).
A filelist object can never have NULL objects (but an entry's entity
object may be NULL).
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.
filelist_prepend() is quite expensive. Let's insert the NULL entry
first, and append all entries while they are received.
mpdclient: removed mpdclient_filelist_search()
It's unused.
It's unused.
screen_artist: check cursor position in cmd() method
Fix segmentation faults when the list is empty.
Fix segmentation faults when the list is empty.
screen_artist: removed superfluous braces
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.
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.
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.
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.
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.
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.
mpdclient: don't check mpd_song_get_uri()!=NULL
libmpdclient guarantees that this function always returns non-NULL.
libmpdclient guarantees that this function always returns non-NULL.
screen_search: pass libmpdclient object to search_simple_query()
Pass mpd_connection instead of mpdclient. Let the caller handle
errors.
Pass mpd_connection instead of mpdclient. Let the caller handle
errors.
filelist: added constructor filelist_new_recv()
This receives a filelist from a mpd_connection. This code has existed
before, and this patch merges those.
This receives a filelist from a mpd_connection. This code has existed
before, and this patch merges those.
screen_search: pass libmpdclient object to search_advanced_query()
Let the caller handle the errors.
Let the caller handle the errors.
screen_search: return NULL if advanced search is not used
After parsing the query, return NULL immediately if no valid advanced
search query could be parsed. Our caller do_search() will then fall
back to the simple search.
After parsing the query, return NULL immediately if no valid advanced
search query could be parsed. Our caller do_search() will then fall
back to the simple search.
screen_search: use strchr() instead of strrstr()
strrstr() is more expensive, and we're just interested in whether
there is a colon, not where.
strrstr() is more expensive, and we're just interested in whether
there is a colon, not where.
screen_search: removed pointless loop in search_advanced_query()
screen_search: renamed filelist_search() to search_simple_query()
screen_search: call do_search() on CMD_SCREEN_UPDATE
The old code just called filelist_search(), which is the simple
search. This could not reload the "advanced" search result.
The old code just called filelist_search(), which is the simple
search. This could not reload the "advanced" search result.
screen_search: moved search calls to do_search()
screen_search: removed check for MPD >= 0.12
Redundant, this is checked in main.c right after connection was
established.
Redundant, this is checked in main.c right after connection was
established.
screen_client: recover from UPDATE_ALREADY error
If mpd_connection_clear_error() fails, revert to
mpdclient_handle_error().
If mpd_connection_clear_error() fails, revert to
mpdclient_handle_error().
use mpdclient_is_connected()
.. instead of accessing mpdclient.connection directly.
.. instead of accessing mpdclient.connection directly.
screen_song: pass mpd_connection to screen_song_add_stats()
Caller must handle the error.
Caller must handle the error.
screen_song: moved code to format_duration_short()
New function in utils.c. Use that same function in screen_play.c,
status_bar.c and strfsong.c.
New function in utils.c. Use that same function in screen_play.c,
status_bar.c and strfsong.c.
utils: pass preallocated buffer to format_duration_long()
utils: renamed time_seconds_to_durationstr()
Rename time_seconds_to_durationstr() to format_duration_long().
Rename time_seconds_to_durationstr() to format_duration_long().
status_bar: initialize the "buffer" variable with --enable-mini
Move one #endif.
Move one #endif.
screen_utils: moved screen_find() to screen_find.c
screen_browser: check connection in screen_file_cmd()
screen_file: check connection in screen_file_cmd()
screen_play: check connection in screen_playlist_cmd()
screen_play: fixed function prefix
Prefix must be "screen_playlist_".
Prefix must be "screen_playlist_".
screen_play: check the result of mpd_connection_clear_error()
mpdclient: convert all functions to return "bool"
No libmpdclient error codes.
No libmpdclient error codes.
mpdclient: removed several functions
Make the code use libmpdclient directly.
Make the code use libmpdclient directly.
screen: moved status message functions to screen_message.c
screen: removed unused macro MAX_SONGNAME_LENGTH
screen: eliminated state macros
Better do it manually.
Better do it manually.
screen: removed obsolete screen_error() prototype
screen: removed obsolete screen_get_id() prototype
screen: moved screen_interface externs to each screen header
Make a header for each screen implementation.
Make a header for each screen implementation.
screen: removed unused function volume_length()
screen_lyrics: don't use strfsong() to obtain tags
Use mpd_song_get_tag(). This guarantees that the tags are encoded in
UTF-8.
Use mpd_song_get_tag(). This guarantees that the tags are encoded in
UTF-8.
status_bar: use a GLib timer to remove the message
mpdclient: rewrite the "fancy swap" code
This is a trick to keep playlist swaps cheap: ncmpc tries to predict
the new playlist.
This is a trick to keep playlist swaps cheap: ncmpc tries to predict
the new playlist.
screen_play: use mpd_cmd_delete_range()
mpdclient: added mpdclient_cmd_delete_range()
MPD 0.16 supports "delete" with a range argument.
MPD 0.16 supports "delete" with a range argument.
mpdclient: rewrite the "fancy delete" code
This is a trick to keep playlist deletes cheap: ncmpc tries to predict
the new playlist.
This is a trick to keep playlist deletes cheap: ncmpc tries to predict
the new playlist.
mpdclient: rewrite the "fancy add" code
This is a trick to keep playlist adds cheap: ncmpc tries to predict
the new playlist.
This is a trick to keep playlist adds cheap: ncmpc tries to predict
the new playlist.
removed obsolete Makefile.am
playlist: renamed "id" to "version"
mpdclient: check to assertion in mpdclient_cmd_add()
It's illegal to pass song=NULL.
It's illegal to pass song=NULL.
screen_browser: add "const" to several variables