diff options
author | waker <wakeroid@gmail.com> | 2010-10-20 22:04:31 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2010-10-20 22:04:31 +0200 |
commit | 47f411b6964dc2f0af7d0f35ac0016204f1d9e96 (patch) | |
tree | b32de71a60fa8961b67f76bb8a4510f9cac9d47c /plugins/artwork | |
parent | 4886787e05f757a602f077e436a9b6f8b929ae3d (diff) |
added portable build mode (--enable-portable configure option)
Diffstat (limited to 'plugins/artwork')
-rw-r--r-- | plugins/artwork/artwork.c | 35 | ||||
-rw-r--r-- | plugins/artwork/artwork.h | 1 |
2 files changed, 25 insertions, 11 deletions
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index fbbe71d9..469ec8bb 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -16,7 +16,7 @@ //#define trace(...) { fprintf(stderr, __VA_ARGS__); } #define trace(...) -#define DEFAULT_COVER_PATH (PREFIX "/share/deadbeef/pixmaps/noartwork.jpg") +static char default_cover[PATH_MAX]; #define DEFAULT_FILEMASK "*cover*.jpg;*front*.jpg" static DB_artwork_plugin_t plugin; @@ -41,12 +41,16 @@ static volatile int terminate; static volatile int clear_queue; static intptr_t tid; -int artwork_enable_embedded; -int artwork_enable_local; -int artwork_enable_lfm; -int artwork_enable_aao; -int artwork_reset_time; -char artwork_filemask[200]; +static int artwork_enable_embedded; +static int artwork_enable_local; +static int artwork_enable_lfm; +static int artwork_enable_aao; +static int artwork_reset_time; +static char artwork_filemask[200]; + +static const char *get_default_cover (void) { + return default_cover; +} void make_cache_dir_path (char *path, int size, const char *album, const char *artist) { @@ -568,11 +572,11 @@ get_album_art (const char *fname, const char *artist, const char *album, artwork if (!*artist || !*album) { //give up - return strdup (DEFAULT_COVER_PATH); + return strdup (get_default_cover ()); } if (!deadbeef->is_local_file (fname)) { - return strdup (DEFAULT_COVER_PATH); + return strdup (get_default_cover ()); } make_cache_path (path, sizeof (path), album, artist); @@ -586,7 +590,7 @@ get_album_art (const char *fname, const char *artist, const char *album, artwork trace ("reloading cached file %s\n", path); unlink (path); queue_add (fname, artist, album, callback, user_data); - return strdup (DEFAULT_COVER_PATH); + return strdup (get_default_cover ()); } trace ("found %s in cache\n", path); @@ -594,7 +598,7 @@ get_album_art (const char *fname, const char *artist, const char *album, artwork } queue_add (fname, artist, album, callback, user_data); - return strdup (DEFAULT_COVER_PATH); + return strdup (get_default_cover ()); } DB_plugin_t * @@ -664,6 +668,13 @@ artwork_on_configchanged (DB_event_t *ev, uintptr_t data) { static int artwork_plugin_start (void) { + const char *def_art = deadbeef->conf_get_str ("gtkui.nocover_pixmap", NULL); + if (!def_art) { + snprintf (default_cover, sizeof (default_cover), "%s/noartwork.jpg", deadbeef->get_pixmap_dir ()); + } + else { + strcpy (default_cover, def_art); + } terminate = 0; artwork_enable_embedded = deadbeef->conf_get_int ("artwork.enable_embedded", 1); @@ -720,6 +731,7 @@ static const char settings_dlg[] = "property \"Fetch from last.fm\" checkbox artwork.enable_lastfm 0;\n" "property \"Fetch from albumart.org\" checkbox artwork.enable_albumartorg 0;\n" ; + // define plugin interface static DB_artwork_plugin_t plugin = { .plugin.plugin.api_vmajor = DB_API_VERSION_MAJOR, @@ -736,4 +748,5 @@ static DB_artwork_plugin_t plugin = { .plugin.plugin.configdialog = settings_dlg, .get_album_art = get_album_art, .reset = artwork_reset, + .get_default_cover = get_default_cover, }; diff --git a/plugins/artwork/artwork.h b/plugins/artwork/artwork.h index ab0fead6..ed5357df 100644 --- a/plugins/artwork/artwork.h +++ b/plugins/artwork/artwork.h @@ -14,6 +14,7 @@ typedef struct { // this has to be called to clear queue on exit, before caller terminates // `fast=1' means "don't wait, just flush queue" void (*reset) (int fast); + const char *(*get_default_cover) (void); } DB_artwork_plugin_t; #endif /*__ARTWORK_H*/ |