Enlightenment CVS committal Author : moom16 Project : e17 Module : apps/eclair
Dir : e17/apps/eclair/src Modified Files: eclair.c eclair_cover.c eclair_media_file.c eclair_private.h Log Message: * Fix the transition between two covers * Handle HTTP response code * Fix some bugs =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/eclair/src/eclair.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- eclair.c 2 May 2005 16:06:50 -0000 1.6 +++ eclair.c 3 May 2005 08:57:36 -0000 1.7 @@ -174,18 +174,36 @@ else ecore_evas_title_set(eclair->video_window, "eclair"); } - eclair_cover_add_file_to_treat(&eclair->cover_manager, file, 1); + if (file) + eclair_gui_cover_set(eclair, file->cover_path); + else + eclair_gui_cover_set(eclair, NULL); } //Set the cover displayed on the GUI //Remove it if cover_path == NULL void eclair_gui_cover_set(Eclair *eclair, const char *cover_path) { + char *previous_path = NULL; + + printf("Cover: Set: %s\n", cover_path); + if (!eclair) return; if (!eclair->gui_object || !eclair->gui_cover) return; + evas_object_image_file_get(eclair->gui_cover, &previous_path, NULL); + if (!previous_path && !cover_path) + return; + if (previous_path && cover_path) + { + if (strcmp(previous_path, cover_path) == 0) + return; + } + + printf("Cover: Really Set: %s\n", cover_path); + if (eclair->gui_previous_cover) { Evas_Object *tmp; @@ -206,6 +224,11 @@ evas_object_image_file_set(eclair->gui_cover, cover_path, NULL); edje_object_signal_emit(eclair->gui_object, "signal_cover_set", "eclair_bin"); } + + evas_object_image_file_get(eclair->gui_cover, &previous_path, NULL); + printf("Cover: Cover: %s\n", previous_path); + evas_object_image_file_get(eclair->gui_previous_cover, &previous_path, NULL); + printf("Cover: Previous Cover: %s\n", previous_path); } //Set the scroll percent of the playlist container =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/eclair/src/eclair_cover.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- eclair_cover.c 2 May 2005 16:06:50 -0000 1.3 +++ eclair_cover.c 3 May 2005 08:57:36 -0000 1.4 @@ -110,8 +110,6 @@ Eclair_Cover_Manager *cover_manager = (Eclair_Cover_Manager *)param; Evas_List *l, *next; Eclair_Media_File *current_file; - char *cover_path; - struct hostent *he; if (!cover_manager) return NULL; @@ -120,14 +118,6 @@ for (;;) { pthread_cond_wait(&cover_manager->cover_cond, &cover_manager->cover_mutex); - if (!cover_manager->amazon_he) - { - if ((he = gethostbyname(amazon_hostname))) - { - cover_manager->amazon_he = (struct hostent *)malloc(sizeof(struct hostent)); - memcpy(cover_manager->amazon_he, he, sizeof(struct hostent)); - } - } while (cover_manager->cover_files_to_treat || cover_manager->cover_delete_thread) { for (l = cover_manager->cover_files_to_treat; l || cover_manager->cover_delete_thread; l = next) @@ -143,13 +133,12 @@ current_file = (Eclair_Media_File *)l->data; cover_manager->cover_files_to_treat = evas_list_remove_list(cover_manager->cover_files_to_treat, l); - cover_path = eclair_cover_file_get(cover_manager, current_file->artist, current_file->album, current_file->path); + current_file->cover_path = eclair_cover_file_get(cover_manager, current_file->artist, current_file->album, current_file->path); if (cover_manager->eclair) { if (current_file == evas_list_data(cover_manager->eclair->playlist.current)) - eclair_gui_cover_set(cover_manager->eclair, cover_path); + eclair_gui_cover_set(cover_manager->eclair, current_file->cover_path); } - free(cover_path); } } } @@ -233,6 +222,17 @@ return NULL; } + //Resolve amazone hostname + if (!cover_manager->amazon_he) + { + struct hostent *he; + if ((he = gethostbyname(amazon_hostname))) + { + cover_manager->amazon_he = (struct hostent *)malloc(sizeof(struct hostent)); + memcpy(cover_manager->amazon_he, he, sizeof(struct hostent)); + } + } + //Get the ASIN of the album keywords = (char *)malloc(strlen(artist) + strlen(album) + 2); sprintf(keywords, "%s %s", artist, album); @@ -508,13 +508,27 @@ static int _eclair_cover_extract_http_body(char *packet, int packet_length, char **body) { char *body_start; - int body_length; + int body_length, response_code, http_version; if (!packet || packet_length <= 0) return -1; + if (sscanf(packet, "HTTP/1.%d %d", &http_version, &response_code) != 2) + { + fprintf(stderr, "Cover: Invalid HTTP response\n"); + return -1; + } + if (response_code != 200) + { + fprintf(stderr, "Cover: Invalid response code: %d\n", response_code); + return -1; + } + if (!(body_start = strstr(packet, "\r\n\r\n"))) + { + fprintf(stderr, "Cover: Invalid HTTP response\n"); return -1; + } body_start += 4; *body = body_start; body_length = packet_length - (body_start - packet); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/eclair/src/eclair_media_file.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- eclair_media_file.c 2 May 2005 16:06:50 -0000 1.2 +++ eclair_media_file.c 3 May 2005 08:57:36 -0000 1.3 @@ -17,6 +17,7 @@ return; free(media_file->path); + free(media_file->cover_path); free(media_file->artist); free(media_file->title); free(media_file->album); @@ -61,6 +62,5 @@ if (media_file == evas_list_data(eclair->playlist.current)) eclair_current_file_set(eclair, media_file); - else - eclair_cover_add_file_to_treat(&eclair->cover_manager, media_file, 0); + eclair_cover_add_file_to_treat(&eclair->cover_manager, media_file, 0); } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/eclair/src/eclair_private.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- eclair_private.h 2 May 2005 16:06:50 -0000 1.5 +++ eclair_private.h 3 May 2005 08:57:36 -0000 1.6 @@ -51,6 +51,7 @@ struct _Eclair_Media_File { char *path; + char *cover_path; char *artist; char *title; char *album; ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs