summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-11-13 19:43:13 +0100
committerGravatar waker <wakeroid@gmail.com>2011-11-13 19:43:13 +0100
commit1339842335c31661636409fbc71b232552a36644 (patch)
tree929e969bb5dfcbae94393a954e34f29a3484f047 /plugins
parent5c7e0dae227f8c2bf266a98031aa48de1490b12d (diff)
few API usage fixes in flac plugin
Diffstat (limited to 'plugins')
-rw-r--r--plugins/flac/flac.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c
index 7ba1046a..cac3f562 100644
--- a/plugins/flac/flac.c
+++ b/plugins/flac/flac.c
@@ -928,7 +928,7 @@ cflac_write_metadata (DB_playItem_t *it) {
DB_plugin_t **plugins = deadbeef->plug_get_list ();
for (int i = 0; plugins[i]; i++) {
DB_plugin_t *p = plugins[i];
- if (p->id && !strcmp (p->id, "artwork")) {
+ if (p->id && !strcmp (p->id, "artwork") && p->version_major == 1 && p->version_minor >= 1) {
coverart_plugin = (DB_artwork_plugin_t *)p;
break;
}
@@ -937,17 +937,20 @@ cflac_write_metadata (DB_playItem_t *it) {
if (coverart_plugin) {
deadbeef->pl_lock ();
- const char *album = deadbeef->pl_find_meta (it, "album");
- const char *artist = deadbeef->pl_find_meta (it, "artist");
- if (!album || !*album) {
- album = deadbeef->pl_find_meta (it, "title");
+ const char *alb = deadbeef->pl_find_meta (it, "album");
+ const char *art = deadbeef->pl_find_meta (it, "artist");
+ if (!alb || !*alb) {
+ alb = deadbeef->pl_find_meta (it, "title");
}
- const char *fname = deadbeef->pl_find_meta (it, ":URI");
+ const char *fn = deadbeef->pl_find_meta (it, ":URI");
+
+ char *album = alb ? strdupa (alb) : NULL;
+ char *artist = art ? strdupa (art) : NULL;
+ char *fname = fn ? strdupa (fn) : NULL;
deadbeef->pl_unlock ();
char *image_fname = coverart_plugin->get_album_art_sync (fname, artist, album, -1);
- //char *image_fname = coverart_plugin->get_album_art (fname, artist, album, -1, NULL, NULL);
- printf ("image_fname = %s\n",image_fname);
+
if (image_fname && strcmp (image_fname, coverart_plugin->get_default_cover())) {
// Read file
DB_FILE *fp = deadbeef->fopen (image_fname);