summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-03-07 14:08:40 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-03-07 14:09:03 +0100
commit543fa2dad59e31e1950a2c2588aa8bfec200f558 (patch)
tree267a487694c1f67b3ada33f79857a94ab24eb6cd
parentbdc480eea9c3d2564700ef65eade66017d533223 (diff)
few workarounds for corrupted covert-art files loading
-rw-r--r--plugins/artwork/artwork.c5
-rw-r--r--plugins/gtkui/coverart.c47
2 files changed, 30 insertions, 22 deletions
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c
index 6ef8a7d7..ed63b44f 100644
--- a/plugins/artwork/artwork.c
+++ b/plugins/artwork/artwork.c
@@ -318,15 +318,14 @@ fetcher_thread (void *none)
}
}
-
make_cache_path (path, sizeof (path), param->album, param->artist);
if (fetch_from_lastfm (param->artist, param->album, path)) {
trace ("art found on last.fm for %s %s\n", param->album, param->artist);
}
- /*else if (fetch_from_albumart_org (param->artist, param->album, path)) {
+ else if (fetch_from_albumart_org (param->artist, param->album, path)) {
trace ("art found on albumart.org for %s %s\n", param->album, param->artist);
- }*/
+ }
else {
trace ("art not found for %s %s\n", param->album, param->artist);
if (!copy_file (DEFAULT_COVER_PATH, path)) {
diff --git a/plugins/gtkui/coverart.c b/plugins/gtkui/coverart.c
index bc45ff60..4089e44d 100644
--- a/plugins/gtkui/coverart.c
+++ b/plugins/gtkui/coverart.c
@@ -126,27 +126,36 @@ loading_thread (void *none) {
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (queue->fname, NULL);
if (!pixbuf) {
trace ("GDK failed to load pixbuf from file %s\n", queue->fname);
+ // make default empty image
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 2, 2);
}
-
- int w, h;
- w = gdk_pixbuf_get_width (pixbuf);
- h = gdk_pixbuf_get_height (pixbuf);
- int width = queue->width;
- if (w != width) {
- int height;
- if (w > h) {
- height = width * h / w;
- }
- else if (h > w) {
- height = width;
- width = height * w / h;
- }
- else {
- height = width;
+ else {
+ int w, h;
+ w = gdk_pixbuf_get_width (pixbuf);
+ h = gdk_pixbuf_get_height (pixbuf);
+ int width = queue->width;
+ if (w != width) {
+ int height;
+ if (w > h) {
+ height = width * h / w;
+ }
+ else if (h > w) {
+ height = width;
+ width = height * w / h;
+ }
+ else {
+ height = width;
+ }
+ if (width < 5 || height < 5) {
+ trace ("will not scale to %dx%d\n", width, height);
+ queue_pop ();
+ continue;
+ }
+ trace ("scaling %dx%d -> %dx%d\n", w, h, width, height);
+ GdkPixbuf *scaled = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
+ g_object_unref (pixbuf);
+ pixbuf = scaled;
}
- GdkPixbuf *scaled = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
- g_object_unref (pixbuf);
- pixbuf = scaled;
}
if (cache[cache_min].pixbuf) {
g_object_unref (cache[cache_min].pixbuf);