Code

ncmpc.git
7 years agopo: update ncmpc.pot
Max Kellermann [Mon, 20 Mar 2017 12:44:46 +0000 (13:44 +0100)]
po: update ncmpc.pot

7 years agoscreen_song: don't translate printf formats
Max Kellermann [Mon, 20 Mar 2017 12:43:09 +0000 (13:43 +0100)]
screen_song: don't translate printf formats

7 years agoMakefile.am: use CURSES_LIBS instead of CURSES_LIB
Max Kellermann [Mon, 20 Mar 2017 12:41:07 +0000 (13:41 +0100)]
Makefile.am: use CURSES_LIBS instead of CURSES_LIB

7 years agoscreen_*: eliminate redundant wrefresh() calls
Max Kellermann [Mon, 20 Mar 2017 12:08:01 +0000 (13:08 +0100)]
screen_*: eliminate redundant wrefresh() calls

This is already called by screen_refresh().

7 years agoscreen: merge duplicate code from screen_paint() and screen_update()
Max Kellermann [Mon, 20 Mar 2017 11:53:39 +0000 (12:53 +0100)]
screen: merge duplicate code from screen_paint() and screen_update()

7 years agoscreen_browser: include cleanup
Max Kellermann [Mon, 20 Mar 2017 11:40:46 +0000 (12:40 +0100)]
screen_browser: include cleanup

7 years agoscreen: remove unnecessary doupdate() call from screen_init()
Max Kellermann [Mon, 20 Mar 2017 11:34:00 +0000 (12:34 +0100)]
screen: remove unnecessary doupdate() call from screen_init()

main() will call screen_paint() before entering the main loop, so this
saves a few bytes of stdout transfer.

7 years agoscreen_utils: remove redundant doupdate() call
Max Kellermann [Mon, 20 Mar 2017 11:30:54 +0000 (12:30 +0100)]
screen_utils: remove redundant doupdate() call

wrefresh() implies doupdate().

7 years agokeyboard: call wgetch() on main window
Max Kellermann [Mon, 20 Mar 2017 10:28:21 +0000 (11:28 +0100)]
keyboard: call wgetch() on main window

This erases all the windows, and requires them to repaint.  Strangely,
ncurses does this only in color mode.  Anyway, this greatly reduces
the amount of data transferred to stdout, and fixes the flickering
problems.

7 years agokeyboard: implement keyboard_unread() without ungetch()
Max Kellermann [Mon, 20 Mar 2017 11:19:29 +0000 (12:19 +0100)]
keyboard: implement keyboard_unread() without ungetch()

7 years agokeyboard: move code to translate_key()
Max Kellermann [Mon, 20 Mar 2017 11:18:48 +0000 (12:18 +0100)]
keyboard: move code to translate_key()

7 years agokeyboard: add keyboard_unread()
Max Kellermann [Mon, 20 Mar 2017 11:14:54 +0000 (12:14 +0100)]
keyboard: add keyboard_unread()

7 years agocommand: move get_keyboard_command() to keyboard.c
Max Kellermann [Mon, 20 Mar 2017 11:02:33 +0000 (12:02 +0100)]
command: move get_keyboard_command() to keyboard.c

7 years agocommand: remove "pure" attribute from get_keyboard_command()
Max Kellermann [Mon, 20 Mar 2017 11:04:44 +0000 (12:04 +0100)]
command: remove "pure" attribute from get_keyboard_command()

7 years agocommand: include cleanup
Max Kellermann [Mon, 20 Mar 2017 10:51:19 +0000 (11:51 +0100)]
command: include cleanup

7 years agoconfigure.ac: repair the getmouse() check
Max Kellermann [Mon, 20 Mar 2017 09:51:25 +0000 (10:51 +0100)]
configure.ac: repair the getmouse() check

Was broken by commit b73fd31ce0dc27d8

7 years agompdclient: connect to MPD asynchronously
Max Kellermann [Fri, 17 Mar 2017 14:53:09 +0000 (15:53 +0100)]
mpdclient: connect to MPD asynchronously

This way, the user can really cancel the connection attempt at any
time, and does not need to wait for a timeout.

This duplicates some code from libmpdclient, but unfortunately
libmpdclient doesn't expose a usable API for connecting asynchronously
yet.

7 years agompdclient: move code to mpdclient_connected()
Max Kellermann [Sun, 19 Mar 2017 12:57:46 +0000 (13:57 +0100)]
mpdclient: move code to mpdclient_connected()

7 years agoconfigure.ac: remove redundant variable assignments
Max Kellermann [Sun, 19 Mar 2017 12:50:28 +0000 (13:50 +0100)]
configure.ac: remove redundant variable assignments

These are implied by autoconf.

7 years agompdclient: eliminate redundant mpd_status_get_volume() calls
Max Kellermann [Sun, 19 Mar 2017 12:10:43 +0000 (13:10 +0100)]
mpdclient: eliminate redundant mpd_status_get_volume() calls

Return early from mpdclient_cmd_volume_*(), without calling
mpdclient_get_connection(), if we already know the operation would
have no effect.

7 years agomain: remove check_reconnect()
Max Kellermann [Sun, 19 Mar 2017 11:49:42 +0000 (12:49 +0100)]
main: remove check_reconnect()

Assume that mpdclient_lost_callback() is everything we need to
implement.

7 years agompdclient: call mpdclient_lost_callback() after failed error recovery
Max Kellermann [Sun, 19 Mar 2017 11:47:53 +0000 (12:47 +0100)]
mpdclient: call mpdclient_lost_callback() after failed error recovery

7 years agompdclient: no mpdclient_handle_error() after connect failure
Max Kellermann [Sun, 19 Mar 2017 12:02:11 +0000 (13:02 +0100)]
mpdclient: no mpdclient_handle_error() after connect failure

Invoke the error callback, but don't attempt to recover.

7 years agompdclient: automatically re-enter idle mode, eliminate mpdclient_put_connection()
Max Kellermann [Sun, 19 Mar 2017 11:20:23 +0000 (12:20 +0100)]
mpdclient: automatically re-enter idle mode, eliminate mpdclient_put_connection()

7 years agomain: remove redundant mpdclient_disconnect() call
Max Kellermann [Sun, 19 Mar 2017 11:04:16 +0000 (12:04 +0100)]
main: remove redundant mpdclient_disconnect() call

7 years agompdclient: pass host, port etc. to constructor
Max Kellermann [Sun, 19 Mar 2017 10:55:54 +0000 (11:55 +0100)]
mpdclient: pass host, port etc. to constructor

7 years agomain: move signal handlers to signals.c
Max Kellermann [Sun, 19 Mar 2017 10:18:16 +0000 (11:18 +0100)]
main: move signal handlers to signals.c

7 years agomain: use g_unix_signal_add() for SIGTERM, SIGINT and SIGHUP
Max Kellermann [Sun, 19 Mar 2017 10:41:00 +0000 (11:41 +0100)]
main: use g_unix_signal_add() for SIGTERM, SIGINT and SIGHUP

Unfortunately, GLib doesn't support SIGWINCH and SIGCONT, for whatever
reasons.

7 years agoconfigure.ac: require GLib 2.30 (for signal handlers)
Max Kellermann [Sun, 19 Mar 2017 10:31:53 +0000 (11:31 +0100)]
configure.ac: require GLib 2.30 (for signal handlers)

7 years agomain: merge catch_sigcont() and catch_sigwinch()
Max Kellermann [Sun, 19 Mar 2017 10:28:39 +0000 (11:28 +0100)]
main: merge catch_sigcont() and catch_sigwinch()

7 years agom4/ax_with_curses.m4: update from upstream
Max Kellermann [Sun, 19 Mar 2017 10:25:42 +0000 (11:25 +0100)]
m4/ax_with_curses.m4: update from upstream

7 years agom4/ax_append_*_flags.m4: update from upstream
Max Kellermann [Sun, 19 Mar 2017 10:24:08 +0000 (11:24 +0100)]
m4/ax_append_*_flags.m4: update from upstream

7 years agomain: remove unused function sigstop()
Max Kellermann [Sun, 19 Mar 2017 10:20:39 +0000 (11:20 +0100)]
main: remove unused function sigstop()

7 years agoplugin: call g_io_channel_unref() early, eliminate "channel" attribute
Max Kellermann [Sun, 19 Mar 2017 10:09:44 +0000 (11:09 +0100)]
plugin: call g_io_channel_unref() early, eliminate "channel" attribute

7 years agoplugin: add plugin_pipe.cycle pointer
Max Kellermann [Sun, 19 Mar 2017 10:11:13 +0000 (11:11 +0100)]
plugin: add plugin_pipe.cycle pointer

Replaces the fragile if/else in plugin_data().

7 years agomain: do_input_event() returns bool
Max Kellermann [Sun, 19 Mar 2017 10:04:08 +0000 (11:04 +0100)]
main: do_input_event() returns bool

7 years agomain: move keyboard_event() to keyboard.c
Max Kellermann [Sun, 19 Mar 2017 09:59:16 +0000 (10:59 +0100)]
main: move keyboard_event() to keyboard.c

7 years agomain: eliminate another local dummy variable
Max Kellermann [Sun, 19 Mar 2017 09:56:40 +0000 (10:56 +0100)]
main: eliminate another local dummy variable

7 years agomain: move "#ifdef ENABLE_LIRC" to lirc.h"
Max Kellermann [Sun, 19 Mar 2017 09:53:49 +0000 (10:53 +0100)]
main: move "#ifdef ENABLE_LIRC" to lirc.h"

7 years agolirc: rename public functions
Max Kellermann [Sun, 19 Mar 2017 09:52:42 +0000 (10:52 +0100)]
lirc: rename public functions

7 years agomain: move LIRC GIOChannel setup to lirc.c
Max Kellermann [Sun, 19 Mar 2017 09:50:09 +0000 (10:50 +0100)]
main: move LIRC GIOChannel setup to lirc.c

7 years agomain: call g_io_channel_unref() early
Max Kellermann [Sun, 19 Mar 2017 09:45:18 +0000 (10:45 +0100)]
main: call g_io_channel_unref() early

Release the reference right after registering the channel in the event
loop.  We don't need the reference, and the main loop has its own
reference.

7 years agomain: merge exit_and_cleanup() into main()
Max Kellermann [Sun, 19 Mar 2017 09:42:00 +0000 (10:42 +0100)]
main: merge exit_and_cleanup() into main()

There's no point in having this function that is called only once.

7 years agompdclient: convert port to "unsigned"
Max Kellermann [Fri, 17 Mar 2017 22:45:35 +0000 (23:45 +0100)]
mpdclient: convert port to "unsigned"

7 years agompdclient: remove unnecessary NULL check
Max Kellermann [Fri, 17 Mar 2017 22:38:58 +0000 (23:38 +0100)]
mpdclient: remove unnecessary NULL check

7 years agocallbacks: add "connected" and "failed" callback
Max Kellermann [Fri, 17 Mar 2017 22:33:49 +0000 (23:33 +0100)]
callbacks: add "connected" and "failed" callback

More preparations for asynchronous connect.

7 years agompdclient: add _is_dead()
Max Kellermann [Fri, 17 Mar 2017 22:15:56 +0000 (23:15 +0100)]
mpdclient: add _is_dead()

Prepare for asynchronous connect.

7 years agompdclient: add "playing" attribute
Max Kellermann [Fri, 17 Mar 2017 22:24:27 +0000 (23:24 +0100)]
mpdclient: add "playing" attribute

Cache the mpd_status_get_state()==MPD_STATE_PLAY value which is used
pretty often.

7 years agomain: remove unnecessary "mpd!=NULL" checks
Max Kellermann [Fri, 17 Mar 2017 22:27:12 +0000 (23:27 +0100)]
main: remove unnecessary "mpd!=NULL" checks

7 years agompdclient: reorder attributes for better packing
Max Kellermann [Fri, 17 Mar 2017 22:24:03 +0000 (23:24 +0100)]
mpdclient: reorder attributes for better packing

7 years agompdclient: move volume reset to _status_free()
Max Kellermann [Fri, 17 Mar 2017 22:20:24 +0000 (23:20 +0100)]
mpdclient: move volume reset to _status_free()

Make sure that volume gets reset whenever status==NULL, also in
mpdclient_disconnect().

7 years agompdclient: move code to mpdclient_status_free()
Max Kellermann [Fri, 17 Mar 2017 22:18:56 +0000 (23:18 +0100)]
mpdclient: move code to mpdclient_status_free()

7 years agompdclient: remove unused attribute "update_id"
Max Kellermann [Fri, 17 Mar 2017 22:21:36 +0000 (23:21 +0100)]
mpdclient: remove unused attribute "update_id"

7 years agompdclient: update the "source" documentation
Max Kellermann [Fri, 17 Mar 2017 22:23:15 +0000 (23:23 +0100)]
mpdclient: update the "source" documentation

7 years agompdclient: wrap the idle callback, unified error handling
Max Kellermann [Fri, 17 Mar 2017 21:55:19 +0000 (22:55 +0100)]
mpdclient: wrap the idle callback, unified error handling

7 years agompdclient: convert UTF-8 error message to locale charset
Max Kellermann [Fri, 17 Mar 2017 21:51:46 +0000 (22:51 +0100)]
mpdclient: convert UTF-8 error message to locale charset

Provide a consistent, documented API.

7 years agompdclient: move code to mpdclient_invoke_error_callback()
Max Kellermann [Fri, 17 Mar 2017 21:47:32 +0000 (22:47 +0100)]
mpdclient: move code to mpdclient_invoke_error_callback()

7 years agompdclient: include cleanup
Max Kellermann [Fri, 17 Mar 2017 21:45:14 +0000 (22:45 +0100)]
mpdclient: include cleanup

7 years agompdclient: remove unused macro BUFSIZE
Max Kellermann [Fri, 17 Mar 2017 21:44:12 +0000 (22:44 +0100)]
mpdclient: remove unused macro BUFSIZE

7 years agompdclient: remove unused function compare_filelistentry_format()
Max Kellermann [Fri, 17 Mar 2017 21:43:28 +0000 (22:43 +0100)]
mpdclient: remove unused function compare_filelistentry_format()

7 years agomain: move mpd_glib_new() call to mpdclient.c
Max Kellermann [Fri, 17 Mar 2017 21:26:37 +0000 (22:26 +0100)]
main: move mpd_glib_new() call to mpdclient.c

7 years agocallbacks: rename functions
Max Kellermann [Fri, 17 Mar 2017 21:24:24 +0000 (22:24 +0100)]
callbacks: rename functions

7 years agoscreen_client: move functions to callbacks.c
Max Kellermann [Fri, 17 Mar 2017 21:14:11 +0000 (22:14 +0100)]
screen_client: move functions to callbacks.c

7 years agomain: remove redundant mpdclient_disconnect() call
Max Kellermann [Fri, 17 Mar 2017 21:41:16 +0000 (22:41 +0100)]
main: remove redundant mpdclient_disconnect() call

mpdclient_free() will do this implicitly.

7 years agomain: remove the "idle" fallback code
Max Kellermann [Fri, 17 Mar 2017 17:01:38 +0000 (18:01 +0100)]
main: remove the "idle" fallback code

ncmpc has been requiring MPD 0.14+ for 7 years (commit e25d7523), and
we really don't need the timer fallback.  "idle" just has to be
supported.

7 years agoconfigure.ac: remove redundant libmpdclient version test
Max Kellermann [Fri, 17 Mar 2017 16:00:55 +0000 (17:00 +0100)]
configure.ac: remove redundant libmpdclient version test

Obsoleted by 323d2239df7d8b6a3b8005f14c7e90b5271a77e9

7 years agoMakefile.am: merge ncmpc_headers into src_ncmpc_SOURCES
Max Kellermann [Fri, 17 Mar 2017 14:58:40 +0000 (15:58 +0100)]
Makefile.am: merge ncmpc_headers into src_ncmpc_SOURCES

7 years agoupdate copyright year
Max Kellermann [Fri, 17 Mar 2017 14:54:09 +0000 (15:54 +0100)]
update copyright year

7 years agomain: eliminate local dummy variable
Max Kellermann [Fri, 17 Mar 2017 14:47:52 +0000 (15:47 +0100)]
main: eliminate local dummy variable

7 years agocommand: fix swapped help texts
Max Kellermann [Sat, 11 Mar 2017 16:48:57 +0000 (17:48 +0100)]
command: fix swapped help texts

7 years agoscreen_song: show "dsd64" etc. shortcuts
Max Kellermann [Fri, 10 Mar 2017 20:50:20 +0000 (21:50 +0100)]
screen_song: show "dsd64" etc. shortcuts

7 years agoscreen_song: show "f" and "dsd" formats
Max Kellermann [Fri, 10 Mar 2017 20:48:52 +0000 (21:48 +0100)]
screen_song: show "f" and "dsd" formats

7 years agoscreen_song: move code to audio_format_to_string()
Max Kellermann [Fri, 10 Mar 2017 20:44:53 +0000 (21:44 +0100)]
screen_song: move code to audio_format_to_string()

7 years agoscreen_{find,search}: work around gcc7 -Wimplicit-fallthrough
Max Kellermann [Fri, 10 Mar 2017 20:41:02 +0000 (21:41 +0100)]
screen_{find,search}: work around gcc7 -Wimplicit-fallthrough

7 years agoCompiler.h: exclude clang from GCC_CHECK_VERSION()
Max Kellermann [Fri, 10 Mar 2017 20:39:42 +0000 (21:39 +0100)]
Compiler.h: exclude clang from GCC_CHECK_VERSION()

7 years agoCompiler.h: reimplement GCC_CHECK_VERSION() using GCC_MAKE_VERSION()
Max Kellermann [Fri, 10 Mar 2017 20:38:59 +0000 (21:38 +0100)]
Compiler.h: reimplement GCC_CHECK_VERSION() using GCC_MAKE_VERSION()

7 years agoCompiler.h: add macro CLANG_OR_GCC_VERSION()
Max Kellermann [Fri, 10 Mar 2017 20:34:28 +0000 (21:34 +0100)]
Compiler.h: add macro CLANG_OR_GCC_VERSION()

7 years agoCompiler.h: add macro GCC_OLDER_THAN()
Max Kellermann [Fri, 10 Mar 2017 20:36:23 +0000 (21:36 +0100)]
Compiler.h: add macro GCC_OLDER_THAN()

7 years agoCompiler.h: add macro CLANG_VERSION
Max Kellermann [Fri, 10 Mar 2017 20:33:54 +0000 (21:33 +0100)]
Compiler.h: add macro CLANG_VERSION

7 years agoCompiler.h: add macro GCC_MAKE_VERSION()
Max Kellermann [Fri, 10 Mar 2017 20:32:54 +0000 (21:32 +0100)]
Compiler.h: add macro GCC_MAKE_VERSION()

7 years agorequire libmpdclient 2.9, remove several #ifdefs
Max Kellermann [Fri, 10 Mar 2017 20:20:55 +0000 (21:20 +0100)]
require libmpdclient 2.9, remove several #ifdefs

7 years agolyrics: lyrics area regex fix for LyricWikia
Lazaros Koromilas [Thu, 10 Nov 2016 17:04:47 +0000 (18:04 +0100)]
lyrics: lyrics area regex fix for LyricWikia

8 years agoconfigure.ac: detect lirc 0.9.4
Gianfranco Costamagna [Fri, 28 Oct 2016 10:22:59 +0000 (12:22 +0200)]
configure.ac: detect lirc 0.9.4

8 years agoconfigure.ac: prepare for 0.26
Max Kellermann [Fri, 28 Oct 2016 10:23:28 +0000 (12:23 +0200)]
configure.ac: prepare for 0.26

8 years agorelease v0.25 v0.25
Max Kellermann [Thu, 18 Aug 2016 10:06:24 +0000 (12:06 +0200)]
release v0.25

8 years agostrfsong: implement "%disc%"
Max Kellermann [Thu, 18 Aug 2016 09:52:44 +0000 (11:52 +0200)]
strfsong: implement "%disc%"

https://bugs.musicpd.org/view.php?id=4479

8 years agom4/ax_*.m4: update from autoconf-archive 20150925-1
Max Kellermann [Thu, 18 Aug 2016 09:23:07 +0000 (11:23 +0200)]
m4/ax_*.m4: update from autoconf-archive 20150925-1

8 years agom4/pkg.m4: update from pkg-config 0.29
Max Kellermann [Thu, 18 Aug 2016 09:22:14 +0000 (11:22 +0200)]
m4/pkg.m4: update from pkg-config 0.29

8 years agom4/{nls,po,progtest}.m4: update from gettest 0.19.8.1
Max Kellermann [Thu, 18 Aug 2016 09:21:22 +0000 (11:21 +0200)]
m4/{nls,po,progtest}.m4: update from gettest 0.19.8.1

8 years agom4/glib-gettext.m4: update from GLib 2.48.1
Max Kellermann [Thu, 18 Aug 2016 09:18:52 +0000 (11:18 +0200)]
m4/glib-gettext.m4: update from GLib 2.48.1

Fixes "error: m4_copy: won't overwrite defined macro: glib_DEFUN".

8 years agolyrics: no extra XML tags in lyricbox anymore
Lazaros Koromilas [Sun, 12 Jun 2016 18:55:46 +0000 (20:55 +0200)]
lyrics: no extra XML tags in lyricbox anymore

8 years agolyrics: use open-uri to handle HTTP 301 redirection
Lazaros Koromilas [Sun, 12 Jun 2016 18:55:45 +0000 (20:55 +0200)]
lyrics: use open-uri to handle HTTP 301 redirection

9 years agolyrics: fixed XML tag removal on wikia.com
Guilherme Costa [Tue, 19 May 2015 17:33:53 +0000 (19:33 +0200)]
lyrics: fixed XML tag removal on wikia.com

9 years agoconfigure.ac: prepare for 0.25
Max Kellermann [Mon, 10 Aug 2015 11:48:49 +0000 (13:48 +0200)]
configure.ac: prepare for 0.25

10 years agorelease v0.24 v0.24
Max Kellermann [Mon, 14 Jul 2014 09:46:41 +0000 (11:46 +0200)]
release v0.24

10 years agom4: import ax_require_defined.m4 from autoconf-archive
Max Kellermann [Mon, 14 Jul 2014 09:51:56 +0000 (11:51 +0200)]
m4: import ax_require_defined.m4 from autoconf-archive

10 years agoscreen_song: draw bit rate in screen_song_update()
Max Kellermann [Mon, 2 Nov 2009 20:11:57 +0000 (21:11 +0100)]
screen_song: draw bit rate in screen_song_update()

Drawing the bit rate in screen_song_add_song() requires some redundant
checks.

10 years agomain: make variables more local
Max Kellermann [Mon, 14 Jul 2014 08:49:50 +0000 (10:49 +0200)]
main: make variables more local

10 years agoscreen_keydef: save keys to path specified by --key-file
Max Kellermann [Mon, 14 Jul 2014 09:24:27 +0000 (11:24 +0200)]
screen_keydef: save keys to path specified by --key-file

Implements Mantis ticket 0004022.

10 years agoconf: check_user_conf_dir() returns bool
Max Kellermann [Mon, 14 Jul 2014 09:24:42 +0000 (11:24 +0200)]
conf: check_user_conf_dir() returns bool