Max,

Please pull the latest *handler script improvements from my tree from:

git://git.musicpd.org/avuton/mpc.git handler-fixes


 They should all be posix compatible and they'll fix 1709.

------------------>
Avuton Olrich (6):
      Move the 'handlers' to show the they are specifically for MPD,
in the case they end up installed.
      Rather then put examples of how to parse playlist entries with
mpc in the man page, refer to the scripts that are distributed in the
doc directory.
      Don't automatically assume the user wants their old playlist
cleared and to play after a playlist is added.
      Quote parameter expansions.
      Rather then pipe use a file redirector.
      Remove the unnecessary grep by excluding streams then printing
only when necessary.



diff --git a/doc/m3u-handler.sh b/doc/m3u-handler.sh
deleted file mode 100755
index f8d76dd..0000000
--- a/doc/m3u-handler.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-test $# -ne 1 && echo "$0 takes 1 argument" && exit 1
-test ! -e $1 && echo "Argument ($1) needs to be a file" && exit 2
-mpc clear
-cat $1 | mpc add
-mpc play
diff --git a/doc/mpc.1 b/doc/mpc.1
index 81b17a6..0103737 100644
--- a/doc/mpc.1
+++ b/doc/mpc.1
@@ -156,30 +156,8 @@ via Unix Domain Socket.
 To use a password with mpd, set MPD_HOST to passw...@host.
 .SH "EXAMPLES"
 .TP
-Here is a script to load and play m3u playlists (useful for mozilla):
 .br
-
-.br
-#!/bin/bash
-.br
-mpc clear
-.br
-cat $1 | mpc add
-.br
-mpc play
-.br
-.TP
-This script can be used to load and play pls playlists (again, useful
for mozilla):
-.br
-
-.br
-#!/bin/bash
-.br
-mpc clear
-.br
-grep '^File[0-9]*' $1 | sed -e 's/^File[0-9]*=//' | mpc add
-.br
-mpc play
+For useful examples of mpc use in playlist parsing, see
mpd-m3u-playlist.sh and mpd-pls-playlist.sh.
 .br
 .SH "BUGS"
 Report bugs on http://www.musicpd.org/mantis/
diff --git a/doc/mpd-m3u-handler.sh b/doc/mpd-m3u-handler.sh
new file mode 100755
index 0000000..8868403
--- /dev/null
+++ b/doc/mpd-m3u-handler.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+test $# -ne 1 && echo "$0 takes 1 argument" && exit 1
+test ! -e "$1" && echo "Argument ($1) needs to be a file" && exit 2
+mpc add < "$1"
diff --git a/doc/mpd-pls-handler.sh b/doc/mpd-pls-handler.sh
new file mode 100755
index 0000000..55aa77d
--- /dev/null
+++ b/doc/mpd-pls-handler.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+test $# -ne 1 && echo "$0 takes 1 argument" && exit 1
+test ! -e "$1" && echo "Argument ($1) needs to be a file" && exit 2
+sed -ne 's/^File[0-9]*=//p' "$1" | mpc add
diff --git a/doc/pls-handler.sh b/doc/pls-handler.sh
deleted file mode 100755
index 1f41558..0000000
--- a/doc/pls-handler.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-test $# -ne 1 && echo "$0 takes 1 argument" && exit 1
-test ! -e $1 && echo "Argument ($1) needs to be a file" && exit 2
-mpc clear
-grep '^File[0-9]*' $1 | sed -e 's/^File[0-9]*=//' | mpc add
-mpc play
-- 
avuton
--
|  (\_/)  This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.

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

Reply via email to