summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6c4ec77)
raw | patch | inline | side by side (parent: 6c4ec77)
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Wed, 27 Jul 2011 18:58:18 +0000 (20:58 +0200) | ||
committer | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Tue, 9 Aug 2011 20:24:05 +0000 (22:24 +0200) |
This feature is disabled by default, because I guess that most users
won't want to use it.
won't want to use it.
doc/ncmpc.1 | patch | blob | history | |
src/conf.c | patch | blob | history | |
src/options.c | patch | blob | history | |
src/options.h | patch | blob | history | |
src/screen_lyrics.c | patch | blob | history |
diff --git a/doc/ncmpc.1 b/doc/ncmpc.1
index fe977638f8469db2cb4601245dfa4e790b85e5f6..7ad0c61dc8735d09c2485221db5ab62fdc7e4617 100644 (file)
--- a/doc/ncmpc.1
+++ b/doc/ncmpc.1
@@ -127,6 +127,9 @@ When using the jump command, search for the prefix of an entry. That means typin
.B lyrics\-autosave = yes|no
Automatically save lyrics after receiving them.
.TP
+.B lyrics\-show\-plugin = yes|no
+Show the name of the plugin used to receive lyrics on the lyrics screen.
+.TP
.B second-column = yes|no
Display song length in a second column.
.SS Display
diff --git a/src/conf.c b/src/conf.c
index a537663d161c7d72e7c7d822a4e34b7a9f885440..6c93e1e3a8692c53b0e17c7d13d4f7a5d816d81b 100644 (file)
--- a/src/conf.c
+++ b/src/conf.c
#define CONF_DISPLAY_TIME "display-time"
#define CONF_JUMP_PREFIX_ONLY "jump-prefix-only"
#define CONF_LYRICS_AUTOSAVE "lyrics-autosave"
+#define CONF_LYRICS_SHOW_PLUGIN "lyrics-show-plugin"
#define CONF_SECOND_COLUMN "second-column"
static bool
options.lyrics_autosave = str2bool(value);
#else
{}
+#endif
+ else if (!strcasecmp(CONF_LYRICS_SHOW_PLUGIN, name))
+#ifdef ENABLE_LYRICS_SCREEN
+ options.lyrics_show_plugin = str2bool(value);
+#else
+ {}
#endif
else if (!strcasecmp(CONF_SECOND_COLUMN, name))
#ifdef NCMPC_MINI
diff --git a/src/options.c b/src/options.c
index 2f21dc0837a31085a25b00c9a68cee5403dd44e2..398a0688f11a0feca4135507be7f23b107dacb05 100644 (file)
--- a/src/options.c
+++ b/src/options.c
#ifdef ENABLE_LYRICS_SCREEN
.lyrics_timeout = DEFAULT_LYRICS_TIMEOUT,
.lyrics_autosave = false,
+ .lyrics_show_plugin = false,
#endif
.find_wrap = true,
.scroll_offset = 0,
diff --git a/src/options.h b/src/options.h
index 920605f5ededac606f42cda6077e122fbcd00a29..b9bb0eed3d0a768348371ea493fdb3998241b675 100644 (file)
--- a/src/options.h
+++ b/src/options.h
#ifdef ENABLE_LYRICS_SCREEN
int lyrics_timeout;
bool lyrics_autosave;
+ bool lyrics_show_plugin;
#endif
bool find_wrap;
bool find_show_last_pattern;
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index 3dcddbfe5691a5cc07d0cac11d4cfbacee615445..ec723e9e2ee98e5820c9c6adaf3ccf907e5261d3 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
static struct {
struct mpd_song *song;
- char *artist, *title;
+ char *artist, *title, *plugin_name;
struct plugin_cycle *loader;
} current;
current.loader = NULL;
}
+ if (current.plugin_name != NULL) {
+ g_free(current.plugin_name);
+ current.plugin_name = NULL;
+ }
+
if (current.artist != NULL) {
g_free(current.artist);
current.artist = NULL;
static void
screen_lyrics_callback(const GString *result, const bool success,
- G_GNUC_UNUSED const char *plugin_name,
- G_GNUC_UNUSED void *data)
+ const char *plugin_name, G_GNUC_UNUSED void *data)
{
assert(current.loader != NULL);
+ current.plugin_name = g_strdup(plugin_name);
+
/* Display result, which may be lyrics or error messages */
if (result != NULL)
screen_lyrics_set(result);
return str;
} else if (current.artist != NULL && current.title != NULL &&
!screen_text_is_empty(&text)) {
- snprintf(str, size, "%s: %s - %s",
- _("Lyrics"),
- current.artist, current.title);
+ int n;
+ n = snprintf(str, size, "%s: %s - %s",
+ _("Lyrics"),
+ current.artist, current.title);
+ if (options.lyrics_show_plugin && current.plugin_name != NULL)
+ snprintf(str + n, size - n, " (%s)",
+ current.plugin_name);
return str;
} else
return _("Lyrics");