From: Richard Kettlewell Date: Sat, 10 Oct 2009 20:03:23 +0000 (+0100) Subject: Merge playlist support. X-Git-Tag: 5.0~86^2~4 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/c9467b7a34160c4e25580a2dc82087c5ae0bb2d0 Merge playlist support. --- c9467b7a34160c4e25580a2dc82087c5ae0bb2d0 diff --cc clients/disorder.c index ccfaf20,4161d93..a246eee --- a/clients/disorder.c +++ b/clients/disorder.c @@@ -32,7 -32,7 +32,8 @@@ #include #include #include +#include + #include #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; diff --cc disobedience/Makefile.am index c7b702b,94a4c78..f8bdb14 --- a/disobedience/Makefile.am +++ b/disobedience/Makefile.am @@@ -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: diff --cc lib/Makefile.am index 4717fd6,ca0e82d..d0890e1 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@@ -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/configuration.c index dc3d009,cd83224..ff59968 --- a/lib/configuration.c +++ b/lib/configuration.c @@@ -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 }, diff --cc lib/configuration.h index 875b9d6,54fb4f8..9170a2f --- a/lib/configuration.h +++ b/lib/configuration.h @@@ -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; + /** @brief Maximum size of a playlist */ + long playlist_max; + + /** @brief Maximum lifetime of a playlist lock */ + long playlist_lock_timeout; + -/* 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 Home directory for state files */ const char *home; diff --cc lib/trackdb.c index 83a67af,b98752f..a188caa --- a/lib/trackdb.c +++ b/lib/trackdb.c @@@ -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 && !(flags & TRACKDB_READ_ONLY)) { + trackdb_playlistsdb = open_db("playlists.db", 0, DB_HASH, dbflags, 0666); - if(!trackdb_existing_database) { /* Stash the database version */ char buf[32]; diff --cc server/server.c index 8bd23e7,320cbb1..ce45a1d --- a/server/server.c +++ b/server/server.c @@@ -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) { diff --cc tests/Makefile.am index dfe7424,be3d73b..5563f7f --- a/tests/Makefile.am +++ b/tests/Makefile.am @@@ -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