summaryrefslogtreecommitdiff
path: root/lib/rbcodec/metadata/ape.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/metadata/ape.c')
-rw-r--r--lib/rbcodec/metadata/ape.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/rbcodec/metadata/ape.c b/lib/rbcodec/metadata/ape.c
index 1460e4aa95..d6457eab63 100644
--- a/lib/rbcodec/metadata/ape.c
+++ b/lib/rbcodec/metadata/ape.c
@@ -124,7 +124,7 @@ bool read_ape_tags(int fd, struct mp3entry* id3)
124 return false; 124 return false;
125 } 125 }
126 126
127 if (!strcasecmp(name, "cuesheet")) 127 if (strcasecmp(name, "cuesheet") == 0)
128 { 128 {
129 id3->has_embedded_cuesheet = true; 129 id3->has_embedded_cuesheet = true;
130 id3->embedded_cuesheet.pos = lseek(fd, 0, SEEK_CUR)-item.length; 130 id3->embedded_cuesheet.pos = lseek(fd, 0, SEEK_CUR)-item.length;
@@ -152,17 +152,24 @@ bool read_ape_tags(int fd, struct mp3entry* id3)
152 } 152 }
153 153
154 /* Gather the album art format from the pseudo file name's ending. */ 154 /* Gather the album art format from the pseudo file name's ending. */
155 strcpy(name, name + strlen(name) - 4); 155 /* strcpy(name, name + strlen(name) - 4); */
156 id3->albumart.type = AA_TYPE_UNKNOWN; 156 id3->albumart.type = AA_TYPE_UNKNOWN;
157 if (strcasecmp(name, ".jpg") == 0) 157 char *ext = strrchr(name, '.');
158 if (ext)
158 { 159 {
159 id3->albumart.type = AA_TYPE_JPG; 160 if (strcasecmp(ext, ".jpg") == 0)
161 {
162 id3->albumart.type = AA_TYPE_JPG;
163 }
164 else if (strcasecmp(ext, ".jpeg") == 0)
165 {
166 id3->albumart.type = AA_TYPE_JPG;
167 }
168 else if (strcasecmp(ext, ".png") == 0)
169 {
170 id3->albumart.type = AA_TYPE_PNG;
171 }
160 } 172 }
161 else if (strcasecmp(name, ".png") == 0)
162 {
163 id3->albumart.type = AA_TYPE_PNG;
164 }
165
166 /* Set the album art size and position. */ 173 /* Set the album art size and position. */
167 if (id3->albumart.type != AA_TYPE_UNKNOWN) 174 if (id3->albumart.type != AA_TYPE_UNKNOWN)
168 { 175 {