handle playlist updates better
This commit is contained in:
parent
721f2af500
commit
d84f7d5b09
|
@ -116,6 +116,7 @@ static Eina_Mempool *slist_mempool = NULL;
|
|||
static Eldbus_Connection *dbus_conn = NULL;
|
||||
static Eldbus_Service_Interface *empd_iface = NULL;
|
||||
|
||||
static Eina_Bool fetching_queue = EINA_FALSE;
|
||||
static unsigned int empd_queue_version = 0;
|
||||
|
||||
static inline void
|
||||
|
@ -296,6 +297,7 @@ fdh_func(void *d EINA_UNUSED, Ecore_Fd_Handler *fdh EINA_UNUSED)
|
|||
empd->pinger = ecore_poller_add(ECORE_POLLER_CORE, 8, pinger_cb, NULL);
|
||||
mpd_async_send_command(empd->async, "playlistinfo", NULL);
|
||||
cmd_append(EMPD_COMMAND_QUEUE_LIST);
|
||||
fetching_queue = EINA_TRUE;
|
||||
fdh_update();
|
||||
}
|
||||
break;
|
||||
|
@ -330,12 +332,17 @@ fdh_func(void *d EINA_UNUSED, Ecore_Fd_Handler *fdh EINA_UNUSED)
|
|||
mpd_status_get_total_time(st), mpd_status_get_elapsed_time(st), mpd_status_get_kbit_rate(st),
|
||||
af ? af->sample_rate : 0, af ? af->bits : 0, af ? af->channels : 0,
|
||||
mpd_status_get_next_song_pos(st), mpd_status_get_next_song_id(st));
|
||||
if (empd_queue_version && (empd_queue_version != mpd_status_get_queue_version(st)))
|
||||
if ((empd_queue_version && (empd_queue_version != mpd_status_get_queue_version(st))) ||
|
||||
(eina_array_count(empd->current_queue) != mpd_status_get_queue_length(st)))
|
||||
{
|
||||
if (!fetching_queue)
|
||||
{
|
||||
fetching_queue = EINA_TRUE;
|
||||
mpd_async_send_command(empd->async, "playlistinfo", NULL);
|
||||
cmd_append(EMPD_COMMAND_QUEUE_LIST);
|
||||
fdh_update();
|
||||
}
|
||||
}
|
||||
|
||||
mpd_status_free(st);
|
||||
}
|
||||
|
@ -638,6 +645,7 @@ _dbus_queue_list_cb(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eld
|
|||
int start, end;
|
||||
const char *sig;
|
||||
|
||||
if (fetching_queue) return eldbus_message_method_return_new(msg);
|
||||
sig = eldbus_message_signature_get(msg);
|
||||
if (sig && (!strcmp(sig, "ii")) && eldbus_message_arguments_get(msg, "ii", &start, &end))
|
||||
{
|
||||
|
@ -652,7 +660,10 @@ _dbus_queue_list_cb(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eld
|
|||
mpd_async_send_command(empd->async, "playlistinfo", s, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
mpd_async_send_command(empd->async, "playlistinfo", NULL);
|
||||
fetching_queue = EINA_TRUE;
|
||||
}
|
||||
cmd_append(EMPD_COMMAND_QUEUE_LIST);
|
||||
fdh_update();
|
||||
return eldbus_message_method_return_new(msg);
|
||||
|
|
Loading…
Reference in New Issue