summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3b79713)
raw | patch | inline | side by side (parent: 3b79713)
author | Max Kellermann <max@duempel.org> | |
Sat, 17 Oct 2009 22:57:11 +0000 (00:57 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sat, 17 Oct 2009 22:57:11 +0000 (00:57 +0200) |
Call mpdclient_run_play_id() directly.
src/mpdclient.c | patch | blob | history | |
src/mpdclient.h | patch | blob | history | |
src/screen_queue.c | patch | blob | history |
diff --git a/src/mpdclient.c b/src/mpdclient.c
index 748baed5c1e99d42470254ea39240dcf3ff09753..dbe931c7d66e8bdc61a09e7007661eb7966ec875 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
/*** MPD Commands **********************************************************/
/****************************************************************************/
-bool
-mpdclient_cmd_play(struct mpdclient *c, gint idx)
-{
- struct mpd_connection *connection = mpdclient_get_connection(c);
- const struct mpd_song *song = playlist_get_song(&c->playlist, idx);
-
- if (connection == NULL)
- return false;
-
- if (song)
- mpd_send_play_id(connection, mpd_song_get_id(song));
- else
- mpd_send_play(connection);
-
- return mpdclient_finish_command(c);
-}
-
bool
mpdclient_cmd_crop(struct mpdclient *c)
{
diff --git a/src/mpdclient.h b/src/mpdclient.h
index 6c8758f6674d4becdb22a8915d50dd947254c606..9f22d268cc046e05b1c8279b0459231590e77a23 100644 (file)
--- a/src/mpdclient.h
+++ b/src/mpdclient.h
/*** MPD Commands **********************************************************/
-bool
-mpdclient_cmd_play(struct mpdclient *c, gint index);
-
bool
mpdclient_cmd_crop(struct mpdclient *c);
diff --git a/src/screen_queue.c b/src/screen_queue.c
index 491d3321070076d6d0827b90bdda861b04c0f33f..01305203e7c91001508b3f9ab403b8b197251dca 100644 (file)
--- a/src/screen_queue.c
+++ b/src/screen_queue.c
if (bstate & BUTTON1_CLICKED) {
/* play */
- if (lw->selected < playlist_length(playlist))
- mpdclient_cmd_play(c, lw->start + row);
+ const struct mpd_song *song = screen_queue_selected_song();
+ if (song != NULL) {
+ struct mpd_connection *connection =
+ mpdclient_get_connection(c);
+
+ if (connection != NULL &&
+ !mpd_run_play_id(connection,
+ mpd_song_get_id(song)))
+ mpdclient_handle_error(c);
+ }
} else if (bstate & BUTTON3_CLICKED) {
/* delete */
if (lw->selected == old_selected)
static command_t cached_cmd = CMD_NONE;
command_t prev_cmd = cached_cmd;
struct list_window_range range;
+ const struct mpd_song *song;
cached_cmd = cmd;
switch(cmd) {
case CMD_PLAY:
- mpdclient_cmd_play(c, lw->selected);
+ song = screen_queue_selected_song();
+ if (song == NULL)
+ return false;
+
+ connection = mpdclient_get_connection(c);
+ if (connection != NULL &&
+ !mpd_run_play_id(connection, mpd_song_get_id(song)))
+ mpdclient_handle_error(c);
+
return true;
case CMD_DELETE: