summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6e65ea8)
raw | patch | inline | side by side (parent: 6e65ea8)
author | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 20:18:22 +0000 (22:18 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 30 Sep 2009 20:18:22 +0000 (22:18 +0200) |
src/mpdclient.c | patch | blob | history | |
src/playlist.c | patch | blob | history | |
src/playlist.h | patch | blob | history |
diff --git a/src/mpdclient.c b/src/mpdclient.c
index d95e278f55f6a82c81fb40634d5240681b2c1f38..864d09189b6eb59e787700b2ebf2bff5281c750f 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
c->volume = mpd_status_get_volume(c->status);
/* check if the playlist needs an update */
- if (c->playlist.id != mpd_status_get_queue_version(c->status)) {
+ if (c->playlist.version != mpd_status_get_queue_version(c->status)) {
c->events |= MPD_IDLE_PLAYLIST;
if (!playlist_is_empty(&c->playlist))
playlist_append(&c->playlist, song);
/* increment the playlist id, so we don't retrieve a new playlist */
- c->playlist.id++;
+ c->playlist.version++;
c->events |= MPD_IDLE_PLAYLIST;
#endif
#ifdef ENABLE_FANCY_PLAYLIST_MANAGMENT_CMD_DELETE
/* increment the playlist id, so we don't retrieve a new playlist */
- c->playlist.id++;
+ c->playlist.version++;
/* remove the song from the playlist */
playlist_remove_reuse(&c->playlist, idx);
playlist_swap(&c->playlist, old_index, new_index);
/* increment the playlist id, so we don't retrieve a new playlist */
- c->playlist.id++;
+ c->playlist.version++;
#endif
c->events |= MPD_IDLE_PLAYLIST;
mpd_entity_free(entity);
}
- c->playlist.id = mpd_status_get_queue_version(c->status);
+ c->playlist.version = mpd_status_get_queue_version(c->status);
c->song = NULL;
return mpdclient_finish_command(c) == 0;
if (MPD_ERROR(c))
return false;
- mpd_send_queue_changes_meta(c->connection, c->playlist.id);
+ mpd_send_queue_changes_meta(c->connection, c->playlist.version);
while ((song = mpd_recv_song(c->connection)) != NULL) {
int pos = mpd_song_get_pos(song);
}
c->song = NULL;
- c->playlist.id = mpd_status_get_queue_version(c->status);
+ c->playlist.version = mpd_status_get_queue_version(c->status);
return mpdclient_finish_command(c) == 0;
}
diff --git a/src/playlist.c b/src/playlist.c
index a6e4005672dc63bb12944bba4be977551eb87689..11a9b91dd14f9e8765a8acf788cafd6d86f1ec06 100644 (file)
--- a/src/playlist.c
+++ b/src/playlist.c
void
playlist_init(struct mpdclient_playlist *playlist)
{
- playlist->id = 0;
+ playlist->version = 0;
playlist->list = g_ptr_array_sized_new(1024);
}
{
guint i;
- playlist->id = 0;
+ playlist->version = 0;
for (i = 0; i < playlist->list->len; ++i) {
struct mpd_song *song = playlist_get(playlist, i);
diff --git a/src/playlist.h b/src/playlist.h
index 67319d24b346f46422a1dfb38d09f13f4492c6bf..6f54736b1f22e6256e8cbabc2eebceeea1d39647 100644 (file)
--- a/src/playlist.h
+++ b/src/playlist.h
#include <glib.h>
struct mpdclient_playlist {
- /* playlist id */
- unsigned id;
+ /* queue version number (obtained from mpd_status) */
+ unsigned version;
/* the list */
GPtrArray *list;