summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-02-17 18:42:17 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-02-17 18:42:17 +0000
commitab549eb064636c9f0def41c237b5c45a55ca31ea (patch)
treee7aeef8579ada4fa349df2618fbf69094fc22e6d
parentb05552c4f1e9ac355d8fc86d8e2f3130f003a3ca (diff)
parameterize cover images and add capital start of word versions
-rw-r--r--src/bin/albumart.c53
1 files changed, 22 insertions, 31 deletions
diff --git a/src/bin/albumart.c b/src/bin/albumart.c
index dc62a7f..3deaccb 100644
--- a/src/bin/albumart.c
+++ b/src/bin/albumart.c
@@ -350,9 +350,22 @@ albumart_file_get(const char *file)
350{ 350{
351 char *tmp = alloca(strlen(file) + 1 + 100); 351 char *tmp = alloca(strlen(file) + 1 + 100);
352 char *dir, *fraw, *s; 352 char *dir, *fraw, *s;
353 const char *fname, *e; 353 const char *fname, *e, *c;
354 const char *ext[] = { "png", "PNG", "jpg", "JPG", "jpeg", "JPEG", "jpe", "JPE", NULL }; 354 const char *ext[] = {
355 int i; 355 "png", "PNG",
356 "jpg", "JPG",
357 "jpeg", "JPEG",
358 "jpe", "JPE",
359 NULL };
360 const char *cover[] = {
361 "cover", "Cover", "COVER",
362 "front", "Front", "FRONT",
363 "folder", "Folder", "FOLDER",
364 ".cover", ".Cover", ".COVER",
365 ".front", ".Front", ".FRONT",
366 ".folder", ".Folder", ".FOLDER",
367 NULL };
368 int i, j;
356 369
357 for (i = 0; (e = ext[i]) && e; i++) 370 for (i = 0; (e = ext[i]) && e; i++)
358 { 371 {
@@ -403,35 +416,13 @@ albumart_file_get(const char *file)
403 if (ecore_file_exists(tmp)) goto found; 416 if (ecore_file_exists(tmp)) goto found;
404 } 417 }
405 418
406 for (i = 0; (e = ext[i]) && e; i++) 419 for (j = 0; (c = cover[j]) && c; j++)
407 {
408 sprintf(tmp, "%s/cover.%s", dir, e);
409 if (ecore_file_exists(tmp)) goto found;
410 }
411 for (i = 0; (e = ext[i]) && e; i++)
412 {
413 sprintf(tmp, "%s/front.%s", dir, e);
414 if (ecore_file_exists(tmp)) goto found;
415 }
416 for (i = 0; (e = ext[i]) && e; i++)
417 {
418 sprintf(tmp, "%s/folder.%s", dir, e);
419 if (ecore_file_exists(tmp)) goto found;
420 }
421 for (i = 0; (e = ext[i]) && e; i++)
422 {
423 sprintf(tmp, "%s/.cover.%s", dir, e);
424 if (ecore_file_exists(tmp)) goto found;
425 }
426 for (i = 0; (e = ext[i]) && e; i++)
427 {
428 sprintf(tmp, "%s/.front.%s", dir, e);
429 if (ecore_file_exists(tmp)) goto found;
430 }
431 for (i = 0; (e = ext[i]) && e; i++)
432 { 420 {
433 sprintf(tmp, "%s/.folder.%s", dir, e); 421 for (i = 0; (e = ext[i]) && e; i++)
434 if (ecore_file_exists(tmp)) goto found; 422 {
423 sprintf(tmp, "%s/%s.%s", dir, c, e);
424 if (ecore_file_exists(tmp)) goto found;
425 }
435 } 426 }
436 427
437 free(dir); 428 free(dir);