summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a500c51)
raw | patch | inline | side by side (parent: a500c51)
author | Romain Bignon <romain@peerfuse.org> | |
Fri, 27 Mar 2009 14:54:31 +0000 (15:54 +0100) | ||
committer | Romain Bignon <romain@peerfuse.org> | |
Fri, 27 Mar 2009 14:54:31 +0000 (15:54 +0100) |
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 9df837e85ca998eac22c64c651d321643d62c161..b0a230e8d32c2a89c86423b2c62c60ba23027668 100644 (file)
--- a/src/command.c
+++ b/src/command.c
N_("Toggle repeat mode") },
{ { 'z', 0, 0 }, 0, CMD_RANDOM, "random",
N_("Toggle random mode") },
+ { { 'y', 0, 0 }, 0, CMD_SINGLE, "single",
+ N_("Toggle single 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 eb3b6e28902c1cfbd1560e3ac929e7951d20807d..a1d5858d974d582332f4f0e658310b6f91de48ec 100644 (file)
--- a/src/command.h
+++ b/src/command.h
CMD_CLEAR,
CMD_DELETE,
CMD_REPEAT,
+ CMD_SINGLE,
CMD_CROSSFADE,
CMD_DB_UPDATE,
CMD_VOLUME_UP,
diff --git a/src/libmpdclient.c b/src/libmpdclient.c
index 6f68ddaffe763103c272814cc9cc8cfec123e419..e800fb3c97d3e9c03a6fb87a6e9a2504fadab925 100644 (file)
--- a/src/libmpdclient.c
+++ b/src/libmpdclient.c
status->volume = -1;
status->repeat = 0;
status->random = 0;
+ status->single = 0;
status->playlist = -1;
status->playlistLength = -1;
status->state = -1;
else if(strcmp(re->name,"random")==0) {
status->random = atoi(re->value);
}
+ else if(strcmp(re->name,"single")==0) {
+ status->single = atoi(re->value);
+ }
else if(strcmp(re->name,"playlist")==0) {
status->playlist = strtol(re->value,NULL,10);
}
free(string);
}
+void mpd_sendSingleCommand(mpd_Connection * connection, int singleMode) {
+ char * string = malloc(strlen("single")+25);
+ sprintf(string,"single \"%i\"\n",singleMode);
+ 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 2e94f17a0583d3b828486c7d73df96a6a9fdba16..4a7c2b670948e459b62b0553e776f9df1c71bdb6 100644 (file)
--- a/src/libmpdclient.h
+++ b/src/libmpdclient.h
int repeat;
/* 1 if random is on, 0 otherwise */
int random;
+ /* 1 if single is on, 0 otherwise */
+ int single;
/* playlist length */
int playlistLength;
/* playlist, use this to determine when the playlist has changed */
void mpd_sendRandomCommand(mpd_Connection * connection, int randomMode);
+void mpd_sendSingleCommand(mpd_Connection * connection, int singleMode);
+
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 a1766d9a47baf9e5beb5a668b9fb8de76c3496ac..aa420eec1280455d922894bde4e1ab8489243654 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
return mpdclient_finish_command(c);
}
+gint
+mpdclient_cmd_single(mpdclient_t *c, gint value)
+{
+ mpd_sendSingleCommand(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 fe13a2f8536c46ec4ea8e1e17663e789dcf7bddd..a532d45282d50541f83f94c8a6bb722349204f89 100644 (file)
--- a/src/mpdclient.h
+++ b/src/mpdclient.h
gint mpdclient_cmd_clear(mpdclient_t *c);
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_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 85f1250ae31ed258831fc356f58d9912d2c9a87d..75e9668d9d32782e1ac65a795ef95309b5a10085 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
/* ncmpc (Ncurses MPD Client)
* (c) 2004-2009 The Music Player Daemon Project
* Project homepage: http://musicpd.org
-
+
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
screen_paint(c);
}
-void
+void
screen_swap(struct mpdclient *c, const struct mpd_song *song)
{
if (song != NULL)
if (c->status->repeat)
g_strlcat(flags, "r", sizeof(flags));
if (c->status->random)
- g_strlcat(flags, "z", sizeof(flags));;
+ g_strlcat(flags, "z", sizeof(flags));
+ if (c->status->single)
+ g_strlcat(flags, "s", sizeof(flags));
if (c->status->crossfade)
g_strlcat(flags, "x", sizeof(flags));
if (c->status->updatingDb)
#ifndef NCMPC_MINI
static int repeat = -1;
static int random_enabled = -1;
+ static int single = -1;
static int crossfade = -1;
static int dbupdate = -1;
if (repeat < 0) {
repeat = c->status->repeat;
random_enabled = c->status->random;
+ single = c->status->single;
crossfade = c->status->crossfade;
dbupdate = c->status->updatingDb;
}
_("Random is on") :
_("Random is off"));
+ if (single != c->status->single)
+ screen_status_printf(c->status->single ?
+ _("Single is on") :
+ _("Single is off"));
+
if (crossfade != c->status->crossfade)
screen_status_printf(_("Crossfade %d seconds"), c->status->crossfade);
}
repeat = c->status->repeat;
+ single = c->status->single;
random_enabled = c->status->random;
crossfade = c->status->crossfade;
dbupdate = c->status->updatingDb;
case CMD_RANDOM:
mpdclient_cmd_random(c, !c->status->random);
break;
+ case CMD_SINGLE:
+ mpdclient_cmd_single(c, !c->status->single);
+ 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 964a5a3fdc1da7623ccea5a1116e33625b221eb1..9af853bfd948e0e26aa48a2c6a2de4fb132f1ec0 100644 (file)
--- a/src/screen_help.c
+++ b/src/screen_help.c
{ 0, CMD_NONE, NULL },
{ 0, CMD_REPEAT, NULL },
{ 0, CMD_RANDOM, NULL },
+ { 0, CMD_SINGLE, NULL },
{ 0, CMD_CROSSFADE, NULL },
{ 0, CMD_SHUFFLE, NULL },
{ 0, CMD_DB_UPDATE, NULL },