use queue_version to refresh playlist, move playlist refreshing to empdd

This commit is contained in:
zmike 2014-02-06 00:54:54 -05:00
parent 17e5b36deb
commit cfcbf52afa
2 changed files with 11 additions and 1 deletions

View File

@ -286,7 +286,8 @@ empc_status(void *d EINA_UNUSED, int t EINA_UNUSED, Empd_Empc_Status_Data *ev)
empd_empc_current_song_call(empd_proxy);
up |= status_update(ev->state);
if (up) title_update();
if (empd_queue_length != ev->queue_length)
/* this should only run on startup...other updates are automatic */
if ((!empd_queue_length) && (empd_queue_length != ev->queue_length))
{
/* load current playlist incrementally (max 30):
* - don't block daemon forever with large playlists

View File

@ -108,6 +108,8 @@ static Eina_Mempool *slist_mempool = NULL;
static Eldbus_Connection *dbus_conn = NULL;
static Eldbus_Service_Interface *empd_iface = NULL;
static unsigned int empd_queue_version = 0;
static inline void
fdh_update(void)
{
@ -320,6 +322,13 @@ 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)))
{
mpd_async_send_command(empd->async, "playlistinfo", NULL);
cmd_append(EMPD_COMMAND_QUEUE_LIST);
fdh_update();
}
mpd_status_free(st);
}
}