[Musicpd-dev-team] [PATCH 02/23] exconf: Comment formerly required files.

2009-03-29 Thread Avuton Olrich
---
 doc/mpdconf.example |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/mpdconf.example b/doc/mpdconf.example
index 646b56d..d875f9c 100644
--- a/doc/mpdconf.example
+++ b/doc/mpdconf.example
@@ -6,20 +6,20 @@
 # This setting controls the top directory which MPD will search to discover the
 # available audio files and add them to the daemon's online database.
 #
-music_directory~/music
+#music_directory   ~/music
 #
 # This setting sets the MPD internal playlist directory. The purpose of this
 # directory is storage for playlists created by MPD. The server will use 
 # playlist files not created by the server but only if they are in the MPD
 # format.
 #
-playlist_directory ~/.mpd/playlists
+#playlist_directory~/.mpd/playlists
 #
 # This setting sets the location of the MPD database. This file is used to
 # load the database at server start up and store the database while the 
 # server is not up.
 #
-db_file~/.mpd/database
+#db_file   ~/.mpd/database
 # 
 # These settings are the locations for the daemon log files for the daemon.
 # These logs are great for troubleshooting, depending on your log_level
@@ -29,7 +29,7 @@ db_file   ~/.mpd/database
 # On most systems, log messages will appear in /var/log/daemon.log
 # then.
 #
-log_file   ~/.mpd/log
+#log_file  ~/.mpd/log
 #
 # This setting sets the location of the file which stores the process ID
 # for use of mpd --kill and some init scripts. This setting is disabled by
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 07/23] command: command_error() is not necessary for export.

2009-03-29 Thread Avuton Olrich
---
 src/command.c |2 +-
 src/command.h |3 ---
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/src/command.c b/src/command.c
index 69fbe51..ad14f52 100644
--- a/src/command.c
+++ b/src/command.c
@@ -121,7 +121,7 @@ static void command_error_v(struct client *client, enum ack 
error,
current_command = NULL;
 }
 
-G_GNUC_PRINTF(3, 4) void command_error(struct client *client, enum ack error,
+G_GNUC_PRINTF(3, 4) static void command_error(struct client *client, enum ack 
error,
   const char *fmt, ...)
 {
va_list args;
diff --git a/src/command.h b/src/command.h
index 7e03e36..a7c408e 100644
--- a/src/command.h
+++ b/src/command.h
@@ -47,7 +47,4 @@ command_process(struct client *client, char *commandString);
 
 void command_success(struct client *client);
 
-G_GNUC_PRINTF(3, 4) void command_error(struct client *client, enum ack error,
-  const char *fmt, ...);
-
 #endif
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 06/23] client: client_write() does not necessary for export.

2009-03-29 Thread Avuton Olrich
---
 src/client.c |5 -
 src/client.h |5 -
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/client.c b/src/client.c
index 65dc858..369390b 100644
--- a/src/client.c
+++ b/src/client.c
@@ -773,7 +773,10 @@ static void client_write_output(struct client *client)
client-send_buf_used = 0;
 }
 
-void client_write(struct client *client, const char *buffer, size_t buflen)
+/**
+ * Write a block of data to the client.
+ */
+static void client_write(struct client *client, const char *buffer, size_t 
buflen)
 {
/* if the client is going to be closed, do nothing */
if (client_is_expired(client))
diff --git a/src/client.h b/src/client.h
index c992dab..824497a 100644
--- a/src/client.h
+++ b/src/client.h
@@ -46,11 +46,6 @@ unsigned client_get_permission(const struct client *client);
 void client_set_permission(struct client *client, unsigned permission);
 
 /**
- * Write a block of data to the client.
- */
-void client_write(struct client *client, const char *data, size_t length);
-
-/**
  * Write a C string to the client.
  */
 void client_puts(struct client *client, const char *s);
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 04/23] exconf: update mixer documentation.

2009-03-29 Thread Avuton Olrich
---
 doc/mpdconf.example |   19 ---
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/doc/mpdconf.example b/doc/mpdconf.example
index 2f6259b..5061489 100644
--- a/doc/mpdconf.example
+++ b/doc/mpdconf.example
@@ -258,20 +258,25 @@
 
 # Volume control mixer 
 #
-# MPD has limited volume controls, to use them pick one below. If one is not
-# specified it may be autodetected at startup, depending on the dependencies
-# which were compiled into the server.
+# These are the global volume control settings. By default, this setting will
+# be detected to the available audio output device, with preference going to 
+# hardware mixing. Hardware and software mixers for individual audio_output
+# sections cannot yet be mixed.
 #
-# An example for controlling an ALSA or OSS mixer:
+# An example for controlling an ALSA, OSS or Pulseaudio mixer; If this
+# setting is used other sound applications will be affected by the volume
+# being controlled by MPD.
 #
 #mixer_typehardware
 #
-# This example is a general volume control mixer, it is used to adjust the 
-# volume of the audio sent to the audio output, and will work with all outputs.
+# An example for controlling all mixers through software. This will control
+# all controls, even if the mixer is not supported by the device and will not
+# affect any other sound producing applications.
 #
 #mixer_typesoftware
 #
-# This example will not allow MPD to touch the mixer at all.
+# This example will not allow MPD to touch the mixer at all and will disable
+# all volume controls.
 #
 #mixer_typedisabled
 #
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 10/23] fifo: remove unused function fifo_buffer_clear().

2009-03-29 Thread Avuton Olrich
---
 src/fifo_buffer.c |9 -
 src/fifo_buffer.h |8 
 2 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/src/fifo_buffer.c b/src/fifo_buffer.c
index adee438..b6b5cc0 100644
--- a/src/fifo_buffer.c
+++ b/src/fifo_buffer.c
@@ -65,15 +65,6 @@ fifo_buffer_free(struct fifo_buffer *buffer)
g_free(buffer);
 }
 
-void
-fifo_buffer_clear(struct fifo_buffer *buffer)
-{
-   assert(buffer != NULL);
-
-   buffer-start = 0;
-   buffer-end = 0;
-}
-
 const void *
 fifo_buffer_read(const struct fifo_buffer *buffer, size_t *length_r)
 {
diff --git a/src/fifo_buffer.h b/src/fifo_buffer.h
index 4af6bde..d2a4287 100644
--- a/src/fifo_buffer.h
+++ b/src/fifo_buffer.h
@@ -63,14 +63,6 @@ void
 fifo_buffer_free(struct fifo_buffer *buffer);
 
 /**
- * Clears all data currently in this #fifo_buffer object.  This does
- * not overwrite the actuall buffer; it just resets the internal
- * pointers.
- */
-void
-fifo_buffer_clear(struct fifo_buffer *buffer);
-
-/**
  * Reads from the beginning of the buffer.  To remove consumed data
  * from the buffer, call fifo_buffer_consume().
  *
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 01/23] exconf: Merge required files with optional.

2009-03-29 Thread Avuton Olrich
---
 doc/mpdconf.example |6 +-
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/doc/mpdconf.example b/doc/mpdconf.example
index bacc2ec..646b56d 100644
--- a/doc/mpdconf.example
+++ b/doc/mpdconf.example
@@ -1,7 +1,7 @@
 # An example configuration file for MPD
 # See the mpd.conf man page for a more detailed description of each parameter.
 
-# Required files and directories ##
+# Files and directories ###
 #
 # This setting controls the top directory which MPD will search to discover the
 # available audio files and add them to the daemon's online database.
@@ -30,10 +30,6 @@ db_file  ~/.mpd/database
 # then.
 #
 log_file   ~/.mpd/log
-###
-
-
-# Optional files ##
 #
 # This setting sets the location of the file which stores the process ID
 # for use of mpd --kill and some init scripts. This setting is disabled by
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 13/23] locate: remove unused function locate_item_free().

2009-03-29 Thread Avuton Olrich
---
 src/locate.c |7 ---
 src/locate.h |3 ---
 2 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/src/locate.c b/src/locate.c
index 7e99a24..6c4134d 100644
--- a/src/locate.c
+++ b/src/locate.c
@@ -119,13 +119,6 @@ locate_item_list_casefold(const struct locate_item_list 
*list)
return new_list;
 }
 
-void
-locate_item_free(struct locate_item *item)
-{
-   g_free(item-needle);
-   g_free(item);
-}
-
 static bool
 locate_tag_search(const struct song *song, enum tag_type type, const char *str)
 {
diff --git a/src/locate.h b/src/locate.h
index f9276b3..19f6879 100644
--- a/src/locate.h
+++ b/src/locate.h
@@ -70,9 +70,6 @@ locate_item_list_casefold(const struct locate_item_list 
*list);
 void
 locate_item_list_free(struct locate_item_list *list);
 
-void
-locate_item_free(struct locate_item *item);
-
 bool
 locate_song_search(const struct song *song,
   const struct locate_item_list *criteria);
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 09/23] decoder_buffer: remove unused function decoder_buffer_is_empty().

2009-03-29 Thread Avuton Olrich
---
 src/decoder_buffer.c |6 --
 src/decoder_buffer.h |3 ---
 2 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/src/decoder_buffer.c b/src/decoder_buffer.c
index 76e9126..dc28e9d 100644
--- a/src/decoder_buffer.c
+++ b/src/decoder_buffer.c
@@ -70,12 +70,6 @@ decoder_buffer_free(struct decoder_buffer *buffer)
 }
 
 bool
-decoder_buffer_is_empty(const struct decoder_buffer *buffer)
-{
-   return buffer-consumed == buffer-length;
-}
-
-bool
 decoder_buffer_is_full(const struct decoder_buffer *buffer)
 {
return buffer-consumed == 0  buffer-length == buffer-size;
diff --git a/src/decoder_buffer.h b/src/decoder_buffer.h
index d951a40..4700fb4 100644
--- a/src/decoder_buffer.h
+++ b/src/decoder_buffer.h
@@ -52,9 +52,6 @@ void
 decoder_buffer_free(struct decoder_buffer *buffer);
 
 bool
-decoder_buffer_is_empty(const struct decoder_buffer *buffer);
-
-bool
 decoder_buffer_is_full(const struct decoder_buffer *buffer);
 
 /**
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 11/23] icy_metadata: icy_reset() is not necessary for export.

2009-03-29 Thread Avuton Olrich
---
 src/icy_metadata.c |2 +-
 src/icy_metadata.h |3 ---
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/src/icy_metadata.c b/src/icy_metadata.c
index 69aa890..cd274ca 100644
--- a/src/icy_metadata.c
+++ b/src/icy_metadata.c
@@ -28,7 +28,7 @@
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN icy_metadata
 
-void
+static void
 icy_deinit(struct icy_metadata *im)
 {
if (!icy_defined(im))
diff --git a/src/icy_metadata.h b/src/icy_metadata.h
index f8eac4e..bdb209e 100644
--- a/src/icy_metadata.h
+++ b/src/icy_metadata.h
@@ -59,9 +59,6 @@ icy_start(struct icy_metadata *im, size_t data_size)
 void
 icy_reset(struct icy_metadata *im);
 
-void
-icy_deinit(struct icy_metadata *im);
-
 /**
  * Checks whether the icy_metadata object is enabled.
  */
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 16/23] queue: queue_generate_id() is not necessary for export.

2009-03-29 Thread Avuton Olrich
---
 src/queue.c |5 -
 src/queue.h |6 --
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/queue.c b/src/queue.c
index 21d4884..d7e3b96 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -20,7 +20,10 @@
 #include queue.h
 #include song.h
 
-unsigned
+/**
+ * Generate a non-existing id number.
+ */
+static unsigned
 queue_generate_id(const struct queue *queue)
 {
static unsigned cur = (unsigned)-1;
diff --git a/src/queue.h b/src/queue.h
index 452084c..e61c273 100644
--- a/src/queue.h
+++ b/src/queue.h
@@ -227,12 +227,6 @@ void
 queue_finish(struct queue *queue);
 
 /**
- * Generate a non-existing id number.
- */
-unsigned
-queue_generate_id(const struct queue *queue);
-
-/**
  * Returns the order number following the specified one.  This takes
  * end of queue and repeat mode into account.
  *
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 15/23] player_control: remove unused function playerCurrentDecodeSong().

2009-03-29 Thread Avuton Olrich
---
 src/player_control.c |7 ---
 src/player_control.h |3 ---
 2 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/src/player_control.c b/src/player_control.c
index dbeacf2..df4f4bf 100644
--- a/src/player_control.c
+++ b/src/player_control.c
@@ -268,10 +268,3 @@ double getPlayerTotalPlayTime(void)
 {
return pc.total_play_time;
 }
-
-/* this actually creates a dupe of the current metadata */
-struct song *
-playerCurrentDecodeSong(void)
-{
-   return NULL;
-}
diff --git a/src/player_control.h b/src/player_control.h
index 4b463c6..c8bcf24 100644
--- a/src/player_control.h
+++ b/src/player_control.h
@@ -149,9 +149,6 @@ player_get_audio_format(void)
return pc.audio_format;
 }
 
-struct song *
-playerCurrentDecodeSong(void);
-
 void playerInit(void);
 
 #endif
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 18/23] queue_print: queue_print_song_info() is not necessry for export.

2009-03-29 Thread Avuton Olrich
---
 src/queue_print.c |   10 +-
 src/queue_print.h |   12 
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/queue_print.c b/src/queue_print.c
index ef94100..2ca9ccc 100644
--- a/src/queue_print.c
+++ b/src/queue_print.c
@@ -24,7 +24,15 @@
 #include locate.h
 #include client.h
 
-void
+/**
+ * Send detailed information about a range of songs in the queue to a
+ * client.
+ *
+ * @param client the client which has requested information
+ * @param start the index of the first song (including)
+ * @param end the index of the last song (excluding)
+ */
+static void
 queue_print_song_info(struct client *client, const struct queue *queue,
  unsigned position)
 {
diff --git a/src/queue_print.h b/src/queue_print.h
index c43c680..02cbc8b 100644
--- a/src/queue_print.h
+++ b/src/queue_print.h
@@ -32,18 +32,6 @@ struct queue;
 struct locate_item_list;
 
 void
-queue_print_song_info(struct client *client, const struct queue *queue,
- unsigned position);
-
-/**
- * Send detailed information about a range of songs in the queue to a
- * client.
- *
- * @param client the client which has requested information
- * @param start the index of the first song (including)
- * @param end the index of the last song (excluding)
- */
-void
 queue_print_info(struct client *client, const struct queue *queue,
 unsigned start, unsigned end);
 
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 22/23] client: group static function declarations together.

2009-03-29 Thread Avuton Olrich
---
 src/client.c |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/client.c b/src/client.c
index 369390b..bb20441 100644
--- a/src/client.c
+++ b/src/client.c
@@ -113,6 +113,11 @@ static void client_write_deferred(struct client *client);
 
 static void client_write_output(struct client *client);
 
+static void client_manager_expire(void);
+
+static gboolean
+client_in_event(GIOChannel *source, GIOCondition condition, gpointer data);
+
 bool client_is_expired(const struct client *client)
 {
return client-channel == NULL;
@@ -133,9 +138,6 @@ void client_set_permission(struct client *client, unsigned 
permission)
client-permission = permission;
 }
 
-static void
-client_manager_expire(void);
-
 /**
  * An idle event which calls client_manager_expire().
  */
@@ -165,9 +167,6 @@ static inline void client_set_expired(struct client *client)
}
 }
 
-static gboolean
-client_in_event(GIOChannel *source, GIOCondition condition, gpointer data);
-
 static void client_init(struct client *client, int fd)
 {
static unsigned int next_client_num;
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 23/23] exconf: Fix spacing

2009-03-29 Thread Avuton Olrich
---
 doc/mpdconf.example |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/doc/mpdconf.example b/doc/mpdconf.example
index 5061489..e231296 100644
--- a/doc/mpdconf.example
+++ b/doc/mpdconf.example
@@ -1,6 +1,7 @@
 # An example configuration file for MPD
 # See the mpd.conf man page for a more detailed description of each parameter.
 
+
 # Files and directories ###
 #
 # This setting controls the top directory which MPD will search to discover the
@@ -103,6 +104,7 @@
 #
 ###
 
+
 # Symbolic link behavior ##
 #
 # If this setting is set to yes, MPD will discover audio files by following 
@@ -117,6 +119,7 @@
 #
 ###
 
+
 # Zeroconf / Avahi Service Discovery ##
 #
 # If this setting is set to yes, service information will be published with
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 21/23] tag: remove unused function void tag_delete_item().

2009-03-29 Thread Avuton Olrich
---
 src/tag.c |   22 --
 1 files changed, 0 insertions(+), 22 deletions(-)

diff --git a/src/tag.c b/src/tag.c
index 2cdefd5..c09fda7 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -126,28 +126,6 @@ struct tag *tag_new(void)
return ret;
 }
 
-static void tag_delete_item(struct tag *tag, unsigned idx)
-{
-   assert(idx  tag-num_items);
-   tag-num_items--;
-
-   g_mutex_lock(tag_pool_lock);
-   tag_pool_put_item(tag-items[idx]);
-   g_mutex_unlock(tag_pool_lock);
-
-   if (tag-num_items - idx  0) {
-   memmove(tag-items + idx, tag-items + idx + 1,
-   tag-num_items - idx);
-   }
-
-   if (tag-num_items  0) {
-   tag-items = g_realloc(tag-items, items_size(tag));
-   } else {
-   g_free(tag-items);
-   tag-items = NULL;
-   }
-}
-
 void tag_free(struct tag *tag)
 {
int i;
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 12/23] locate: remove unused function locate_item_new().

2009-03-29 Thread Avuton Olrich
---
 src/locate.c |   13 -
 src/locate.h |4 
 2 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/src/locate.c b/src/locate.c
index f0b0a26..7e99a24 100644
--- a/src/locate.c
+++ b/src/locate.c
@@ -63,19 +63,6 @@ locate_item_init(struct locate_item *item,
return true;
 }
 
-struct locate_item *
-locate_item_new(const char *type_string, const char *needle)
-{
-   struct locate_item *ret = g_new(struct locate_item, 1);
-
-   if (!locate_item_init(ret, type_string, needle)) {
-   g_free(ret);
-   ret = NULL;
-   }
-
-   return ret;
-}
-
 void
 locate_item_list_free(struct locate_item_list *list)
 {
diff --git a/src/locate.h b/src/locate.h
index d0bdfa1..f9276b3 100644
--- a/src/locate.h
+++ b/src/locate.h
@@ -49,10 +49,6 @@ struct locate_item_list {
 int
 locate_parse_type(const char *str);
 
-/* returns NULL if not a known type */
-struct locate_item *
-locate_item_new(const char *type_string, const char *needle);
-
 /**
  * Allocates a new struct locate_item_list, and initializes all
  * members with zero bytes.
-- 
1.6.1.3


--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


Re: [Musicpd-dev-team] mpdconf example updates / remove exports and unused functions

2009-03-29 Thread Max Kellermann
On 2009/03/29 19:58, Avuton Olrich avu...@gmail.com wrote:
 These patches contain quite a few mpdconf updates, keeps from
 exporting when possible and remove unused functions.

Some of those unused functions were written because they might be
useful soon, I don't agree with some of the removes, but that's one
thing you couldn't possibly know.

I have merged the first few patches, and I will decide about the
others tomorrow (little time this evening ).

Max

--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team


[Musicpd-dev-team] [PATCH 1/1] Added the 'single' command

2009-03-29 Thread Romain Bignon
It also removes some trailing spaces...

Signed-off-by: Romain Bignon rom...@peerfuse.org
---
 doc/mpc-bashrc |8 
 doc/mpc.1  |7 +--
 src/command.c  |   42 --
 src/command.h  |3 ++-
 src/libmpdclient.c |   14 +-
 src/libmpdclient.h |4 
 src/main.c |3 ++-
 src/status.c   |   16 ++--
 8 files changed, 72 insertions(+), 25 deletions(-)

diff --git a/doc/mpc-bashrc b/doc/mpc-bashrc
index 946c85a..07f2580 100644
--- a/doc/mpc-bashrc
+++ b/doc/mpc-bashrc
@@ -9,13 +9,13 @@
cur=${COMP_WORDS[COMP_CWORD]}
first=${COMP_WORDS[1]}
hold=;
-   
+
# add more escape stuff as it's needed
# because bash is a woman:
scrub=s/\([()\;\`']\)/\\\1/g;
-   
+
case $first in
-   add) 
+   add)
hold=`mpc tab ${cur} | sed $scrub`;
COMPREPLY=($(compgen -W ${hold}))
return 0
@@ -57,7 +57,7 @@
COMPREPLY=($(compgen -W ${hold} | sed $scrub))
return 0
;;
-   repeat|random)
+   repeat|random|single)
COMPREPLY=($(compgen -W 0 1 true false yes no on off 
${cur}))
return 0
;;
diff --git a/doc/mpc.1 b/doc/mpc.1
index dd5d88b..77740a5 100644
--- a/doc/mpc.1
+++ b/doc/mpc.1
@@ -34,7 +34,7 @@ This command also takes the following defined escape 
sequences:
 .br
 Prevents the current song status from being printed on completion of some of
 the commands.
-.SH COMMANDS 
+.SH COMMANDS
 .TP
 .B add file
 Adds a song from the music database to the playlist. Can also read input from 
pipes. Use mpc ls | mpc add to add all files to the playlist.
@@ -71,7 +71,7 @@ Lists all files/folders in directory. If no directory is 
specified, lists al
 .TP
 .B lsplaylists
 Lists available playlists.
-.TP 
+.TP
 .B move from to
 Moves song at position from to the position to in the playlist.
 .TP
@@ -99,6 +99,9 @@ Toggle random mode if state (on or off) is not specified.
 .B repeat on|off
 Toggle repeat mode if state (on or off) is not specified.
 .TP
+.B single on|off
+Toggle single mode if state (on or off) is not specified.
+.TP
 .B rm file
 Deletes a specific playlist.
 .TP
diff --git a/src/command.c b/src/command.c
index 2f40aa6..1cdef39 100644
--- a/src/command.c
+++ b/src/command.c
@@ -4,7 +4,7 @@
Daniel Brown d...@cs.utexas.edu
  * Copyright (C) 2008-2009 Max Kellermann m...@duempel.org
  * 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
@@ -84,7 +84,7 @@ static mpd_Status * getStatus(mpd_Connection * conn) {
return ret;
 }
 
-int cmd_add (int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_add (int argc, char ** argv, mpd_Connection * conn )
 {
int i;
 
@@ -136,7 +136,7 @@ cmd_crop(mpd_unused int argc, mpd_unused char **argv, 
mpd_Connection *conn)
 
} else {
 
-   mpd_freeStatus(status); 
+   mpd_freeStatus(status);
DIE( You need to be playing to crop the playlist\n );
 
}
@@ -579,7 +579,7 @@ int cmd_listall ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-int cmd_update ( int argc, char ** argv, mpd_Connection * conn) 
+int cmd_update ( int argc, char ** argv, mpd_Connection * conn)
 {
const char * update = ;
int i = 0;
@@ -705,7 +705,7 @@ int cmd_load ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-static int do_search ( int argc, char ** argv, mpd_Connection * conn, int 
exact ) 
+static int do_search ( int argc, char ** argv, mpd_Connection * conn, int 
exact )
 {
Constraint *constraints;
int numconstraints;
@@ -737,17 +737,17 @@ static int do_search ( int argc, char ** argv, 
mpd_Connection * conn, int exact
return 0;
 }
 
-int cmd_search ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_search ( int argc, char ** argv, mpd_Connection * conn )
 {
return do_search(argc, argv, conn, 0);
 }
 
-int cmd_find ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_find ( int argc, char ** argv, mpd_Connection * conn )
 {
return do_search(argc, argv, conn, 1);
 }
 
-int cmd_list ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_list ( int argc, char ** argv, mpd_Connection * conn )
 {
Constraint *constraints;
int numconstraints = 0;
@@ -798,7 +798,7 @@ int cmd_list ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-int cmd_volume ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_volume ( int argc, char ** argv, mpd_Connection * conn )
 {
 struct int_value_change ch;
 
@@ -819,7 

[Musicpd-dev-team] [PATCH 1/1] Added the 'single' command

2009-03-29 Thread Romain Bignon
It also removes some trailing spaces...

Signed-off-by: Romain Bignon rom...@peerfuse.org
---
 doc/mpc-bashrc |8 
 doc/mpc.1  |7 +--
 src/command.c  |   42 --
 src/command.h  |3 ++-
 src/libmpdclient.c |   14 +-
 src/libmpdclient.h |4 
 src/main.c |3 ++-
 src/status.c   |   16 ++--
 8 files changed, 72 insertions(+), 25 deletions(-)

diff --git a/doc/mpc-bashrc b/doc/mpc-bashrc
index 946c85a..07f2580 100644
--- a/doc/mpc-bashrc
+++ b/doc/mpc-bashrc
@@ -9,13 +9,13 @@
cur=${COMP_WORDS[COMP_CWORD]}
first=${COMP_WORDS[1]}
hold=;
-   
+
# add more escape stuff as it's needed
# because bash is a woman:
scrub=s/\([()\;\`']\)/\\\1/g;
-   
+
case $first in
-   add) 
+   add)
hold=`mpc tab ${cur} | sed $scrub`;
COMPREPLY=($(compgen -W ${hold}))
return 0
@@ -57,7 +57,7 @@
COMPREPLY=($(compgen -W ${hold} | sed $scrub))
return 0
;;
-   repeat|random)
+   repeat|random|single)
COMPREPLY=($(compgen -W 0 1 true false yes no on off 
${cur}))
return 0
;;
diff --git a/doc/mpc.1 b/doc/mpc.1
index dd5d88b..77740a5 100644
--- a/doc/mpc.1
+++ b/doc/mpc.1
@@ -34,7 +34,7 @@ This command also takes the following defined escape 
sequences:
 .br
 Prevents the current song status from being printed on completion of some of
 the commands.
-.SH COMMANDS 
+.SH COMMANDS
 .TP
 .B add file
 Adds a song from the music database to the playlist. Can also read input from 
pipes. Use mpc ls | mpc add to add all files to the playlist.
@@ -71,7 +71,7 @@ Lists all files/folders in directory. If no directory is 
specified, lists al
 .TP
 .B lsplaylists
 Lists available playlists.
-.TP 
+.TP
 .B move from to
 Moves song at position from to the position to in the playlist.
 .TP
@@ -99,6 +99,9 @@ Toggle random mode if state (on or off) is not specified.
 .B repeat on|off
 Toggle repeat mode if state (on or off) is not specified.
 .TP
+.B single on|off
+Toggle single mode if state (on or off) is not specified.
+.TP
 .B rm file
 Deletes a specific playlist.
 .TP
diff --git a/src/command.c b/src/command.c
index 2f40aa6..1cdef39 100644
--- a/src/command.c
+++ b/src/command.c
@@ -4,7 +4,7 @@
Daniel Brown d...@cs.utexas.edu
  * Copyright (C) 2008-2009 Max Kellermann m...@duempel.org
  * 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
@@ -84,7 +84,7 @@ static mpd_Status * getStatus(mpd_Connection * conn) {
return ret;
 }
 
-int cmd_add (int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_add (int argc, char ** argv, mpd_Connection * conn )
 {
int i;
 
@@ -136,7 +136,7 @@ cmd_crop(mpd_unused int argc, mpd_unused char **argv, 
mpd_Connection *conn)
 
} else {
 
-   mpd_freeStatus(status); 
+   mpd_freeStatus(status);
DIE( You need to be playing to crop the playlist\n );
 
}
@@ -579,7 +579,7 @@ int cmd_listall ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-int cmd_update ( int argc, char ** argv, mpd_Connection * conn) 
+int cmd_update ( int argc, char ** argv, mpd_Connection * conn)
 {
const char * update = ;
int i = 0;
@@ -705,7 +705,7 @@ int cmd_load ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-static int do_search ( int argc, char ** argv, mpd_Connection * conn, int 
exact ) 
+static int do_search ( int argc, char ** argv, mpd_Connection * conn, int 
exact )
 {
Constraint *constraints;
int numconstraints;
@@ -737,17 +737,17 @@ static int do_search ( int argc, char ** argv, 
mpd_Connection * conn, int exact
return 0;
 }
 
-int cmd_search ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_search ( int argc, char ** argv, mpd_Connection * conn )
 {
return do_search(argc, argv, conn, 0);
 }
 
-int cmd_find ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_find ( int argc, char ** argv, mpd_Connection * conn )
 {
return do_search(argc, argv, conn, 1);
 }
 
-int cmd_list ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_list ( int argc, char ** argv, mpd_Connection * conn )
 {
Constraint *constraints;
int numconstraints = 0;
@@ -798,7 +798,7 @@ int cmd_list ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-int cmd_volume ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_volume ( int argc, char ** argv, mpd_Connection * conn )
 {
 struct int_value_change ch;
 
@@ -819,7 

[Musicpd-dev-team] [PATCH 2/2] support of the 'consume' mode

2009-03-29 Thread Romain Bignon

Signed-off-by: Romain Bignon rom...@peerfuse.org
---
 doc/mpc-bashrc |2 +-
 doc/mpc.1  |3 +++
 src/command.c  |   22 ++
 src/command.h  |1 +
 src/libmpdclient.c |   12 
 src/libmpdclient.h |4 
 src/main.c |1 +
 src/status.c   |6 +-
 8 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/doc/mpc-bashrc b/doc/mpc-bashrc
index 07f2580..91a23e5 100644
--- a/doc/mpc-bashrc
+++ b/doc/mpc-bashrc
@@ -57,7 +57,7 @@
COMPREPLY=($(compgen -W ${hold} | sed $scrub))
return 0
;;
-   repeat|random|single)
+   repeat|random|single|consume)
COMPREPLY=($(compgen -W 0 1 true false yes no on off 
${cur}))
return 0
;;
diff --git a/doc/mpc.1 b/doc/mpc.1
index 77740a5..59cdf1a 100644
--- a/doc/mpc.1
+++ b/doc/mpc.1
@@ -102,6 +102,9 @@ Toggle repeat mode if state (on or off) is not 
specified.
 .B single on|off
 Toggle single mode if state (on or off) is not specified.
 .TP
+.B consume on|off
+Toggle consume mode if state (on or off) is not specified.
+.TP
 .B rm file
 Deletes a specific playlist.
 .TP
diff --git a/src/command.c b/src/command.c
index 1cdef39..ffca54d 100644
--- a/src/command.c
+++ b/src/command.c
@@ -904,6 +904,28 @@ int cmd_single ( int argc, char ** argv, mpd_Connection * 
conn )
return 1;
 }
 
+int cmd_consume ( int argc, char ** argv, mpd_Connection * conn )
+{
+   int mode;
+
+   if(argc==1) {
+   mode = get_boolean(argv[0]);
+   if (mode  0)
+   return -1;
+   }
+   else {
+   mpd_Status * status;
+   status = getStatus(conn);
+   mode = !status-consume;
+   mpd_freeStatus(status);
+   }
+
+   mpd_sendConsumeCommand(conn,mode);
+   my_finishCommand(conn);
+
+   return 1;
+}
+
 int cmd_crossfade ( int argc, char ** argv, mpd_Connection * conn )
 {
int seconds;
diff --git a/src/command.h b/src/command.h
index 44ce035..4bec65a 100644
--- a/src/command.h
+++ b/src/command.h
@@ -51,6 +51,7 @@ int cmd_volume ( int argc, char ** argv, mpd_Connection * 
conn ) ;
 int cmd_repeat ( int argc, char ** argv, mpd_Connection * conn );
 int cmd_random ( int argc, char ** argv, mpd_Connection * conn );
 int cmd_single ( int argc, char ** argv, mpd_Connection * conn );
+int cmd_consume ( int argc, char ** argv, mpd_Connection * conn );
 int cmd_crossfade ( int argc, char ** argv, mpd_Connection * conn );
 int cmd_enable( int argc, char ** argv, mpd_Connection * conn );
 int cmd_disable( int argc, char ** argv, mpd_Connection * conn );
diff --git a/src/libmpdclient.c b/src/libmpdclient.c
index 74b6a80..738e203 100644
--- a/src/libmpdclient.c
+++ b/src/libmpdclient.c
@@ -679,6 +679,7 @@ mpd_Status * mpd_getStatus(mpd_Connection * connection) {
status-repeat = 0;
status-random = 0;
status-single = 0;
+   status-consume = 0;
status-playlist = -1;
status-playlistLength = -1;
status-state = -1;
@@ -712,6 +713,9 @@ mpd_Status * mpd_getStatus(mpd_Connection * connection) {
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);
}
@@ -1522,6 +1526,14 @@ void mpd_sendSingleCommand(mpd_Connection * connection, 
int singleMode) {
free(string);
 }
 
+void mpd_sendConsumeCommand(mpd_Connection * connection, int consumeMode) {
+   int len = strlen(consume)+2+INTLEN+3;
+   char *string = malloc(len);
+   snprintf(string, len, consume \%i\\n, consumeMode);
+   mpd_executeCommand(connection,string);
+   free(string);
+}
+
 void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange) {
int len = strlen(setvol)+2+INTLEN+3;
char *string = malloc(len);
diff --git a/src/libmpdclient.h b/src/libmpdclient.h
index ef09e4c..80bc5af 100644
--- a/src/libmpdclient.h
+++ b/src/libmpdclient.h
@@ -237,6 +237,8 @@ typedef struct mpd_Status {
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 */
@@ -511,6 +513,8 @@ void mpd_sendRandomCommand(mpd_Connection * connection, int 
randomMode);
 
 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: 

[Musicpd-dev-team] Single and consume modes

2009-03-29 Thread Romain Bignon
Hello,

I implemented few days ago the 'single' mode on MPD, and integrated support to
this feature in libmpdclient and ncmpc. Ncmpcpp has also implemented it.
I posted a patch bellow to support 'single' feature in mpc.

The 'single' mode plays song only once, or repeat it if the 'repeat' mode is
enabled.

I also implemented the 'consume' mode, which deletes each played song. Patches
on mpd, libmpdclient and ncmpc aren't pushed on master repository yet.

Other mpd clients can support now these modes too :)

Romain


pgpj5CfsoNyMK.pgp
Description: PGP signature
--
___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team