This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch main
in repository eradio.

View the commit online.

commit 1078d5166ce54d17b07fbadbf123c294a2939678
Author: politebot <[email protected]>
AuthorDate: Sun Oct 12 06:56:45 2025 -0500

    Station icon fixes
---
 src/http.c         | 59 ++++++++++++++++++++++++++++++++++++------------------
 src/station_list.c | 22 ++++++++++++++++++--
 2 files changed, 59 insertions(+), 22 deletions(-)

diff --git a/src/http.c b/src/http.c
index 5b7d676..dc0dd33 100644
--- a/src/http.c
+++ b/src/http.c
@@ -191,33 +191,52 @@ _handle_icon_complete(Ecore_Con_Event_Url_Complete *ev)
 {
     Icon_Download_Context *icon_ctx = ecore_con_url_data_get(ev->url_con);
 
-    if (icon_ctx && icon_ctx->image_data)
+    if (icon_ctx && icon_ctx->image_data && ev->status == 200)
     {
-        Elm_Object_Item *it = icon_ctx->list_item;
-        Station *st = elm_object_item_data_get(it);
-        Evas_Object *icon = elm_object_item_part_content_get(it, "start");
-        const char *ext = strrchr(ecore_con_url_url_get(ev->url_con), '.');
-        if (ext) ext++;
+        const Eina_List *headers;
+        const char *content_type = NULL;
+        void *header_data;
 
-        if (st && st->stationuuid)
+        headers = ecore_con_url_response_headers_get(ev->url_con);
+        EINA_LIST_FOREACH(headers, headers, header_data)
         {
-            char cache_dir[PATH_MAX];
-            const char *home = getenv("HOME");
-            snprintf(cache_dir, sizeof(cache_dir), "%s/.cache/eradio/favicons", home);
-            ecore_file_mkpath(cache_dir);
-
-            char cache_path[PATH_MAX];
-            snprintf(cache_path, sizeof(cache_path), "%s/%s", cache_dir, st->stationuuid);
-
-            FILE *f = fopen(cache_path, "wb");
-            if (f)
+            const char *header_line = header_data;
+            if (strncasecmp(header_line, "Content-Type:", 13) == 0)
             {
-                fwrite(eina_binbuf_string_get(icon_ctx->image_data), 1, eina_binbuf_length_get(icon_ctx->image_data), f);
-                fclose(f);
+                content_type = header_line + 13;
+                while (*content_type == ' ') content_type++;
+                break;
             }
         }
 
-        elm_image_memfile_set(icon, eina_binbuf_string_get(icon_ctx->image_data), eina_binbuf_length_get(icon_ctx->image_data), (char *)ext, NULL);
+        if (content_type && strncasecmp(content_type, "image/", 6) == 0)
+        {
+            Elm_Object_Item *it = icon_ctx->list_item;
+            Station *st = elm_object_item_data_get(it);
+            Evas_Object *icon = elm_object_item_part_content_get(it, "start");
+            const char *ext = strrchr(ecore_con_url_url_get(ev->url_con), '.');
+            if (ext) ext++;
+
+            if (st && st->stationuuid)
+            {
+                char cache_dir[PATH_MAX];
+                const char *home = getenv("HOME");
+                snprintf(cache_dir, sizeof(cache_dir), "%s/.cache/eradio/favicons", home);
+                ecore_file_mkpath(cache_dir);
+
+                char cache_path[PATH_MAX];
+                snprintf(cache_path, sizeof(cache_path), "%s/%s", cache_dir, st->stationuuid);
+
+                FILE *f = fopen(cache_path, "wb");
+                if (f)
+                {
+                    fwrite(eina_binbuf_string_get(icon_ctx->image_data), 1, eina_binbuf_length_get(icon_ctx->image_data), f);
+                    fclose(f);
+                }
+            }
+
+            elm_image_memfile_set(icon, eina_binbuf_string_get(icon_ctx->image_data), eina_binbuf_length_get(icon_ctx->image_data), (char *)ext, NULL);
+        }
     }
 
     if (icon_ctx)
diff --git a/src/station_list.c b/src/station_list.c
index b19949d..40aaf89 100644
--- a/src/station_list.c
+++ b/src/station_list.c
@@ -60,7 +60,8 @@ station_list_populate(AppData *ad, Eina_Bool new_search)
         if (i >= 100) break;
 
         Evas_Object *icon = elm_icon_add(ad->win);
-        elm_icon_standard_set(icon, "radio");
+        elm_icon_standard_set(icon, "media-playback-start");
+	
         Evas_Object *fav_btn = NULL;
         if (ad->view_mode == VIEW_SEARCH)
           {
@@ -192,8 +193,17 @@ station_list_populate_favorites(AppData *ad)
 
     EINA_LIST_FOREACH(ad->favorites_stations, l, st)
     {
+      
+        Evas_Object *icon_box = elm_box_add(ad->win);
+        elm_box_horizontal_set(icon_box, EINA_TRUE);
+        evas_object_size_hint_min_set(icon_box, 64, 64);
+
         Evas_Object *icon = elm_icon_add(ad->win);
-        elm_icon_standard_set(icon, "radio");
+        evas_object_size_hint_min_set(icon, 64, 64);
+        elm_icon_standard_set(icon, "media-playback-start");
+        elm_box_pack_end(icon_box, icon);
+        evas_object_show(icon);
+
         Evas_Object *fav_btn = elm_button_add(ad->win);
         evas_object_size_hint_min_set(fav_btn, 60, 30);
         evas_object_propagate_events_set(fav_btn, EINA_FALSE);
@@ -212,6 +222,7 @@ station_list_populate_favorites(AppData *ad)
         ctx->li = li;
         evas_object_smart_callback_add(fav_btn, "clicked", _favorite_remove_btn_clicked_cb, ctx);
 
+        fprintf(stderr, "ICON: Station: %s, Favicon URL: %s\n", st->name, st->favicon);
         if (st->favicon && st->favicon[0] && st->stationuuid)
         {
             char cache_path[PATH_MAX];
@@ -220,13 +231,20 @@ station_list_populate_favorites(AppData *ad)
 
             if (ecore_file_exists(cache_path))
             {
+                fprintf(stderr, "ICON: Using cached icon for %s: %s\n", st->name, cache_path);
                 elm_image_file_set(icon, cache_path, NULL);
             }
             else
             {
+                fprintf(stderr, "ICON: Downloading icon for %s from %s\n", st->name, st->favicon);
+                elm_icon_standard_set(icon, "emblem-unreadable");
                 http_download_icon(ad, li, st->favicon);
             }
         }
+        else
+        {
+            fprintf(stderr, "ICON: No favicon for %s\n", st->name);
+        }
     }
     evas_object_smart_callback_add(ad->list, "selected", _list_item_selected_cb, ad);
     elm_list_go(ad->list);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to