Skip to content
This repository has been archived by the owner on Jan 5, 2018. It is now read-only.

Commit

Permalink
fix MPD code
Browse files Browse the repository at this point in the history
  • Loading branch information
Unia committed Sep 28, 2013
1 parent c5b1975 commit 454ce8a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions dwmst.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
FILE *infile;
int skfd;
struct wireless_info *winfo;
#ifdef MPD
struct mpd_connection *conn = NULL;
#endif
#ifdef AUD
DBusGProxy *session = NULL;
DBusGConnection *connection = NULL;
Expand All @@ -27,7 +30,6 @@ DBusGConnection *connection = NULL;
#ifdef MPD
char *get_mpd(char *buf) {
struct mpd_song *song = NULL;
struct mpd_connection *conn = NULL;
struct mpd_status *mpd_status = NULL;
const char *title = NULL, *artist = NULL;

Expand All @@ -48,17 +50,13 @@ char *get_mpd(char *buf) {
artist = mpd_song_get_tag(song, MPD_TAG_ARTIST, 0);
sprintf(buf, MPD_STR, title, artist);
mpd_song_free(song);
free(title);
free(artist);
} else if (mpd_status_get_state(mpd_status) == MPD_STATE_PAUSE) {
mpd_response_next(conn);
song = mpd_recv_song(conn);
title = mpd_song_get_tag(song, MPD_TAG_TITLE, 0);
artist = mpd_song_get_tag(song, MPD_TAG_ARTIST, 0);
sprintf(buf, MPD_P_STR, title, artist);
mpd_song_free(song);
free(title);
free(artist);
} else if (mpd_status_get_state(mpd_status) == MPD_STATE_STOP)
sprintf(buf, MPD_S_STR);
}
Expand Down

0 comments on commit 454ce8a

Please sign in to comment.