|
|
xmms本来有好几个歌词插件
不过一个都不合心意
以前winamp的那个用的太顺手了
后来看到小锁兄弟写的xlyrics,还不错,用了有段时间了
不过有一些地方还是觉的不太爽
今天做了个补丁
两点改动:
一个是取消自动下载歌词,我从来都是去www.51lrc.com自己下载
一个是取消模糊匹配,至少歌词名字要一个字不差。本来模糊匹配的有点离谱,比如黄磊的年华似水,我没有这个歌词。可是有刘若英的年华,就找来放了。
- diff -urN xlyrics-0.4.1/src/find.c xlyrics-0.4.1_new/src/find.c
- --- xlyrics-0.4.1/src/find.c 2005-04-13 22:31:24.000000000 +0800
- +++ xlyrics-0.4.1_new/src/find.c 2005-09-09 01:51:24.000000000 +0800
- @@ -63,29 +63,23 @@
- else
- res = -1;
- }
- - else
- - {
- + else {
- tar = ps1;
- ps1 = extract_title(ps1);
- free(tar);
- tar = ps2;
- ps2 = extract_title(ps2);
- free(tar);
- - if(not_abs == 1)
- - {
- - if(strcmp(ps1, ps2) == 0)
- - res = 0;
- - else
- - res = -1;
- - }
- + if(strcmp(ps1, ps2) == 0)
- + res = 0;
- else
- - {
- - if(strstr(ps1, ps2) || strstr(ps2, ps1))
- - res = 0;
- - else
- - res = -1;
- - }
- + res = -1;
- }
- + /* added by zhllg@linuxsir
- + * In this program, whenever this function is called
- + * not_abs is either 1 or 0, no third situation
- + * so just an "else" is enough
- + */
- free(ps1);
- free(ps2);
- diff -urN xlyrics-0.4.1/src/lyrics.c xlyrics-0.4.1_new/src/lyrics.c
- --- xlyrics-0.4.1/src/lyrics.c 2005-09-09 01:27:59.000000000 +0800
- +++ xlyrics-0.4.1_new/src/lyrics.c 2005-09-09 01:43:49.000000000 +0800
- @@ -105,7 +105,7 @@
- struct Song *song;
- FILE *file;
- char buffer[255];
- - char *x;
- + char *ptr; /* modified by zhllg@linuxsir*/
- char *blank = "\t ";
- int line_n=0;
- @@ -117,27 +117,27 @@
- while (fgets(buffer, sizeof(buffer), file))
- {
- - if ((x = strchr(buffer, '\r')))/*if the file is windows format */
- - *x = '\0';
- - if ((x = strchr(buffer, '\n')))
- - *x = '\0';
- -
- - for(x = buffer; isblank(*x); x++) ;
- -
- - if ((x[0] == '[') && (isdigit(x[1])))
- + if ((ptr = strchr(buffer, '\r')))/*if the file is windows format */
- + *ptr = '\0';
- + if ((ptr = strchr(buffer, '\n')))
- + *ptr = '\0';
- +
- + ptr = buffer + strspn(buffer, blank);/* modified by zhllg@linuxsir*/
- +
- + if ((ptr[0] == '[') && (isdigit(ptr[1])))
- {
- - get_lyrics_line(x, song);
- + get_lyrics_line(ptr, song);
- }
- - else if ((x[0] == '[') && !(isdigit(x[1])))
- + else if ((ptr[0] == '[') && !(isdigit(ptr[1])))
- {
- - if ((x[1] == 'a') && (x[2] == 'r')) // artist
- - song->artist = strdup(&x[4]);
- - else if ((x[1] == 't') && (x[2] == 'i')) // title
- - song->title = strdup(&x[4]);
- - else if ((x[1] == 'a') && (x[2] == 'l')) // al
- - song->language = strdup(&x[4]);
- - else if ((x[1] == 'b') && (x[2] == 'y')) // author
- - song->author = strdup(&x[4]);
- + if ((ptr[1] == 'a') && (ptr[2] == 'r')) // artist
- + song->artist = strdup(&ptr[4]);
- + else if ((ptr[1] == 't') && (ptr[2] == 'i')) // title
- + song->title = strdup(&ptr[4]);
- + else if ((ptr[1] == 'a') && (ptr[2] == 'l')) // al
- + song->language = strdup(&ptr[4]);
- + else if ((ptr[1] == 'b') && (ptr[2] == 'y')) // author
- + song->author = strdup(&ptr[4]);
- }
- }
- /* set the line unmber needed by list.c*/
- diff -urN xlyrics-0.4.1/src/xlyrics.c xlyrics-0.4.1_new/src/xlyrics.c
- --- xlyrics-0.4.1/src/xlyrics.c 2005-04-17 17:04:30.000000000 +0800
- +++ xlyrics-0.4.1_new/src/xlyrics.c 2005-09-09 01:53:58.000000000 +0800
- @@ -638,8 +638,11 @@
- else if((lyricsfile = find_file_in_dir(lyrics_dir, playfile, i)))
- break;
- }
- +/* commented out by zhllg@linuxsir
- + * I personally prefer downloading lyrics manually
- + */
- - if(!lyricsfile && !is_downloading)
- +/* if(!lyricsfile && !is_downloading)
- {
- char *tmp, *ptr;
- tmp = (char*)strdup(playfile);
- @@ -651,6 +654,7 @@
- g_free(tmp);
- }else if(is_downloading)
- is_downloading = 0;
- +*/
- if(lyricsfile)
- add_item_to_cache(playfile, lyricsfile);
复制代码 |
|