chiark / gitweb /
Merge playlist support.
authorRichard Kettlewell <rjk@greenend.org.uk>
Sat, 10 Oct 2009 20:03:23 +0000 (21:03 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sat, 10 Oct 2009 20:03:23 +0000 (21:03 +0100)
16 files changed:
1  2 
clients/disorder.c
disobedience/Makefile.am
disobedience/disobedience.c
disobedience/disobedience.h
disobedience/menu.c
doc/disorder.1.in
doc/disorder_protocol.5.in
lib/Makefile.am
lib/client.c
lib/configuration.c
lib/configuration.h
lib/trackdb.c
python/disorder.py.in
server/dump.c
server/server.c
tests/Makefile.am

index ccfaf20cb2d2613757ed37bf3eb0846e5fac946e,4161d939cb141ef6e294a610f1a197d2267123b8..a246eee9950eaf9436801abe4f1bed55bc09ad80
@@@ -32,7 -32,7 +32,8 @@@
  #include <unistd.h>
  #include <pcre.h>
  #include <ctype.h>
 +#include <gcrypt.h>
+ #include <langinfo.h>
  
  #include "configuration.h"
  #include "syscalls.h"
@@@ -51,7 -51,7 +52,8 @@@
  #include "vector.h"
  #include "version.h"
  #include "dateparse.h"
 +#include "trackdb.h"
+ #include "inputline.h"
  
  static disorder_client *client;
  
index c7b702bc32ca5bb0a6948ba5932d997b9ee9d596,94a4c786e9b146d5a18d117dc200ec4a4bdf00f3..f8bdb140962dde17fa768bf4f75eac13625ca445
@@@ -28,9 -28,9 +28,9 @@@ disobedience_SOURCES=disobedience.h dis
        choose.c choose-menu.c choose-search.c popup.c misc.c           \
        control.c properties.c menu.c log.c progress.c login.c rtp.c    \
        help.c ../lib/memgc.c settings.c users.c lookup.c choose.h      \
-       popup.h
+       popup.h playlists.c
  disobedience_LDADD=../lib/libdisorder.a $(LIBPCRE) $(LIBGC) $(LIBGCRYPT) \
 -      $(LIBASOUND) $(COREAUDIO) $(LIBDB)
 +      $(LIBASOUND) $(COREAUDIO) $(LIBDB) $(LIBICONV)
  disobedience_LDFLAGS=$(GTK_LIBS)
  
  install-exec-hook:
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc lib/Makefile.am
index 4717fd616b7b59c48cba9cbaf0bc0a6e178558ff,ca0e82d194ac14af7ba631983e0533aa13f94e23..d0890e1ce936ab8b29adedbdb9cb8be18beeee13
@@@ -78,12 -79,9 +78,13 @@@ libdisorder_a_SOURCES=charset.c charset
        table.c table.h                                 \
        timeval.h                                       \
        $(TRACKDB) trackdb.h trackdb-int.h              \
+       trackdb-playlists.c                             \
        trackname.c trackorder.c trackname.h            \
        tracksort.c                                     \
 +      uaudio.c uaudio-thread.c uaudio.h uaudio-apis.c \
 +      uaudio-oss.c uaudio-alsa.c                      \
 +      uaudio-coreaudio.c                              \
 +      uaudio-rtp.c uaudio-command.c uaudio-schedule.c \
        url.h url.c                                     \
        user.h user.c                                   \
        unicode.h unicode.c                             \
diff --cc lib/client.c
Simple merge
index dc3d0092b6c8216081b4e794a848cf6f15362826,cd83224cb50138a678b80a7f35a462f714abfeef..ff59968fac21cbb8b18a176250284af6029e6b30
@@@ -945,8 -949,9 +945,10 @@@ static const struct conf conf[] = 
    { C(nice_speaker),     &type_integer,          validate_any },
    { C(noticed_history),  &type_integer,          validate_positive },
    { C(password),         &type_string,           validate_any },
 +  { C(pause_mode),       &type_string,           validate_pausemode },
    { C(player),           &type_stringlist_accum, validate_player },
+   { C(playlist_lock_timeout), &type_integer,     validate_positive },
+   { C(playlist_max) ,    &type_integer,          validate_positive },
    { C(plugins),          &type_string_accum,     validate_isdir },
    { C(prefsync),         &type_integer,          validate_positive },
    { C(queue_pad),        &type_integer,          validate_positive },
index 875b9d627851d3573d05868bc8864ebfe243ed06,54fb4f8eebff6abbd7c7b5910a54c41fa2d1056d..9170a2f2b752c118e937099a1fa38e116a4015d1
@@@ -182,9 -176,36 +182,15 @@@ struct config 
    /** @brief Sox syntax generation */
    long sox_generation;
  
 -  /** @brief API used to play sound
 -   *
 -   * Choices are @ref BACKEND_ALSA, @ref BACKEND_COMMAND or @ref
 -   * BACKEND_NETWORK.
 -   */
 -  int api;
 +  /** @brief API used to play sound */
 +  const char *api;
  
 -/* These values had better be non-negative */
 -#define BACKEND_ALSA 0                        /**< Use ALSA (Linux only) */
 -#define BACKEND_COMMAND 1             /**< Execute a command */
 -#define BACKEND_NETWORK 2             /**< Transmit RTP  */
 -#define BACKEND_COREAUDIO 3           /**< Use Core Audio (Mac only) */
 -#define BACKEND_OSS 4                 /**< Use OSS */
 -
 -#if HAVE_ALSA_ASOUNDLIB_H
 -# define DEFAULT_BACKEND BACKEND_ALSA
 -#elif HAVE_SYS_SOUNDCARD_H || EMPEG_HOST
 -# define DEFAULT_BACKEND BACKEND_OSS
 -#elif HAVE_COREAUDIO_AUDIOHARDWARE_H
 -# define DEFAULT_BACKEND BACKEND_COREAUDIO
 -#else
 -# error Cannot choose a default backend
 -#endif
 -
+   /** @brief Maximum size of a playlist */
+   long playlist_max;
+   /** @brief Maximum lifetime of a playlist lock */
+   long playlist_lock_timeout;
    /** @brief Home directory for state files */
    const char *home;
  
diff --cc lib/trackdb.c
index 83a67af3f1a499f9fb28677bff087993ecc35d46,b98752f6e59a13e5b18fbbfaab1f183e3761507a..a188caaf1e96ec3c4cd81525cb486443f996c1b9
@@@ -472,7 -479,8 +479,8 @@@ void trackdb_open(int flags) 
    trackdb_noticeddb = open_db("noticed.db",
                               DB_DUPSORT, DB_BTREE, dbflags, 0666);
    trackdb_scheduledb = open_db("schedule.db", 0, DB_HASH, dbflags, 0666);
 -  if(!trackdb_existing_database) {
 +  if(!trackdb_existing_database && !(flags & TRACKDB_READ_ONLY)) {
+   trackdb_playlistsdb = open_db("playlists.db", 0, DB_HASH, dbflags, 0666);
      /* Stash the database version */
      char buf[32];
  
Simple merge
diff --cc server/dump.c
Simple merge
diff --cc server/server.c
index 8bd23e74329227ea0bda09779357ab20c0f14727,320cbb174ec94c0f925d8e607773d03e6193fc8d..ce45a1dd6a968c7c116fbb061638f545a4c3fbe6
@@@ -1314,19 -1358,19 +1367,9 @@@ static int c_userinfo(struct conn *c
  static int c_users(struct conn *c,
                   char attribute((unused)) **vec,
                   int attribute((unused)) nvec) {
-   /* TODO de-dupe with c_tags */
-   char **users = trackdb_listusers();
-   sink_writes(ev_writer_sink(c->w), "253 User list follows\n");
-   while(*users) {
-     sink_printf(ev_writer_sink(c->w), "%s%s\n",
-               **users == '.' ? "." : "", *users);
-     ++users;
-   }
-   sink_writes(ev_writer_sink(c->w), ".\n");
-   return 1;                           /* completed */
+   return list_response(c, "User list follows", trackdb_listusers());
  }
  
 -/** @brief Base64 mapping table for confirmation strings
 - *
 - * This is used with generic_to_base64() and generic_base64().  We cannot use
 - * the MIME table as that contains '+' and '=' which get quoted when
 - * URL-encoding.  (The CGI still does the URL encoding but it is desirable to
 - * avoid it being necessary.)
 - */
 -static const char confirm_base64_table[] =
 -  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/.*";
 -
  static int c_register(struct conn *c,
                      char **vec,
                      int attribute((unused)) nvec) {
index dfe742488bf67c7f225cfe244b35ea884e61358a,be3d73b69e84219b2ae52dfd3bfe1aafd4e33720..5563f7fbeb61c590ed53df901d39033c8e73407f
@@@ -26,7 -26,7 +26,7 @@@ disorder_udplog_DEPENDENCIES=../lib/lib
  
  TESTS=cookie.py dbversion.py dump.py files.py play.py queue.py        \
        recode.py search.py user-upgrade.py user.py aliases.py  \
-       schedule.py hashes.py
 -      schedule.py playlists.py
++      schedule.py hashes.py playlists.py
  
  TESTS_ENVIRONMENT=${PYTHON} -u