parent
ee668f017f
commit
ccdd427b9f
|
@ -192,14 +192,15 @@ _url_data_free(Url_Data *dd)
|
||||||
E_FREE(dd);
|
E_FREE(dd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
_url_data_send(Url_Data *dd, const char *url)
|
_url_data_send(Url_Data *dd, const char *url)
|
||||||
{
|
{
|
||||||
E_FREE(dd->data);
|
E_FREE(dd->data);
|
||||||
dd->size = 0;
|
dd->size = 0;
|
||||||
|
|
||||||
ecore_con_url_url_set(dd->con_url, url);
|
ecore_con_url_url_set(dd->con_url, url);
|
||||||
ecore_con_url_send(dd->con_url, NULL, 0, NULL);
|
|
||||||
|
return ecore_con_url_send(dd->con_url, NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -514,6 +515,7 @@ _send_request(void *data)
|
||||||
Plugin *p = data;
|
Plugin *p = data;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *query;
|
char *query;
|
||||||
|
int active;
|
||||||
|
|
||||||
query = evry_util_url_escape(p->input, 0);
|
query = evry_util_url_escape(p->input, 0);
|
||||||
|
|
||||||
|
@ -522,14 +524,14 @@ _send_request(void *data)
|
||||||
else
|
else
|
||||||
snprintf(buf, sizeof(buf), p->request, _conf->lang, query);
|
snprintf(buf, sizeof(buf), p->request, _conf->lang, query);
|
||||||
|
|
||||||
printf("send request %s\n", buf);
|
/* printf("send request %s\n", buf); */
|
||||||
|
|
||||||
_url_data_send(p->dd, buf);
|
active = _url_data_send(p->dd, buf);
|
||||||
|
|
||||||
free(query);
|
free(query);
|
||||||
p->timer = NULL;
|
p->timer = NULL;
|
||||||
|
|
||||||
return 0;
|
return !active;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -777,7 +779,7 @@ _youtube_dl_data_cb(Url_Data *dd)
|
||||||
|
|
||||||
if (!t || !video_id)
|
if (!t || !video_id)
|
||||||
{
|
{
|
||||||
printf("parse failed\n");
|
ERR("parse failed\n");
|
||||||
_json_data_free(rsp);
|
_json_data_free(rsp);
|
||||||
_url_data_free(dd);
|
_url_data_free(dd);
|
||||||
|
|
||||||
|
@ -795,14 +797,11 @@ _youtube_dl_data_cb(Url_Data *dd)
|
||||||
|
|
||||||
if (yd->method == 3)
|
if (yd->method == 3)
|
||||||
{
|
{
|
||||||
printf("play %s\n", url);
|
|
||||||
snprintf(buf, sizeof(buf), "mplayer %s", url);
|
snprintf(buf, sizeof(buf), "mplayer %s", url);
|
||||||
exe = ecore_exe_run(buf, NULL);
|
exe = ecore_exe_run(buf, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("download %s\n", url);
|
|
||||||
|
|
||||||
snprintf(fifo, sizeof(fifo), "/tmp/convert-%f", ecore_time_get());
|
snprintf(fifo, sizeof(fifo), "/tmp/convert-%f", ecore_time_get());
|
||||||
mkfifo(fifo, 0666);
|
mkfifo(fifo, 0666);
|
||||||
|
|
||||||
|
@ -850,8 +849,6 @@ _youtube_dl_action(Evry_Action *act)
|
||||||
|
|
||||||
file = act->it1.item->label;
|
file = act->it1.item->label;
|
||||||
|
|
||||||
printf("file %s\n", file);
|
|
||||||
|
|
||||||
snprintf(path, sizeof(path), "%s/Download/%s.mp3",
|
snprintf(path, sizeof(path), "%s/Download/%s.mp3",
|
||||||
e_user_homedir_get(), file);
|
e_user_homedir_get(), file);
|
||||||
|
|
||||||
|
@ -875,8 +872,6 @@ _youtube_dl_action(Evry_Action *act)
|
||||||
yd->dd = _url_data_new(yd, _youtube_dl_data_cb, NULL, NULL);
|
yd->dd = _url_data_new(yd, _youtube_dl_data_cb, NULL, NULL);
|
||||||
_url_data_send(yd->dd, wl->url);
|
_url_data_send(yd->dd, wl->url);
|
||||||
|
|
||||||
printf("send %s\n", wl->url);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue