add song buffer to prevent duplication
This commit is contained in:
7
mpd_ws.c
7
mpd_ws.c
@@ -250,7 +250,12 @@ void mpd_ws_update_song(struct mpd_ws_server *server) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
syslog(LOG_DEBUG, "Broadcasting: %s", server->current_song);
|
syslog(LOG_DEBUG, "Broadcasting: %s", server->current_song);
|
||||||
client_broadcast(server, server->current_song);
|
|
||||||
|
/* Only broadcast if song actually changed */
|
||||||
|
if (strcmp(server->current_song, server->previous_song) != 0) {
|
||||||
|
client_broadcast(server, server->current_song);
|
||||||
|
strcpy(server->previous_song, server->current_song);
|
||||||
|
}
|
||||||
|
|
||||||
if (song) {
|
if (song) {
|
||||||
mpd_song_free(song);
|
mpd_song_free(song);
|
||||||
|
|||||||
1
mpd_ws.h
1
mpd_ws.h
@@ -24,6 +24,7 @@ struct mpd_ws_server {
|
|||||||
struct mpd_connection *mpd_conn;
|
struct mpd_connection *mpd_conn;
|
||||||
struct client_session *clients;
|
struct client_session *clients;
|
||||||
char current_song[MAX_MESSAGE_SIZE];
|
char current_song[MAX_MESSAGE_SIZE];
|
||||||
|
char previous_song[MAX_MESSAGE_SIZE];
|
||||||
volatile int running;
|
volatile int running;
|
||||||
int mpd_idle_active;
|
int mpd_idle_active;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user