improve db update signal detection
This commit is contained in:
parent
d7210a064e
commit
e18782f2aa
|
@ -155,6 +155,7 @@ static Eldbus_Service_Interface *empd_iface = NULL;
|
|||
static Eina_Bool fetching_queue = EINA_FALSE;
|
||||
static unsigned int empd_queue_version = 0;
|
||||
static int empd_songid = -1;
|
||||
static int empd_dbupdate = 0;
|
||||
|
||||
static inline void
|
||||
fdh_update(void)
|
||||
|
@ -256,6 +257,9 @@ conn_reset(void)
|
|||
{
|
||||
if (empd->connected)
|
||||
eldbus_service_signal_emit(empd_iface, EMPD_SIGNAL_DISCONNECTED);
|
||||
empd_queue_version = 0;
|
||||
empd_songid = -1;
|
||||
empd_dbupdate = 0;
|
||||
empd->connected = 0;
|
||||
ecore_con_server_del(empd->svr);
|
||||
empd->svr = NULL;
|
||||
|
@ -473,6 +477,7 @@ fdh_func(void *d EINA_UNUSED, Ecore_Fd_Handler *fdh EINA_UNUSED)
|
|||
{
|
||||
case MPD_IDLE_DATABASE:
|
||||
eldbus_service_signal_emit(empd_iface, EMPD_SIGNAL_DATABASE_UPDATE);
|
||||
empd_dbupdate = 0;
|
||||
break;
|
||||
case MPD_IDLE_QUEUE:
|
||||
if (!empd->pinger)
|
||||
|
@ -508,6 +513,7 @@ fdh_func(void *d EINA_UNUSED, Ecore_Fd_Handler *fdh EINA_UNUSED)
|
|||
else if (res == MPD_PARSER_SUCCESS)
|
||||
{
|
||||
const struct mpd_audio_format *af = mpd_status_get_audio_format(st);
|
||||
int update;
|
||||
|
||||
if (!empd->connected)
|
||||
{
|
||||
|
@ -523,13 +529,17 @@ fdh_func(void *d EINA_UNUSED, Ecore_Fd_Handler *fdh EINA_UNUSED)
|
|||
mpd_async_send_command(empd->async, "currentsong", NULL);
|
||||
}
|
||||
empd_songid = mpd_status_get_song_id(st);
|
||||
update = mpd_status_get_update_id(st);
|
||||
if (empd_dbupdate && (!update))
|
||||
eldbus_service_signal_emit(empd_iface, EMPD_SIGNAL_DATABASE_UPDATE);
|
||||
empd_dbupdate = update;
|
||||
eldbus_service_signal_emit(empd_iface, EMPD_SIGNAL_STATUS,
|
||||
mpd_status_get_volume(st), mpd_status_get_repeat(st), mpd_status_get_random(st),
|
||||
mpd_status_get_single(st), mpd_status_get_consume(st), mpd_status_get_queue_version(st), mpd_status_get_queue_length(st),
|
||||
mpd_status_get_mixrampdb(st), mpd_status_get_state(st), mpd_status_get_song_pos(st), mpd_status_get_song_id(st),
|
||||
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), mpd_status_get_update_id(st));
|
||||
mpd_status_get_next_song_pos(st), mpd_status_get_next_song_id(st), empd_dbupdate);
|
||||
if (((!empd->current_queue) && (!mpd_status_get_queue_length(st))) ||
|
||||
((!empd_queue_version) && empd->current_queue &&
|
||||
(eina_array_count(empd->current_queue) == mpd_status_get_queue_length(st))))
|
||||
|
|
Loading…
Reference in New Issue