update screens after being disconnected from server
Signed-off-by: Romain Bignon <romain@peerfuse.org>
Signed-off-by: Romain Bignon <romain@peerfuse.org>
use MPD_IDLE_QUEUE instead of deprecated MPD_IDLE_PLAYLIST flag
Signed-off-by: Romain Bignon <romain@peerfuse.org>
Signed-off-by: Romain Bignon <romain@peerfuse.org>
screen_song: store list items in the locale charset
Pre-convert the strings, instead of converting on demand.
Pre-convert the strings, instead of converting on demand.
charset: added function locale_width()
This function is a rather expensive wrapper: it converts the string to
UTF-8 and calls utf8_width().
This function is a rather expensive wrapper: it converts the string to
UTF-8 and calls utf8_width().
screen_song: properly implement line breaks
The old code didn't consider wide characters. This patch uses
utf8_cut_width() to break lines.
The old code didn't consider wide characters. This patch uses
utf8_cut_width() to break lines.
screen_song: fill spaces with memset()
Faster than a manual "for" loop.
Faster than a manual "for" loop.
screen_song: don't allow screen_song_append(NULL)
All callers make sure that value!=NULL.
All callers make sure that value!=NULL.
player_command: implement setup_seek() without a song object
Get the current song id from mpd_status_get_song_id().
Get the current song id from mpd_status_get_song_id().
player_command: merged code into setup_seek()
player_command: break from switch if not playing
Eliminate one indent level.
Eliminate one indent level.
screen_queue: update current song in method open()
When the queue screen is not open, and the song changes, it was not
updated, not even if you switch back and press Ctrl-L.
This patch moves some common code to screen_queue_song_change(), which
is also called by the open() method.
When the queue screen is not open, and the song changes, it was not
updated, not even if you switch back and press Ctrl-L.
This patch moves some common code to screen_queue_song_change(), which
is also called by the open() method.
screen_queue: use mpd_status.song_pos for centering the list
Don't look up the playlist. Just use the position provided by MPD.
Side effect: we can pass the mpd_status object to
center_playing_item(), not the whole mpdclient object.
Don't look up the playlist. Just use the position provided by MPD.
Side effect: we can pass the mpd_status object to
center_playing_item(), not the whole mpdclient object.
screen_queue: eliminated length check in center()
list_window_center() does all the checks fine. Don't duplicate that.
list_window_center() does all the checks fine. Don't duplicate that.
screen_queue: eliminated unused variable "song"
Not used in center_playing_item().
Not used in center_playing_item().
mpdclient: added inline function mpdclient_is_playing()
lyricwiki: convert numeric HTML escape sequences to proper characters
I've stumbled across several cases of obfuscated lyrics that use the numeric
HTML escape sequences.
I've stumbled across several cases of obfuscated lyrics that use the numeric
HTML escape sequences.
po: regenerated ncmpc.pot and *.po
A lot of code has been moved around.
A lot of code has been moved around.
po: updated POTFILES.in
There are several new source files, and screen_play.c has been renamed
to screen_queue.c.
There are several new source files, and screen_play.c has been renamed
to screen_queue.c.
screen_search: revert label to "Filename"
po: updated Spanish translation
screen_outputs: preserve cursor position after update
Don't clear the list_window in clear_outputs_list().
Don't clear the list_window in clear_outputs_list().
command, conf: simplify variable initialization
main: whitespace cosmetics
wreadln: whitespace cosmetics
command: whitespace cosmetics
screen_help: whitespace cosmetics
Replaced space characters with one tab to match the rest of the file.
Replaced space characters with one tab to match the rest of the file.
list_window: removed unnecessary reverse wattroff
In all callback functions row_color is used to initialize the reverse
attribute for each new line. No need to switch it off explicitly in
between.
In all callback functions row_color is used to initialize the reverse
attribute for each new line. No need to switch it off explicitly in
between.
screen_browser: removed unnecessary reverse wattroff.
All cases internally use row_paint_text that in turn uses row_color and
sets the A_REVERSE attribute for the new row. We do not need to switch it
off manually.
All cases internally use row_paint_text that in turn uses row_color and
sets the A_REVERSE attribute for the new row. We do not need to switch it
off manually.
screen_browse: removed unnecessary color selection
All cases use row_paint_text internally which sets the color. There is no
need to have the colors_use calls before, as they will be overwritten.
All cases use row_paint_text internally which sets the color. There is no
need to have the colors_use calls before, as they will be overwritten.
screen_browser: removed duplicate line clearing
whline(w, ' ', width); was used to clean the rest of the line. The new
function row_paint_text takes care of that already, so we don't have to do
it twice. We had to switch the default case to row_paint_text as well to
cover all possibilities.
This fixes a bug where the last digit of the playtime of the last visible
row in the browse screen was overwritten with a space character.
whline(w, ' ', width); was used to clean the rest of the line. The new
function row_paint_text takes care of that already, so we don't have to do
it twice. We had to switch the default case to row_paint_text as well to
cover all possibilities.
This fixes a bug where the last digit of the playtime of the last visible
row in the browse screen was overwritten with a space character.
Merge branch 'master' of git://git.musicpd.org/jefromi/ncmpc
defaults: correct status/list formats
The missing brackets caused literal "%title%|%shortfile%" to be
displayed, instead of the intended falling back to filename absent a
title.
The missing brackets caused literal "%title%|%shortfile%" to be
displayed, instead of the intended falling back to filename absent a
title.
screen_song: correct "is mpd playing?" logic
We check if mpd is playing (or paused) before displaying current song
info - the logic was inverted! (!playing && !paused)
We check if mpd is playing (or paused) before displaying current song
info - the logic was inverted! (!playing && !paused)
screen_browse: make screen_browser_sync_highlights an empty inline function
This improves readability, as no #ifdefs are required in the *.c files around
the screen_browser_sync_highlights calls anymore.
This improves readability, as no #ifdefs are required in the *.c files around
the screen_browser_sync_highlights calls anymore.
Makefile.am: require automake 1.10
Match the version mpd uses.
Match the version mpd uses.
Makefile.am: enable the "subdir-objects" option
Don't clutter the top directory with *.o files similar to mpd.
Don't clutter the top directory with *.o files similar to mpd.
screen_file: sync highlights in screen_file_open
Fix bug #2605, where CMD_SCREEN_FILE would show no highlights until some
user action or event changed that.
Fix bug #2605, where CMD_SCREEN_FILE would show no highlights until some
user action or event changed that.
mpdclient: return after playlist_update() error
In each of the functions, the client may get disconnected, and we have
to check c->status!=NULL again.
In each of the functions, the client may get disconnected, and we have
to check c->status!=NULL again.
hscroll: reimplemented the hscroll library
The hscroll object knows the location on the screen and the text.
Upon initialization, it installs a GLib timer which updates the screen
every second.
The hscroll object knows the location on the screen and the text.
Upon initialization, it installs a GLib timer which updates the screen
every second.
status_bar: un-inline constructor and destructor
hscroll: simplify the code with utf8_cut_width()
Concatenate the input string twice, and select a substring from that
large string.
Concatenate the input string twice, and select a substring from that
large string.
charset: added function utf8_cut_width()
This function helps printing UTF-8 strings on limited screen space.
This function helps printing UTF-8 strings on limited screen space.
hscroll: work with UTF-8 strings
Convert the input strings to UTF-8 before applying UTF-8 functions on
them. Convert back to the locale before returning.
Convert the input strings to UTF-8 before applying UTF-8 functions on
them. Convert back to the locale before returning.
test: added "run_hscroll" program
A program for debugging the hscroll.c library.
A program for debugging the hscroll.c library.
screen_browser: initialize local variable
configure.ac: added option --enable-test
This will enable the test suite.
This will enable the test suite.
configure.ac: use standard autoconf variable names
Use the variable name implicitly created by AC_ARG_ENABLE.
Use the variable name implicitly created by AC_ARG_ENABLE.
po: updated Korean translation
charset: added "replace" functions
These functions are a shortcut for a common use case: convert an
allocated string in-place.
These functions are a shortcut for a common use case: convert an
allocated string in-place.
screen_browser: free temporary string
In browser_lw_callback(), free the converted directory base name.
In browser_lw_callback(), free the converted directory base name.
hscroll: use g_strconcat() instead of g_strlcpy() + g_strlcat()
hscroll: pass const strings to strscroll()
hscroll: don't include ctype.h
mpdclient: don't assign c->status twice in mpdclient_cmd_clear()
Forgot to delete this line when I switched to mpdclient_recv_status().
Forgot to delete this line when I switched to mpdclient_recv_status().
mpdclient: removed mpdclient_cmd_swap()
Not used anymore.
Not used anymore.
screen_queue: move ranges with one single "move" command
Instead of swapping every single song in the selected range, send one
single "move" command which moves the neighbor song to the other end
of the range.
Instead of swapping every single song in the selected range, send one
single "move" command which moves the neighbor song to the other end
of the range.
mpdclient: added function mpdclient_cmd_move()
playlist: added function playlist_move()
playlist: don't update the song positions in playlist_swap()
In ncmpc, nobody reads the song's "position" attribute (except for the
"plchanges" handler). We don't need it, and we don't need to update
it after a swap.
In ncmpc, nobody reads the song's "position" attribute (except for the
"plchanges" handler). We don't need it, and we don't need to update
it after a swap.
mpdclient: renamed mpdclient_cmd_move() to mpdclient_cmd_swap()
That function does not move, it swaps two songs.
That function does not move, it swaps two songs.
mpdclient: moved code to mpdclient_recv_status()
Merge some duplicate code.
Merge some duplicate code.
mpdclient: optimize crop with delete_range
MPD 0.16 supports "delete" with a range.
MPD 0.16 supports "delete" with a range.
mpdclient: don't update the status in mpdclient_cmd_crop()
This is kind of redundant, because it doesn't solve the theoretical
race condition, and doesn't improve too much to justify the latency.
This is kind of redundant, because it doesn't solve the theoretical
race condition, and doesn't improve too much to justify the latency.
mpdclient: update mpdclient.playlist in mpdclient_cmd_clear()
Reduce UI latency.
Reduce UI latency.
mpdclient: removed mpdclient_cmd_play()
Call mpdclient_run_play_id() directly.
Call mpdclient_run_play_id() directly.
screen_queue: set cursor before button handlers
This allows us to use screen_queue_selected_song().
This allows us to use screen_queue_selected_song().
screen_queue: update list_window length after mouse delete
Fix an assertion failure.
Fix an assertion failure.
check the return value of mpdclient_get_connection()
When leaving idle mode, the idle callback (which is invoked indirectly
by mpdclient_get_connection()) may close the connection. Checking
mpdclient_is_connected() before mpdclient_get_connection() is
pointless for that reason.
When leaving idle mode, the idle callback (which is invoked indirectly
by mpdclient_get_connection()) may close the connection. Checking
mpdclient_is_connected() before mpdclient_get_connection() is
pointless for that reason.
screen_file: return void from handle_X() functions
Nobody evaluates the return values.
Nobody evaluates the return values.
screen_browser: convert path only for the message
We don't need the locale path if we don't print a message.
We don't need the locale path if we don't print a message.
screen_outputs: reset list_window length in clear_outputs_list()
Fix an assertion failure on disconnect.
Fix an assertion failure on disconnect.
screen_artist: check connection!=NULL in load_song_list()
screen_file: always set new list_window length
screen_file_reload() did not update the list_window length if it was
not connected. This led to an assertion failure.
screen_file_reload() did not update the list_window length if it was
not connected. This led to an assertion failure.
gidle: mpd_glib_enter() returns success
mpd_glib_enter() is unreliable, because it does nothing when called
during the callback, which in turn was invoked by mpd_glib_leave().
Sometimes, mpdclient.idle is wrong because of that. This patch sets
mpdclient.idle to the return value of mpd_glib_enter().
mpd_glib_enter() is unreliable, because it does nothing when called
during the callback, which in turn was invoked by mpd_glib_leave().
Sometimes, mpdclient.idle is wrong because of that. This patch sets
mpdclient.idle to the return value of mpd_glib_enter().
gidle: added internal "destroyed" flag
If mpd_glib_leave() invokes the callback, and the callback destroys
the mpd_glib_source object, mpd_glib_leave() is unable to reset the
"leaving" flag. This patch adds the flag "destroyed" which lets
mpd_glib_leave() do the g_free() when it's ready.
If mpd_glib_leave() invokes the callback, and the callback destroys
the mpd_glib_source object, mpd_glib_leave() is unable to reset the
"leaving" flag. This patch adds the flag "destroyed" which lets
mpd_glib_leave() do the g_free() when it's ready.
screen_help: translate section names
The _() call was missing.
The _() call was missing.
po: updated Russian translation
Conversion to UTF-8.
Conversion to UTF-8.
list_window: removed second column support
Not used anymore, because both screen_browser and screen_queue have a
row paint callback now.
Not used anymore, because both screen_browser and screen_queue have a
row paint callback now.
screen_queue: use paint_song_row()
Reuse code from screen_browser.c. Side effect: this patch disables
horizontal scrolling. The "hscroll" library will return after an
overhaul.
Reuse code from screen_browser.c. Side effect: this patch disables
horizontal scrolling. The "hscroll" library will return after an
overhaul.
screen_help: simplify the list_window callback
Return unmodified strings. Since that callback isn't used for
painting, we don't need to consider the layout here.
Return unmodified strings. Since that callback isn't used for
painting, we don't need to consider the layout here.
screen_help: added paint callback
screen_help: use help_paint()
Don't call list_window_paint() manually.
Don't call list_window_paint() manually.
screen_help: removed the help_text_row_t typedef
Use the struct name.
Use the struct name.
charset: make utf8_with() "pure"
This allows gcc to optimize further.
This allows gcc to optimize further.
screen_queue: check current song only if PLAYER idle event is set
screen_outputs: paint "enabled" checkbox
Instead of painting names in highlighted color, show the "enabled"
state with a checkbox.
Instead of painting names in highlighted color, show the "enabled"
state with a checkbox.
screen_browser: moved paint_song() to song_paint.c
renamed screen_play.c to screen_queue.c
screen_browser: display song duration
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.
Since the browser_lw_callback() isn't used for rendering anymore (only
for searching), we can remove the page breaks.
screen_browser: added custom list painting function
Side effect: playlists and directories are rendered with different
colors (configuration "browser-directory" and "browser-playlist").
Side effect: playlists and directories are rendered with different
colors (configuration "browser-directory" and "browser-playlist").
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.
With the function list_window_paint2(), callers can customize how a
row is painted. The usual callback function is not used anymore.
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().
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().
screen_browser: added wrapper function screen_browser_paint()
Don't export browser_lw_callback().
Don't export browser_lw_callback().
list_window: simplified narrow cursor drawing
Clear the space after the text before drawing the second column. The
continue drawing the second column.
Clear the space after the text before drawing the second column. The
continue drawing the second column.
list_window: simplify show_cursor formula
And call list_window_get_range() only if show_cursor is true.
And call list_window_get_range() only if show_cursor is true.
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.
Calculate those two variables on demand. This simplifies a lot of
code, and saves some memory and CPU cycles.
mpdclient: fall back to simple "deleteid" if range is 1
options: removed deprecated password code
libmpdclient2 parses the password from the host name.
libmpdclient2 parses the password from the host name.
list_window: eliminate redundant code in list_window_fetch_cursor()
Use list_window_move_cursor() to eliminate redundant code.
Use list_window_move_cursor() to eliminate redundant code.