From ad384162bb0cbe366c91a1f1bf30c61a79a815d5 Mon Sep 17 00:00:00 2001 From: waker Date: Sat, 26 Feb 2011 21:28:14 +0100 Subject: artwork: added option to proportionally scale towards bigger side of an image notify: customizable icon/artwork size --- plugins/artwork/artwork.c | 23 ++++++++++++++++++----- plugins/notify/notify.c | 3 ++- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index 713ba76e..aadd6a98 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -189,13 +189,25 @@ copy_file (const char *in, const char *out, int img_size) { int w = imlib_image_get_width (); int h = imlib_image_get_height (); int sw, sh; - if (w < h) { - sh = img_size; - sw = img_size * w / h; + if (deadbeef->conf_get_int ("artwork.scale_towards_longer", 1)) { + if (w > h) { + sh = img_size; + sw = img_size * w / h; + } + else { + sw = img_size; + sh = img_size * h / w; + } } else { - sw = img_size; - sh = img_size * h / w; + if (w < h) { + sh = img_size; + sw = img_size * w / h; + } + else { + sw = img_size; + sh = img_size * h / w; + } } Imlib_Image scaled = imlib_create_image (sw, sh); imlib_context_set_image (scaled); @@ -799,6 +811,7 @@ static const char settings_dlg[] = "property \"Local cover file mask\" entry artwork.filemask \"" DEFAULT_FILEMASK "\";\n" "property \"Fetch from last.fm\" checkbox artwork.enable_lastfm 0;\n" "property \"Fetch from albumart.org\" checkbox artwork.enable_albumartorg 0;\n" + "property \"Scale artwork towards longer side\" checkbox artwork.scale_towards_longer 1;\n" ; // define plugin interface diff --git a/plugins/notify/notify.c b/plugins/notify/notify.c index 193f6bef..7d2ba5bb 100644 --- a/plugins/notify/notify.c +++ b/plugins/notify/notify.c @@ -195,7 +195,7 @@ static void show_notification (DB_playItem_t *track) { if (deadbeef->conf_get_int("notify.albumart", 0) && artwork_plugin) { const char *album = deadbeef->pl_find_meta (track, "album"); const char *artist = deadbeef->pl_find_meta (track, "artist"); - v_iconname = artwork_plugin->get_album_art (track->fname, artist, album, 48, cover_avail_callback, NULL); + v_iconname = artwork_plugin->get_album_art (track->fname, artist, album, deadbeef->conf_get_int ("notify.albumart_size", 64), cover_avail_callback, NULL); } if (!v_iconname) { v_iconname = strdup ("deadbeef"); @@ -275,6 +275,7 @@ static const char settings_dlg[] = "property \"Notification title format\" entry notify.format \"" NOTIFY_DEFAULT_TITLE "\";\n" "property \"Notification content format\" entry notify.format_content \"" NOTIFY_DEFAULT_CONTENT "\";\n" "property \"Show album art\" checkbox notify.albumart 1;\n" + "property \"Album art size (px)\" entry notify.albumart_size 64;\n" ; DB_misc_t plugin = { -- cgit v1.2.3