You are not considering the case of a folder for each album?
in this case there was "something-like-a-standard" that use

dir/cover.jpg
dir/front.jpg

to use a single image for the whole album

Can we add this 2 new search path?

2015-11-21 10:16 GMT+01:00 Carsten Haitzler (Rasterman) <
[email protected]>:

> raster pushed a commit to branch master.
>
>
> http://git.enlightenment.org/apps/rage.git/commit/?id=1f6f9b084b83bf2587313c35f8812d485fd6b827
>
> commit 1f6f9b084b83bf2587313c35f8812d485fd6b827
> Author: Carsten Haitzler (Rasterman) <[email protected]>
> Date:   Sat Nov 21 18:16:41 2015 +0900
>
>     rage albumart - use image files in saame dir as media file if there
>
>     if you have
>
>     file.mp4
>
>     then this will use
>
>     file.mp4.png
>     file.mp4.jpg
>     file.mp3.jpeg
>
>     in that order (first found wins) in the same dir instead of googling
>     for an image. it will also try after the abover, in order:
>
>     file.png
>     file.jpg
>     file.jpeg
>     .file.mp4.png
>     .file.mp4.jpg
>     .file.mp4.jpeg
>     .file.png
>     .file.jpg
>     .file.jpeg
>     .thumb/file.mp4.png
>     .thumb/file.mp4.jpg
>     .thumb/file.mp3.jpeg
>     .thumb/file.png
>     .thumb/file.jpg
>     .thumb/file.jpeg
>
>     first one found wins. if none of these exist, then google shall be
>     consulted. :)
> ---
>  src/bin/albumart.c | 69
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 69 insertions(+)
>
> diff --git a/src/bin/albumart.c b/src/bin/albumart.c
> index 6331058..b5c7722 100644
> --- a/src/bin/albumart.c
> +++ b/src/bin/albumart.c
> @@ -315,5 +315,74 @@ albumart_find(const char *file,
>  char *
>  albumart_file_get(const char *file)
>  {
> +   char *tmp = alloca(strlen(file) + 1 + 100);
> +   char *dir, *fraw, *s;
> +   const char *fname;
> +
> +   sprintf(tmp, "%s.png", file);
> +   if (ecore_file_exists(tmp)) return strdup(tmp);
> +   sprintf(tmp, "%s.jpg", file);
> +   if (ecore_file_exists(tmp)) return strdup(tmp);
> +   sprintf(tmp, "%s.jpeg", file);
> +   if (ecore_file_exists(tmp)) return strdup(tmp);
> +
> +   dir = ecore_file_dir_get(file);
> +   if (!dir) dir = strdup(".");
> +   fname = ecore_file_file_get(file);
> +   if (!fname)
> +     {
> +        free(dir);
> +        return NULL;
> +     }
> +   fraw  = strdup(fname);
> +   if (!fraw)
> +     {
> +        free(dir);
> +        return NULL;
> +     }
> +   s = strrchr(fraw, '.');
> +   if (s) *s = 0;
> +
> +   sprintf(tmp, "%s/%s.png", dir, fraw);
> +   if (ecore_file_exists(tmp)) goto found;
> +   sprintf(tmp, "%s/%s.jpg", dir, fraw);
> +   if (ecore_file_exists(tmp)) goto found;
> +   sprintf(tmp, "%s/%s.jpeg", dir, fraw);
> +   if (ecore_file_exists(tmp)) goto found;
> +
> +   sprintf(tmp, "%s/.%s.png", dir, fname);
> +   if (ecore_file_exists(tmp)) goto found;
> +   sprintf(tmp, "%s/.%s.jpg", dir, fname);
> +   if (ecore_file_exists(tmp)) goto found;
> +   sprintf(tmp, "%s/.%s.jpeg", dir, fname);
> +   if (ecore_file_exists(tmp)) goto found;
> +
> +   sprintf(tmp, "%s/.%s.png", dir, fraw);
> +   if (ecore_file_exists(tmp)) goto found;
> +   sprintf(tmp, "%s/.%s.jpg", dir, fraw);
> +   if (ecore_file_exists(tmp)) goto found;
> +   sprintf(tmp, "%s/.%s.jpeg", dir, fraw);
> +   if (ecore_file_exists(tmp)) goto found;
> +
> +   sprintf(tmp, "%s/.thumb/%s.png", dir, fname);
> +   if (ecore_file_exists(tmp)) goto found;
> +   sprintf(tmp, "%s/.thumb/%s.jpg", dir, fname);
> +   if (ecore_file_exists(tmp)) goto found;
> +   sprintf(tmp, "%s/.thumb/%s.jpeg", dir, fname);
> +   if (ecore_file_exists(tmp)) goto found;
> +
> +   sprintf(tmp, "%s/.thumb/%s.png", dir, fraw);
> +   if (ecore_file_exists(tmp)) goto found;
> +   sprintf(tmp, "%s/.thumb/%s.jpg", dir, fraw);
> +   if (ecore_file_exists(tmp)) goto found;
> +   sprintf(tmp, "%s/.thumb/%s.jpeg", dir, fraw);
> +   if (ecore_file_exists(tmp)) goto found;
> +
> +   free(dir);
> +   free(fraw);
>     return _thumbpath(file);
> +found:
> +   free(dir);
> +   free(fraw);
> +   return strdup(tmp);
>  }
>
> --
>
>
>
------------------------------------------------------------------------------
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to