From 0ed1625063f33d2fb9b8bffe9b191a22de0526fa Mon Sep 17 00:00:00 2001 From: Andreas Obergrusberger Date: Thu, 1 Feb 2007 21:06:33 +0000 Subject: [PATCH] lyrics updates, leoslyrics fixes git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@5314 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- plugins/leoslyrics/lyrics_leoslyrics.c | 3 +-- src/lyrics_leoslyrics.c | 1 + src/main.c | 1 + src/screen_lyrics.c | 4 ++-- src/screen_search.c | 17 +++++------------ src/src_lyrics.c | 5 +++-- 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/plugins/leoslyrics/lyrics_leoslyrics.c b/plugins/leoslyrics/lyrics_leoslyrics.c index 47aabe1..a62e47f 100644 --- a/plugins/leoslyrics/lyrics_leoslyrics.c +++ b/plugins/leoslyrics/lyrics_leoslyrics.c @@ -82,6 +82,7 @@ static void fetch_text(void *userData, const XML_Char *s, int len) { if(result & 16) { + if (s[0] == 13 ) return; //ignore any single carriage returns add_text_line(&lyr_text, s, len); } } @@ -146,7 +147,6 @@ int get_lyr_leoslyrics(char *artist, char *title) return 0; } -#if SRC_LYR_LEOSLYRICS == plugin int register_me (src_lyr *source_descriptor) { source_descriptor->check_lyr = check_lyr_leoslyrics; @@ -155,4 +155,3 @@ int register_me (src_lyr *source_descriptor) source_descriptor->name = "Leoslyrics"; source_descriptor->description = "powered by http://www.leoslyrics.com"; } -#endif diff --git a/src/lyrics_leoslyrics.c b/src/lyrics_leoslyrics.c index f497376..3b85e68 100644 --- a/src/lyrics_leoslyrics.c +++ b/src/lyrics_leoslyrics.c @@ -82,6 +82,7 @@ static void fetch_text(void *userData, const XML_Char *s, int len) { if(result & 16) { + if (s[0] == 13 ) return; //ignore any single carriage returns add_text_line(&lyr_text, s, len); } } diff --git a/src/main.c b/src/main.c index 9348822..7849f8c 100644 --- a/src/main.c +++ b/src/main.c @@ -374,3 +374,4 @@ main(int argc, const char *argv[]) } exit(EXIT_FAILURE); } + diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 8d70e00..4260045 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -227,8 +227,8 @@ lyrics_title(char *str, size_t size) if(!(result & 1)) { g_string_append (msg, " - "); - if(!(result & 2)) g_string_append (msg, _("No connection")); - if(!(result & 4)) g_string_append (msg, _("Not found")); + if(!(result & 2)) g_string_append (msg, _("No access")); + else if(!(result & 4)) g_string_append (msg, _("Not found")); } } if(lock == 2) diff --git a/src/screen_search.c b/src/screen_search.c index 530883f..7fb559f 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -117,21 +117,14 @@ lw_search_help_callback(int index, int *highlight, void *data) { int text_rows; static char *text[] = { - "Welcome to ncmpc's search screen - SVN version.", - "", - "Quick search - just enter a string and ncmpc will search according", + "Quick - just enter a string and ncmpc will search according", " to the current search mode (displayed above).", "", - "Advanced - bla bla bla.... syntax below", - "" - " : [:...]", - "", - "Example: artist:radiohead album:pablo honey", - "", - "##### SOMEONE - Write a proper help text, please! #####", + "Advanced - : [:...]", + " Example: artist:radiohead album:pablo honey", "", - "avalible tags: artist, album, title, track, name, genre, date", - " composer, performer, comment, file", + " avalible tags: artist, album, title, track,", + " name, genre, date composer, performer, comment, file", "", NULL }; diff --git a/src/src_lyrics.c b/src/src_lyrics.c index 8ce9937..10d0dce 100644 --- a/src/src_lyrics.c +++ b/src/src_lyrics.c @@ -50,7 +50,7 @@ int get_text_line(formed_text *text, int num, char *dest, int len) memcpy(dest, &text->text->str[g_array_index(text->lines, int, num)], linelen*sizeof(char)); } - dest[linelen] = '\n'; + dest[linelen] = '\n'; dest[linelen+1] = '\0'; return 0; @@ -58,6 +58,7 @@ int get_text_line(formed_text *text, int num, char *dest, int len) void add_text_line(formed_text *dest, const char *src, int len) { + // need this because g_array_append_val doesnt work with literals // and expat sends "\n" as an extra line everytime if(len == 0) @@ -75,7 +76,7 @@ void add_text_line(formed_text *dest, const char *src, int len) if(dest->lines->len > 0) dest->val += g_array_index(dest->lines, int, dest->lines->len-1); } - else if (len == 1 && dest->val != 0) dest->val = 0; + else if (len < 6 && dest->val != 0) dest->val = 0; if(dest->val > 0) { -- 2.30.2