]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
make the playlist selector use command_util.sh
authorAndre <maan@meins.(none)>
Sat, 20 Jan 2007 18:11:36 +0000 (19:11 +0100)
committerAndre <maan@meins.(none)>
Sat, 20 Jan 2007 18:11:36 +0000 (19:11 +0100)
Also, add random_selector.cmd which should have been includes already in the
previous patch.

Makefile.in
configure.ac
playlist_selector.c
playlist_selector.cmd [new file with mode: 0644]
random_selector.cmd [new file with mode: 0644]

index 87569955ddb5c835af72bebb1d82b39902e2f674..e416d53e261a01dc13f85d6218561b3d37a33c81 100644 (file)
@@ -181,6 +181,17 @@ random_selector_command_list.h: random_selector.cmd
        echo 'extern struct server_command random_selector_cmds[];' > $@
        ./command_util.sh proto < $< >> $@
 
+playlist_selector_command_list.c: playlist_selector.cmd playlist_selector_command_list.h
+       echo '#include "server.h"' > $@
+       echo '#include "user_list.h"' >> $@
+       echo '#include "playlist_selector_command_list.h"' >> $@
+       echo 'struct server_command playlist_selector_cmds[] = {' >>$@
+       ./command_util.sh array < $< >>$@
+       echo '{.name = NULL}};' >> $@
+playlist_selector_command_list.h: playlist_selector.cmd
+       echo 'extern struct server_command playlist_selector_cmds[];' > $@
+       ./command_util.sh proto < $< >> $@
+
 ortp_recv.o: ortp_recv.c
        $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ortp_cppflags@ $<
 
index c6797cbfb09067c8937e519a4af346fc24c5a069..1ab497a8f99ec42cdb17504aef781417a702747b 100644 (file)
@@ -80,7 +80,8 @@ audiod_errlist_objs="audiod signal string daemon stat net
 audiod_ldflags=""
 audiod_audio_formats=""
 
-server_cmdline_objs="server.cmdline server_command_list random_selector_command_list"
+server_cmdline_objs="server.cmdline server_command_list random_selector_command_list
+       playlist_selector_command_list"
 server_errlist_objs="server mp3_afh vss command net string signal random_selector
        time daemon stat crypt http_send db close_on_fork playlist_selector
        ipc dccp dccp_send fd user_list"
index 010c9d21e05a6bbde2092e6433d458d65e7657c7..c40976d4635f1fb04fd0ebae422410e4c6651b23 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2006-2007 Andre Noll <maan@systemlinux.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
@@ -25,6 +25,7 @@
 #include "string.h"
 #include "ipc.h"
 #include "user_list.h"
+#include "playlist_selector_command_list.h"
 
 /**
  * structure used for transmission of the playlist
@@ -62,34 +63,8 @@ static unsigned playlist_len, playlist_size, current_playlist_entry;
 static char **playlist;
 static struct audio_file_selector *self;
 
-static int com_ppl(int, int, char **);
-static int com_lpl(int, int, char **);
 extern struct misc_meta_data *mmd;
 
-/* array of supported commands */
-static struct server_command cmds[] = {
-{
-.name = "ppl",
-.handler = com_ppl,
-.perms = DB_READ,
-.description = "print playlist",
-.synopsis = "ppl",
-.help =
-"Print out the current playlist"
-}, {
-.name = "lpl",
-.handler = com_lpl,
-.perms = DB_WRITE,
-.description = "load playlist",
-.synopsis = "lpl",
-.help =
-"Read a new playlist from stdin. Example:\n"
-"\tfind /audio -name '*.mp3' | para_client lpl"
-}, {
-.name = NULL,
-}
-};
-
 static void playlist_add(char *path)
 {
        if (playlist_len >= playlist_size) {
@@ -143,7 +118,7 @@ out:
        return ret;
 }
 
-static int com_lpl(int fd, __a_unused int argc, __a_unused char *argv[])
+int com_lpl(int fd, __a_unused int argc, __a_unused char *argv[])
 {
        unsigned loaded = 0;
        size_t bufsize = 4096; /* guess that's enough */
@@ -174,7 +149,7 @@ out:
        return ret;
 }
 
-static int com_ppl(int fd, __a_unused int argc, __a_unused char *argv[])
+int com_ppl(int fd, __a_unused int argc, __a_unused char *argv[])
 {
        unsigned i;
 
@@ -316,7 +291,7 @@ int playlist_selector_init(struct audio_file_selector *db)
        void *shm = NULL;
 
        self = db;
-       db->cmd_list = cmds;
+       db->cmd_list = playlist_selector_cmds;
        db->get_audio_file_list = pls_get_audio_file_list;
        db->shutdown = pls_shutdown;
        db->post_select = pls_post_select;
diff --git a/playlist_selector.cmd b/playlist_selector.cmd
new file mode 100644 (file)
index 0000000..9f073a5
--- /dev/null
@@ -0,0 +1,13 @@
+N: ppl
+P: DB_READ
+D: print playlist
+S: ppl
+H: Print out the current playlist
+---
+N: lpl
+P: DB_WRITE
+D: load playlist
+S: lpl
+H: Read a new playlist from stdin. Example:
+H: find /audio -name '*.mp3' | para_client lpl
+---
diff --git a/random_selector.cmd b/random_selector.cmd
new file mode 100644 (file)
index 0000000..929c7ee
--- /dev/null
@@ -0,0 +1,5 @@
+N: random_info
+P: 0
+D: about the random audio file selector
+S: random_info
+H: The random selector chooses files randomly out of the given directory.