1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-13 11:15:27 +00:00

Fix xmms2 stream updating (sf.net #3150884)

Currently the variables related to xmms2 in conky do not update if the currently playing track
has any of its information updated (ie: the title changes). This results in incorrect behaviour
for streams where the same track is continually played but the title and artist change as new
songs are played. The attached patch corrects this issue by changing conky to respond to a
callback that fires when xmms2 media library entries are updated. After the callback fires, the
patch checks to see if the media library entry that changed corresponds to the currently playing
song and if it does updates the conky xmms2 related variables accordingly.

A different version of the patch was previously submitted and accepted into conky. Unfortunately,
this patch contained a bug that caused conky xmms2 variables to be updated when any media library
information was updated. However, the previous patch was reverted as a result of a commit the
made conky compatible with a new version of the xmms2 client api.

Patch submitted by Tamim Khan.

Signed-off-by: Pavel Labath <pavelo@centrum.sk>
This commit is contained in:
Pavel Labath 2011-10-19 16:37:27 +02:00
parent 21c4e8a3ef
commit 152cdb4cc3

View File

@ -253,6 +253,25 @@ int handle_playlist_loaded(xmmsv_t *value, void *p)
return TRUE;
}
int handle_medialib_changed(xmmsv_t *value, void *p)
{
struct information *ptr = (struct information*) p;
const char *errbuf;
int current_id;
if (xmmsv_get_error(value, &errbuf)) {
fprintf(stderr,"XMMS2 server error. %s\n", errbuf);
return TRUE;
}
if (xmmsv_get_int(value, &current_id) && current_id > 0 &&
ptr->xmms2.id == (unsigned int)current_id) {
return handle_curent_id(value, ptr);
}
return TRUE;
}
int update_xmms2(void)
{
struct information *current_info = &info;
@ -298,6 +317,8 @@ int update_xmms2(void)
handle_playback_state_change, current_info);
XMMS_CALLBACK_SET(xmms2_conn, xmmsc_broadcast_playlist_loaded,
handle_playlist_loaded, current_info);
XMMS_CALLBACK_SET(xmms2_conn, xmmsc_broadcast_medialib_entry_changed,
handle_medialib_changed, current_info);
/* get playback status, current id and active playlist */
XMMS_CALLBACK_SET(xmms2_conn, xmmsc_playback_current_id,