Code

playlist: renamed "id" to "version"
authorMax Kellermann <max@duempel.org>
Wed, 30 Sep 2009 20:18:22 +0000 (22:18 +0200)
committerMax Kellermann <max@duempel.org>
Wed, 30 Sep 2009 20:18:22 +0000 (22:18 +0200)
src/mpdclient.c
src/playlist.c
src/playlist.h

index d95e278f55f6a82c81fb40634d5240681b2c1f38..864d09189b6eb59e787700b2ebf2bff5281c750f 100644 (file)
@@ -243,7 +243,7 @@ mpdclient_update(struct 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))
@@ -418,7 +418,7 @@ mpdclient_cmd_add(struct mpdclient *c, const struct mpd_song *song)
        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
@@ -447,7 +447,7 @@ mpdclient_cmd_delete(struct mpdclient *c, gint idx)
 
 #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);
@@ -491,7 +491,7 @@ mpdclient_cmd_move(struct mpdclient *c, gint old_index, gint new_index)
        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;
@@ -564,7 +564,7 @@ mpdclient_playlist_update(struct mpdclient *c)
                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;
@@ -580,7 +580,7 @@ mpdclient_playlist_update_changes(struct mpdclient *c)
        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);
@@ -607,7 +607,7 @@ mpdclient_playlist_update_changes(struct mpdclient *c)
        }
 
        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;
 }
index a6e4005672dc63bb12944bba4be977551eb87689..11a9b91dd14f9e8765a8acf788cafd6d86f1ec06 100644 (file)
@@ -28,7 +28,7 @@
 void
 playlist_init(struct mpdclient_playlist *playlist)
 {
-       playlist->id = 0;
+       playlist->version = 0;
        playlist->list = g_ptr_array_sized_new(1024);
 }
 
@@ -37,7 +37,7 @@ playlist_clear(struct mpdclient_playlist *playlist)
 {
        guint i;
 
-       playlist->id = 0;
+       playlist->version = 0;
 
        for (i = 0; i < playlist->list->len; ++i) {
                struct mpd_song *song = playlist_get(playlist, i);
index 67319d24b346f46422a1dfb38d09f13f4492c6bf..6f54736b1f22e6256e8cbabc2eebceeea1d39647 100644 (file)
@@ -26,8 +26,8 @@
 #include <glib.h>
 
 struct mpdclient_playlist {
-       /* playlist id */
-       unsigned id;
+       /* queue version number (obtained from mpd_status) */
+       unsigned version;
 
        /* the list */
        GPtrArray *list;