Request and parse CSV format for theme list
This commit is contained in:
parent
d713a8c51b
commit
6e58ecff42
|
@ -61,10 +61,33 @@ static Eina_Bool
|
|||
_url_data_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Ecore_Con_Event_Url_Data *url_data = event_info;
|
||||
int i;
|
||||
char buf[1024];
|
||||
int i, p = 0;
|
||||
|
||||
for (i = 0; i < url_data->size; i++)
|
||||
printf("%c", url_data->data[i]);
|
||||
{
|
||||
if (url_data->data[i] == '\r' || url_data->data[i] == '\n')
|
||||
{
|
||||
if (p == 0)
|
||||
continue;
|
||||
|
||||
buf[p] = '\0';
|
||||
if (buf[0] == '"')
|
||||
{
|
||||
buf[p-1] = '\0';
|
||||
printf("THEME %s\n", buf+1);
|
||||
}
|
||||
else
|
||||
printf("THEME %s\n", buf);
|
||||
|
||||
p = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf[p] = url_data->data[i];
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -84,6 +107,7 @@ extra_library_call(void)
|
|||
Ecore_Con_Url *url;
|
||||
|
||||
url = ecore_con_url_custom_new("http://ajwilliams.pythonanywhere.com/v1/themes/", "GET");
|
||||
ecore_con_url_additional_header_add(url, "Accept", "text/csv");
|
||||
|
||||
ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _url_data_cb, NULL);
|
||||
ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _url_complete_cb, url);
|
||||
|
|
Loading…
Reference in New Issue