summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dcb4dfe)
raw | patch | inline | side by side (parent: dcb4dfe)
author | Romain Bignon <romain@peerfuse.org> | |
Sun, 29 Mar 2009 22:01:50 +0000 (00:01 +0200) | ||
committer | Romain Bignon <romain@peerfuse.org> | |
Sun, 29 Mar 2009 22:01:50 +0000 (00:01 +0200) |
src/command.c | patch | blob | history | |
src/command.h | patch | blob | history | |
src/libmpdclient.c | patch | blob | history | |
src/libmpdclient.h | patch | blob | history | |
src/mpdclient.c | patch | blob | history | |
src/mpdclient.h | patch | blob | history | |
src/screen.c | patch | blob | history | |
src/screen_help.c | patch | blob | history |
diff --git a/src/command.c b/src/command.c
index b0a230e8d32c2a89c86423b2c62c60ba23027668..695c11bececcb43e2c3ae35851ac89731217c857 100644 (file)
--- a/src/command.c
+++ b/src/command.c
N_("Toggle random mode") },
{ { 'y', 0, 0 }, 0, CMD_SINGLE, "single",
N_("Toggle single mode") },
+ { { 'C', 0, 0 }, 0, CMD_CONSUME, "consume",
+ N_("Toggle consume mode") },
{ { 'x', 0, 0 }, 0, CMD_CROSSFADE, "crossfade",
N_("Toggle crossfade mode") },
{ { 21, 0, 0 }, 0, CMD_DB_UPDATE, "db-update",
diff --git a/src/command.h b/src/command.h
index a1d5858d974d582332f4f0e658310b6f91de48ec..7d6fb1ae0f48dbb095d2179bff7daa717e917200 100644 (file)
--- a/src/command.h
+++ b/src/command.h
CMD_DELETE,
CMD_REPEAT,
CMD_SINGLE,
+ CMD_CONSUME,
CMD_CROSSFADE,
CMD_DB_UPDATE,
CMD_VOLUME_UP,
diff --git a/src/libmpdclient.c b/src/libmpdclient.c
index e800fb3c97d3e9c03a6fb87a6e9a2504fadab925..4cf2d80b120983092f8632b4e8b2f9f4da6ecc46 100644 (file)
--- a/src/libmpdclient.c
+++ b/src/libmpdclient.c
status->repeat = 0;
status->random = 0;
status->single = 0;
+ status->consume = 0;
status->playlist = -1;
status->playlistLength = -1;
status->state = -1;
else if(strcmp(re->name,"single")==0) {
status->single = atoi(re->value);
}
+ else if(strcmp(re->name,"consume")==0) {
+ status->consume = atoi(re->value);
+ }
else if(strcmp(re->name,"playlist")==0) {
status->playlist = strtol(re->value,NULL,10);
}
free(string);
}
+void mpd_sendConsumeCommand(mpd_Connection * connection, int consumeMode) {
+ char * string = malloc(strlen("consume")+25);
+ sprintf(string,"consume \"%i\"\n",consumeMode);
+ mpd_executeCommand(connection,string);
+ free(string);
+}
+
void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange) {
char * string = malloc(strlen("setvol")+25);
sprintf(string,"setvol \"%i\"\n",volumeChange);
diff --git a/src/libmpdclient.h b/src/libmpdclient.h
index 4a7c2b670948e459b62b0553e776f9df1c71bdb6..de0bb618195570f141898c8b2034cdf97993120d 100644 (file)
--- a/src/libmpdclient.h
+++ b/src/libmpdclient.h
int random;
/* 1 if single is on, 0 otherwise */
int single;
+ /* 1 if consume is on, 0 otherwise */
+ int consume;
/* playlist length */
int playlistLength;
/* playlist, use this to determine when the playlist has changed */
void mpd_sendSingleCommand(mpd_Connection * connection, int singleMode);
+void mpd_sendConsumeCommand(mpd_Connection * connection, int consumeMode);
+
void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange);
/* WARNING: don't use volume command, its deprecated */
diff --git a/src/mpdclient.c b/src/mpdclient.c
index aa420eec1280455d922894bde4e1ab8489243654..b1d927b63e74cf1497385f01eaa39fa66104da1c 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
return mpdclient_finish_command(c);
}
+gint
+mpdclient_cmd_consume(mpdclient_t *c, gint value)
+{
+ mpd_sendConsumeCommand(c->connection, value);
+ return mpdclient_finish_command(c);
+}
+
gint
mpdclient_cmd_crossfade(mpdclient_t *c, gint value)
{
diff --git a/src/mpdclient.h b/src/mpdclient.h
index a532d45282d50541f83f94c8a6bb722349204f89..dc7cbf976b8d4939822fdbbc8f3cf8cee1082aa5 100644 (file)
--- a/src/mpdclient.h
+++ b/src/mpdclient.h
gint mpdclient_cmd_repeat(mpdclient_t *c, gint value);
gint mpdclient_cmd_random(mpdclient_t *c, gint value);
gint mpdclient_cmd_single(mpdclient_t *c, gint value);
+gint mpdclient_cmd_consume(mpdclient_t *c, gint value);
gint mpdclient_cmd_crossfade(mpdclient_t *c, gint value);
gint mpdclient_cmd_db_update(mpdclient_t *c, gchar *path);
gint mpdclient_cmd_volume(mpdclient_t *c, gint value);
diff --git a/src/screen.c b/src/screen.c
index 75e9668d9d32782e1ac65a795ef95309b5a10085..e245f0d449b0290bdbd3b71d9b6114ae501eb69f 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
g_strlcat(flags, "z", sizeof(flags));
if (c->status->single)
g_strlcat(flags, "s", sizeof(flags));
+ if (c->status->consume)
+ g_strlcat(flags, "c", sizeof(flags));
if (c->status->crossfade)
g_strlcat(flags, "x", sizeof(flags));
if (c->status->updatingDb)
static int repeat = -1;
static int random_enabled = -1;
static int single = -1;
+ static int consume = -1;
static int crossfade = -1;
static int dbupdate = -1;
repeat = c->status->repeat;
random_enabled = c->status->random;
single = c->status->single;
+ consume = c->status->consume;
crossfade = c->status->crossfade;
dbupdate = c->status->updatingDb;
}
_("Single is on") :
_("Single is off"));
+ if (consume != c->status->consume)
+ screen_status_printf(c->status->consume ?
+ _("Consume is on") :
+ _("Consume is off"));
+
if (crossfade != c->status->crossfade)
screen_status_printf(_("Crossfade %d seconds"), c->status->crossfade);
repeat = c->status->repeat;
single = c->status->single;
+ consume = c->status->consume;
random_enabled = c->status->random;
crossfade = c->status->crossfade;
dbupdate = c->status->updatingDb;
case CMD_SINGLE:
mpdclient_cmd_single(c, !c->status->single);
break;
+ case CMD_CONSUME:
+ mpdclient_cmd_consume(c, !c->status->consume);
+ break;
case CMD_CROSSFADE:
if (c->status->crossfade)
mpdclient_cmd_crossfade(c, 0);
diff --git a/src/screen_help.c b/src/screen_help.c
index 9af853bfd948e0e26aa48a2c6a2de4fb132f1ec0..540fc94ba3c1b22881b8fda507a24e67b3b1126d 100644 (file)
--- a/src/screen_help.c
+++ b/src/screen_help.c
{ 0, CMD_REPEAT, NULL },
{ 0, CMD_RANDOM, NULL },
{ 0, CMD_SINGLE, NULL },
+ { 0, CMD_CONSUME, NULL },
{ 0, CMD_CROSSFADE, NULL },
{ 0, CMD_SHUFFLE, NULL },
{ 0, CMD_DB_UPDATE, NULL },