File src/pms.c changed (mode: 100644) (index 5a2841d..cfe0d4b) |
... |
... |
static void pms_handle_mpd_idle_update(struct mpd_connection * connection, enum |
129 |
129 |
console("Database update has started or finished."); |
console("Database update has started or finished."); |
130 |
130 |
} |
} |
131 |
131 |
|
|
132 |
|
pms_get_mpd_state(connection); |
|
|
132 |
|
if (flags & (MPD_IDLE_QUEUE | MPD_IDLE_PLAYER | MPD_IDLE_MIXER | MPD_IDLE_OPTIONS)) { |
|
133 |
|
pms_get_mpd_state(connection); |
|
134 |
|
} |
133 |
135 |
|
|
134 |
136 |
topbar_draw(); |
topbar_draw(); |
135 |
137 |
|
|
|
... |
... |
int get_input(struct mpd_connection * connection) { |
175 |
177 |
// FIXME |
// FIXME |
176 |
178 |
} else if (retval > 0) { |
} else if (retval > 0) { |
177 |
179 |
if (FD_ISSET(mpd_fd, &fds)) { |
if (FD_ISSET(mpd_fd, &fds)) { |
178 |
|
console("Got something from MPD"); |
|
179 |
180 |
flags |= PMS_HAS_INPUT_MPD; |
flags |= PMS_HAS_INPUT_MPD; |
180 |
181 |
} |
} |
181 |
182 |
if (FD_ISSET(STDIN_FILENO, &fds)) { |
if (FD_ISSET(STDIN_FILENO, &fds)) { |
182 |
|
console("Console key input"); |
|
183 |
183 |
flags |= PMS_HAS_INPUT_STDIN; |
flags |= PMS_HAS_INPUT_STDIN; |
184 |
184 |
} |
} |
185 |
185 |
} |
} |
|
... |
... |
int main(int argc, char** argv) { |
207 |
207 |
while(pms_state->running) { |
while(pms_state->running) { |
208 |
208 |
|
|
209 |
209 |
if (!connection) { |
if (!connection) { |
210 |
|
connection = pms_mpd_connect(); |
|
|
210 |
|
if (connection = pms_mpd_connect()) { |
|
211 |
|
pms_handle_mpd_idle_update(connection, -1); |
|
212 |
|
} |
211 |
213 |
} |
} |
212 |
214 |
|
|
213 |
215 |
if (connection && !is_idle) { |
if (connection && !is_idle) { |
|
... |
... |
int main(int argc, char** argv) { |
221 |
223 |
flags = mpd_recv_idle(connection, true); |
flags = mpd_recv_idle(connection, true); |
222 |
224 |
is_idle = false; |
is_idle = false; |
223 |
225 |
pms_handle_mpd_idle_update(connection, flags); |
pms_handle_mpd_idle_update(connection, flags); |
224 |
|
topbar_draw(); |
|
225 |
226 |
} |
} |
226 |
227 |
|
|
227 |
228 |
if (input_flags & PMS_HAS_INPUT_STDIN) { |
if (input_flags & PMS_HAS_INPUT_STDIN) { |