diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-05-31 02:21:06 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-05-31 02:21:06 +0000 |
commit | 97fe75a0bf4ce5a0769a7509f758eda3f52fd6b3 (patch) | |
tree | edf2f869cbd4e8b0bd728b6162ae4c2b61700f7a /src/inputPlugins/ogg_plugin.c | |
parent | 30424cb3e9cf500165621802f65d552218e080f3 (diff) | |
download | mpd-97fe75a0bf4ce5a0769a7509f758eda3f52fd6b3.tar.gz mpd-97fe75a0bf4ce5a0769a7509f758eda3f52fd6b3.tar.xz mpd-97fe75a0bf4ce5a0769a7509f758eda3f52fd6b3.zip |
little cleanup of plugin stuff
git-svn-id: https://svn.musicpd.org/mpd/trunk@1247 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/inputPlugins/ogg_plugin.c')
-rw-r--r-- | src/inputPlugins/ogg_plugin.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/src/inputPlugins/ogg_plugin.c b/src/inputPlugins/ogg_plugin.c index 4f44af4c2..4f49f286b 100644 --- a/src/inputPlugins/ogg_plugin.c +++ b/src/inputPlugins/ogg_plugin.c @@ -108,7 +108,9 @@ long ogg_tell_cb(void * vdata) { char * ogg_parseComment(char * comment, char * needle) { int len = strlen(needle); - if(strncasecmp(comment,needle,len)) return comment+len; + if(strncasecmp(comment, needle, len) == 0 && *(comment+len) == '=') { + return comment+len+1; + } return NULL; } @@ -274,16 +276,14 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) return 0; } -MpdTag * oggTagDup(char * utf8file) { +MpdTag * oggTagDup(char * file) { MpdTag * ret = NULL; FILE * fp; OggVorbis_File vf; char ** comments; char * temp; - char * s1; - char * s2; - fp = fopen(rmp2amp(utf8ToFsCharset(utf8file)),"r"); + fp = fopen(file,"r"); if(!fp) return NULL; if(ov_open(fp,&vf,NULL,0)<0) { fclose(fp); @@ -296,33 +296,28 @@ MpdTag * oggTagDup(char * utf8file) { comments = ov_comment(&vf,-1)->user_comments; while(*comments) { - temp = strdup(*comments); - ++comments; - if(!(s1 = strtok(temp,"="))) continue; - s2 = strtok(NULL,""); - if(!s1 || !s2); - else if(0==strcasecmp(s1,"artist")) { + if((temp = ogg_parseComment(*comments,"artist"))) { if(!ret->artist) { - stripReturnChar(s2); - ret->artist = strdup(s2); + ret->artist = strdup(temp); + stripReturnChar(ret->artist); } - } - else if(0==strcasecmp(s1,"title")) { + } + else if((temp = ogg_parseComment(*comments,"title"))) { if(!ret->title) { - stripReturnChar(s2); - ret->title = strdup(s2); + ret->title = strdup(temp); + stripReturnChar(ret->title); } } - else if(0==strcasecmp(s1,"album")) { + else if((temp = ogg_parseComment(*comments,"album"))) { if(!ret->album) { - stripReturnChar(s2); - ret->album = strdup(s2); + ret->album = strdup(temp); + stripReturnChar(ret->album); } } - else if(0==strcasecmp(s1,"tracknumber")) { + else if((temp = ogg_parseComment(*comments,"tracknumber"))) { if(!ret->track) { - stripReturnChar(s2); - ret->track = strdup(s2); + ret->track = strdup(temp); + stripReturnChar(ret->track); } } free(temp); @@ -330,8 +325,6 @@ MpdTag * oggTagDup(char * utf8file) { ov_clear(&vf); - if(ret) validateUtf8Tag(ret); - return ret; } |