From f9c47fb5214c06256db799ab4f2a3f4d64056dfe Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 14 Nov 2015 00:02:22 +0900 Subject: [PATCH] rage - finish off improving browser --- src/bin/albumart.c | 7 ++----- src/bin/browser.c | 4 ++-- src/bin/thumb.c | 29 ++++++++++++++++++++++++----- src/bin/videothumb.c | 10 +++++++--- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/bin/albumart.c b/src/bin/albumart.c index e04abb2..6331058 100644 --- a/src/bin/albumart.c +++ b/src/bin/albumart.c @@ -117,9 +117,6 @@ _cb_http_complete(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { ecore_file_unlink(fetchpath); } - free(fetchpath); - fetchpath = NULL; - if (_fetch_done) _fetch_done(_fetch_data); } else { @@ -195,9 +192,9 @@ _cb_http_complete(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) fetchfile = NULL; } if (_fetch_done) _fetch_done(_fetch_data); + _fetch_done = NULL; + _fetch_data = NULL; } - _fetch_done = NULL; - _fetch_data = NULL; return EINA_FALSE; } diff --git a/src/bin/browser.c b/src/bin/browser.c index fbd22e3..07a2c79 100644 --- a/src/bin/browser.c +++ b/src/bin/browser.c @@ -58,8 +58,8 @@ _item_size_get(Evas_Object *win, Evas_Coord *w, Evas_Coord *h) elm_coords_finger_size_adjust(1, &sz, 1, &sz); evas_object_geometry_get(win, NULL, NULL, w, h); - *w = *w / 15; - *h = *h / 5; + *w = *w / 8; + *h = *h / 3; if (*w < sz) *w = sz; if (*h < sz) *h = sz; } diff --git a/src/bin/thumb.c b/src/bin/thumb.c index 630380b..0009e1f 100644 --- a/src/bin/thumb.c +++ b/src/bin/thumb.c @@ -17,6 +17,16 @@ static const char *file = NULL; static void _cb_fetched(void *data EINA_UNUSED) { + char *path = albumart_file_get(file); + if (path) + { + Evas_Object *im = evas_object_image_add(evas_object_evas_get(win)); + int w, h; + evas_object_image_file_set(im, path, NULL); + evas_object_image_size_get(im, &w, &h); + if ((w < 1) || (h < 0)) ecore_file_unlink(path); + free(path); + } elm_exit(); } @@ -25,6 +35,9 @@ _cb_loaded(void *data, Evas_Object *obj, void *info EINA_UNUSED) { const char *file, *title, *artist, *album; + if (vid_timeout) ecore_timer_del(vid_timeout); + vid_timeout = NULL; + file = data; title = emotion_object_meta_info_get(obj, EMOTION_META_INFO_TRACK_TITLE); artist = emotion_object_meta_info_get(obj, EMOTION_META_INFO_TRACK_ARTIST); @@ -49,7 +62,6 @@ _cb_loaded(void *data, Evas_Object *obj, void *info EINA_UNUSED) emotion_object_size_get(obj, &iw, &ih); if (ratio > 0.0) iw = (ih * ratio); else ratio = iw / ih; - printf("ratio: %1.3f len: %1.1f\n", ratio, len); if ((ratio >= (4.0 / 3.0)) && (ratio <= (3.0 / 1.0)) && (len >= (75.0 * 60.0)) && @@ -67,7 +79,7 @@ _cb_loaded(void *data, Evas_Object *obj, void *info EINA_UNUSED) { char buf_base[PATH_MAX]; char buf_file[PATH_MAX]; - unsigned int pos, incr; + unsigned int pos; vidimage = evas_object_image_filled_add(evas_object_evas_get(subwin)); evas_object_show(vidimage); @@ -100,7 +112,11 @@ _cb_loaded(void *data, Evas_Object *obj, void *info EINA_UNUSED) snprintf(key, sizeof(key), "%i", pos); evas_object_image_file_set(vidimage, file, key); evas_object_image_size_get(vidimage, &iw, &ih); - if ((iw <= 0) || (ih <= 0)) break; + if ((iw <= 0) || (ih <= 0)) + { + eet_close(ef); + exit(6); + } w = 160; h = (ih * 160) / iw; if (h < 1) h = 1; @@ -112,7 +128,10 @@ _cb_loaded(void *data, Evas_Object *obj, void *info EINA_UNUSED) eet_data_image_write(ef, key, pixels, w, h, 0, 0, 70, EET_IMAGE_JPEG); else - exit(6); + { + eet_close(ef); + exit(6); + } evas_object_image_data_set(image, pixels); } eet_close(ef); @@ -170,7 +189,7 @@ elm_main(int argc, char **argv) { evas_object_smart_callback_add(vid, "open_done", _cb_loaded, file); emotion_object_file_set(vid, file); - vid_timeout = ecore_timer_add(2.0, _cb_timeout, NULL); + vid_timeout = ecore_timer_add(20.0, _cb_timeout, NULL); elm_run(); } elm_shutdown(); diff --git a/src/bin/videothumb.c b/src/bin/videothumb.c index cc430c8..06db837 100644 --- a/src/bin/videothumb.c +++ b/src/bin/videothumb.c @@ -161,8 +161,9 @@ _cb_videothumb_delay(void *data) { Evas_Object *obj = data; Videothumb *sd = evas_object_smart_data_get(obj); + int maxnum = (eina_cpu_count() / 2) + 1; if (!sd) return EINA_FALSE; - if (_thumb_running < (eina_cpu_count() + 1)) + if (_thumb_running < maxnum) { sd->launch_timer = NULL; _videothumb_launch_do(obj); @@ -245,9 +246,12 @@ _videothumb_image_load(Evas_Object *obj) artfile = albumart_file_get(sd->realpath); if (artfile) { - sd->realfile = eina_stringshare_add(artfile); + if (ecore_file_exists(artfile)) + { + sd->realfile = eina_stringshare_add(artfile); + found = EINA_TRUE; + } free(artfile); - found = EINA_TRUE; } if (!found) {