void option_set(const char *name, const char *value);
const char *option_label(const char *key);
int option_label_exists(const char *key);
-char **option_columns(const char *name, int *ncolumns);
#define DCGI_QUEUE 0x0001
#define DCGI_PLAYING 0x0002
/*
* This file is part of DisOrder.
- * Copyright (C) 2004-2008 Richard Kettlewell
+ * Copyright (C) 2004-2008, 2011 Richard Kettlewell
*
* 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
#include "disorder-cgi.h"
-struct column {
- int ncolumns;
- char **columns;
-};
-
+/** @brief State for parsing an options file */
struct read_options_state {
+ /** @brief Filename */
const char *name;
+
+ /** @brief Line number */
int line;
};
static hash *labels;
-static hash *columns;
static void option__readfile(const char *name);
option__readfile(vec[0]);
}
-static void option__columns(int nvec,
- char **vec) {
- struct column c;
-
- c.ncolumns = nvec - 1;
- c.columns = &vec[1];
- hash_add(columns, vec[0], &c, HASH_INSERT_OR_REPLACE);
-}
-
+/** @brief Definition of an option command */
static struct option {
+ /** @brief Command name */
const char *name;
- int minargs, maxargs;
+ /** @brief Minimum number of arguments */
+ int minargs;
+ /** @brief Maximum number of arguments */
+ int maxargs;
+ /** @brief Command handler */
void (*handler)(int nvec, char **vec);
} options[] = {
- { "columns", 1, INT_MAX, option__columns },
{ "include", 1, 1, option__include },
{ "label", 2, 2, option__label },
};
if(!have_read_options) {
have_read_options = 1;
labels = hash_new(sizeof (char *));
- columns = hash_new(sizeof (struct column));
option__readfile("options");
}
}
return !!hash_find(labels, key);
}
-/** @brief Return a column list
- * @param name Context (playing/recent/etc)
- * @param ncolumns Where to store column count or NULL
- * @return Pointer to column list
- */
-char **option_columns(const char *name, int *ncolumns) {
- struct column *c;
-
- option__init();
- c = hash_find(columns, name);
- if(c) {
- if(ncolumns)
- *ncolumns = c->ncolumns;
- return c->columns;
- } else {
- if(ncolumns)
- *ncolumns = 0;
- return 0;
- }
-}
-
/*
Local Variables:
c-basic-offset:2
exit(EXIT_FAILURE);
}
+/** @brief A scheduled event read from the server */
struct scheduled_event {
+ /** @brief When event should occur */
time_t when;
+
+ /** @brief Details of action */
struct kvp *actiondata;
+
+ /** @brief Event ID */
char *id;
};
exit(EXIT_FAILURE);
}
-static const struct command {
+/** @brief Command-line client's definition of a command */
+static const struct client_command {
+ /** @brief Command name */
const char *name;
- int min, max;
+
+ /** @brief Minimum number of argument */
+ int min;
+
+ /** @brief Maximum number of argument */
+ int max;
+
+ /** @brief Pointer to function implementing command */
void (*fn)(char **);
+
+ /** @brief Function to recognize a valid argument, or NULL */
int (*isarg)(const char *);
- const char *argstr, *desc;
+
+ /** @brief Summary of arguments */
+ const char *argstr;
+
+ /** @brief Description */
+ const char *desc;
} commands[] = {
{ "adduser", 2, 3, cf_adduser, isarg_rights, "USERNAME PASSWORD [RIGHTS]",
"Create a new user" },
/* Count of errors */
static long errors;
-/* Included/excluded filename patterns */
+/** @brief Included/excluded filename pattern */
static struct pattern {
struct pattern *next;
const char *pattern;
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/** @file clients/resample.c
+ * @brief Audio resampler
+ */
#include "common.h"
#include <unistd.h>
#include "disobedience.h"
#include "table.h"
+/** @brief Embedded image */
struct image {
+ /** @brief Image name */
const char *name;
+ /** @brief Image data in GDK pixbuf inline format */
const guint8 *data;
};
/** @brief Get entered new-playlist details
* @param namep Where to store entered name (or NULL)
* @param fullnamep Where to store computed full name (or NULL)
- * @param sharep Where to store 'shared' flag (or NULL)
+ * @param sharedp Where to store 'shared' flag (or NULL)
* @param publicp Where to store 'public' flag (or NULL)
* @param privatep Where to store 'private' flag (or NULL)
*/
}
/** @brief Update a section in the picker tree model
- * @param section Section name
+ * @param title Display name of section
+ * @param key Key to search for
* @param start First entry in @ref playlists
* @param end Past last entry in @ref playlists
*/
* @param title Display name of section
* @param key Key to search for
* @param iter Iterator to point at key
- * @param create If TRUE, key will be created if it doesn't exist
- * @param compare Row comparison function
+ * @param create Whether to create the row
* @return TRUE if key exists else FALSE
*
* If the @p key exists then @p iter will point to it and TRUE will be
GtkWidget *widget;
};
-/* The type of a preference is the collection of callbacks needed to get,
- * display and set it */
+/** @brief Type of a track preference
+ *
+ * The type of a preference is the collection of callbacks needed to get,
+ * display and set it.
+ */
struct preftype {
+ /** @brief Kick off the request to fetch the pref from the server. */
void (*kickoff)(struct prefdata *f);
- /* Kick off the request to fetch the pref from the server. */
+ /** @brief Called when the value comes back in; creates the widget. */
void (*completed)(struct prefdata *f);
- /* Called when the value comes back in; creates the widget. */
+ /** @brief Get the edited value from the widget. */
const char *(*get_edited)(struct prefdata *f);
- /* Get the edited value from the widget. */
/** @brief Update the edited value */
void (*set_edited)(struct prefdata *f, const char *value);
+ /** @brief Set the new value and (if necessary) arrange for our display to update. */
void (*set)(struct prefdata *f, const char *value);
- /* Set the new value and (if necessary) arrange for our display to update. */
};
/* A namepart pref */
set_boolean
};
-/* @brief The known prefs for each track */
+/** @brief The known prefs for each track */
static const struct pref {
const char *label; /**< @brief user-level description */
const char *part; /**< @brief protocol-level tag */
}
}
+/** @brief Old and new queue data
+ *
+ * Used when updating a @ref queuelike with new data from the server.
+ */
struct newqueue_data {
struct queue_entry *old, *new;
};
* @param w Source widget (the tree view)
* @param dc Drag context
* @param data Where to put the answer
- * @param info_ Target @c info parameter
+ * @param info Target @c info parameter
* @param time_ Time data requested (for some reason not a @c time_t)
* @param user_data The queuelike
*
See \fBdisorder_actions\fR(5) for a description of what the CGI does.
.PP
See \fBdisorder_options\fR(5) for CGI-specific configuration and
-\dBdisorder_config\fR(5) for general configuration.
+\fBdisorder_config\fR(5) for general configuration.
.PP
See \fBdisorder_templates\fR(5) for the template language used.
.SH "WHERE IS IT?"
.\"
-.\" Copyright (C) 2008 Richard Kettlewell
+.\" Copyright (C) 2008, 2011 Richard Kettlewell
.\"
.\" 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
.SH DIRECTIVES
Valid directives are:
.TP
-.B columns \fINAME\fR \fIHEADING\fR...
-Defines the columns used in \fB@playing@\fR and \fB@recent@\fB.
-\fINAME\fR must be either \fBplaying\fR, \fBrecent\fR or \fBsearch\fR.
-\fIHEADING\fR... is a list of heading names.
-If a column is defined more than once then the last definitions is used.
-.IP
-The heading names \fBbutton\fR, \fBlength\fR, \fBwhen\fR and \fBwho\fR
-are built in.
-.TP
.B include \fIPATH\fR
Includes another file.
If \fIPATH\fR starts with a \fB/\fR then it is taken as is, otherwise
Labels are not individually documented here, see the shipped
\fIoptions.labels\fR file instead.
.SH "OPTION FILES"
-The shipped \fIoptions\fR file includes four standard options files.
+The shipped \fIoptions\fR file includes two standard options files.
In order, they are:
.TP
.I options.labels
struct collection *s;
};
+/** @brief A track name part */
struct namepart {
char *part; /* part */
pcre *re; /* compiled regexp */
unsigned reflags; /* regexp flags */
};
+/** @brief A list of track name parts */
struct namepartlist {
int n;
struct namepart *s;
};
+/** @brief A track name transform */
struct transform {
char *type; /* track or dir */
char *context; /* sort or choose */
unsigned flags; /* regexp flags */
};
+/** @brief A list of track name transforms */
struct transformlist {
int n;
struct transform *t;
#include "eventdist.h"
#include "hash.h"
+/** @brief Event data
+ *
+ * @c event_data structures form linked lists; one list per event and one node
+ * per handler.
+ */
struct event_data {
+ /** @brief Next handler */
struct event_data *next;
+
+ /** @brief Name of event */
const char *event;
+
+ /** @brief Handler callback */
event_handler *callback;
+
+ /** @brief Passed to @ref callback */
void *callbackdata;
};
#include "eventlog.h"
#include "split.h"
+/** @brief Linked list of event logs */
static struct eventlog_output *outputs;
void eventlog_add(struct eventlog_output *lo) {
*pp = lo->next;
}
+/** @brief Write to the event log
+ * @param keyword Distinguishing keyword for event
+ * @param raw Unformatted data
+ * @param ap Extra data, terminated by (char *)0
+ */
static void veventlog(const char *keyword, const char *raw, va_list ap) {
struct eventlog_output *p, *pnext;
struct dynstr d;
#ifndef EVENTLOG_H
#define EVENTLOG_H
-/* definition of an event log output. The caller must allocate these
- * (since log.c isn't allowed to perform memory allocation). */
+/** @brief An output for the event log
+ *
+ * The caller must allocate these (since log.c isn't allowed to perform memory
+ * allocation). They form a linked list, using eventlog_add() and
+ * eventlog_remove().
+ */
struct eventlog_output {
+ /** @brief Next output */
struct eventlog_output *next;
+
+ /** @brief Handler for this output */
void (*fn)(const char *msg, void *user);
+
+ /** @brief Passed to @ref fn */
void *user;
};
+/** @brief Add an event log output
+ * @param lo Pointer to output to add
+ */
void eventlog_add(struct eventlog_output *lo);
-/* add a log output */
+/** @brief Remove an event log output
+ * @param lo Pointer to output to remove
+ */
void eventlog_remove(struct eventlog_output *lo);
-/* remove a log output */
+/** @brief Send a message to the event log
+ * @param keyword Distinguishing keyword for event
+ * @param ... Extra data, terminated by (char *)0
+ */
void eventlog(const char *keyword, ...);
+
+/** @brief Send a message to the event log
+ * @param keyword Distinguishing keyword for event
+ * @param raw Unformatted data
+ * @param ... Extra data, terminated by (char *)0
+ */
void eventlog_raw(const char *keyword, const char *raw, ...);
-/* send a message to the event log */
#endif /* EVENTLOG_H */
#include "log.h"
#include "kvp.h"
+/** @brief One entry in a hash table */
struct entry {
struct entry *next; /* next entry same key */
size_t h; /* hash of KEY */
void *value; /* value of this entry */
};
+/** @brief A hash table */
struct hash {
size_t nslots; /* number of slots */
size_t nitems; /* total number of entries */
#define F(n, h) { #n, offsetof(struct queue_entry, n), marshall_##h, unmarshall_##h, free_##h }
-static const struct field {
+/** @brief A field in a @ref queue_entry */
+static const struct queue_field {
+ /** @brief Field name */
const char *name;
+
+ /** @brief Offset of value in @ref queue_entry structure */
size_t offset;
+
+ /** @brief Marshaling function */
const char *(*marshall)(const struct queue_entry *q, size_t offset);
+
+ /** @brief Unmarshaling function */
int (*unmarshall)(char *data, struct queue_entry *q, size_t offset,
void (*error_handler)(const char *, void *),
void *u);
+
+ /** @brief Destructor */
void (*free)(struct queue_entry *q, size_t offset);
} fields[] = {
/* Keep this table sorted. */
* @param input_channels Number of input channels
* @param input_signed Whether input samples are signed or unsigned
* @param input_rate Frames/second in input
+ * @param input_endian Input endianness (@c ENDIAN_BIG or @c ENDIAN_LITTLE)
* @param output_bits Bits/sample in output
* @param output_channels Number of output channels
* @param output_rate Frames/second in output
* @param output_signed Whether output samples are signed or unsigned
+ * @param output_endian Output endianness (@c ENDIAN_BIG or @c ENDIAN_LITTLE)
*
* For formats with more than two channels it's assume that the first
* two channels are left and right. No particular meaning is attached
/** @brief Convert input samples to floats
* @param rs Resampler state
* @param bytes Input bytes
- * @param nbytes Number of input bytes
+ * @param nframes Number of input frames
* @param floats Where to store converted data
*
* @p floats must be big enough. As well as converting to floats this
#include "byte-order.h"
+/** @brief An audio resampler */
struct resampler {
- int input_bits, input_channels, input_rate, input_signed, input_endian;
- int output_bits, output_channels, output_rate, output_signed, output_endian;
+ /** @brief Bits/sample in input */
+ int input_bits;
+
+ /** @brief Number of input channels */
+ int input_channels;
+
+ /** @brief Frames/second in input */
+ int input_rate;
+
+ /** @brief Whether input samples are signed or unsigned */
+ int input_signed;
+
+ /** @brief Input endianness (@c ENDIAN_BIG or @c ENDIAN_LITTLE) */
+ int input_endian;
+
+ /** @brief Bits/sample in output */
+ int output_bits;
+
+ /** @brief Number of output channels */
+ int output_channels;
+
+ /** @brief Frames/second in output */
+ int output_rate;
+
+ /** @brief Whether output samples are signed or unsigned */
+ int output_signed;
+
+ /** @brief Output endianness (@c ENDIAN_BIG or @c ENDIAN_LITTLE) */
+ int output_endian;
+
+ /** @brief */
int input_bytes_per_sample;
+
+ /** @brief */
int input_bytes_per_frame;
#if HAVE_SAMPLERATE_H
+ /** @brief Libsamplerate handle */
SRC_STATE *state;
#endif
};
#include "table.h"
#include "signame.h"
+/** @brief Mapping between signal names and numbers */
static const struct sigtable {
+ /** @brief Signal number */
int signal;
+
+ /* @brief Signal name ("SIGwhatever") */
const char *name;
} signals[] = {
#define S(sig) { sig, #sig }
#include "printf.h"
#include "sink.h"
+/** @brief A @ref sink that stores to a fixed buffer
+ *
+ * If there is too much output, it is truncated.
+ */
struct fixedstr_sink {
+ /** @brief Base */
struct sink s;
+
+ /** @brief Output buffer */
char *buffer;
+
+ /** @brief Bytes written so far */
int nbytes;
+
+ /** @brief Size of buffer */
size_t size;
};
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
-/* strptime() is here reimplemented because the FreeBSD (and older MacOS) one
+/** @file lib/strptime.c
+ * @brief strptime() reimplementation
+ *
+ * strptime() is here reimplemented because the FreeBSD (and older MacOS) one
* is broken and does not report errors properly. See TODO remarks below for
- * some missing bits. */
+ * some missing bits.
+ */
#include <ctype.h>
#include <limits.h>
#include <langinfo.h>
#include "strptime.h"
+/** @brief Lookup table entry for locale-specific strings */
struct locale_item_match {
+ /** @brief Locale key to try */
nl_item key;
+
+ /** @brief Value to return if value of @ref key matches subject string */
int value;
};
#ifndef STRPTIME_H
#define STRPTIME_H
+/** @file lib/strptime.h
+ * @brief strptime() reimplementation
+ */
#include <time.h>
#define H(name) { #name, offsetof(DB_HASH_STAT, name) }
#define B(name) { #name, offsetof(DB_BTREE_STAT, name) }
+/** @brief Table of libdb stats to return */
static const struct statinfo {
const char *name;
size_t offset;
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
-/** @file lib/validity.c
+/** @file lib/validity.h
* @brief Various validity checks
*/
#ifndef VALIDITY_H
/* libFLAC's "simplified" interface is rather heavyweight... */
+/** @brief State used when computing FLAC file length */
struct flac_state {
+ /** @brief Duration or -1 */
long duration;
+
+ /** @brief File being analyzed */
const char *path;
};
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/** @file plugins/tracklength.h
+ * @brief Plugin to compute track lengths
+ */
#ifndef TRACKLENGTH_H
#define TRACKLENGTH_H
"""Base class for DisOrder exceptions."""
class _splitError(Error):
+ """Error parsing a quoted string list"""
# _split failed
def __init__(self, value):
self.value = value
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** @file server/decode.c
+/** @file server/decode-flac.c
* @brief General-purpose decoder for use by speaker process
*/
#include "decode.h"
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** @file server/decode.c
+/** @file server/decode-ogg.c
* @brief General-purpose decoder for use by speaker process
*/
#include "decode.h"
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** @file server/decode.c
+/** @file server/decode-wav.c
* @brief General-purpose decoder for use by speaker process
*/
#include "decode.h"
/* periodic actions --------------------------------------------------------- */
+/** @brief A job executed periodically by the server */
struct periodic_data {
+ /** @brief Callback to process job */
void (*callback)(ev_source *);
+
+ /** @brief Period of job in seconds */
int period;
};
# define SOSUFFIX ".so"
#endif
+/** @brief A loaded plugin */
struct plugin {
+ /** @brief Next plugin */
struct plugin *next;
+
+ /** @brief Handle returned from dlopen() */
void *dlhandle;
+
+ /** @brief Plugin name */
const char *name;
};
;
}
+/** @brief State for the recheck phase of the rescan */
struct recheck_state {
+ /** @brief Collection being rechecked */
const struct collection *c;
- long nobsolete, nnocollection, nlength;
+
+ /** @brief Number of tracks obsoleted */
+ long nobsolete;
+
+ /** @brief Number of tracks belonging to no collection */
+ long nnocollection;
+
+ /** @brief Number of lengths computed */
+ long nlength;
+
+ /** @brief Linked list of tracks to recheck */
struct recheck_track *tracks;
};
+/** @brief A track to recheck
+ *
+ * A node in a linked list.
+ */
struct recheck_track {
+ /** @brief Next track */
struct recheck_track *next;
+
+ /** @brief Track */
const char *track;
};
return 1;
}
-static const struct command {
+/** @brief Server's definition of a command */
+static const struct server_command {
/** @brief Command name */
const char *name;
pkgdata_DATA=about.tmpl choose.tmpl playing.tmpl recent.tmpl \
prefs.tmpl help.tmpl error.tmpl \
new.tmpl login.tmpl macros.tmpl \
- options options.labels \
- options.columns
+ options options.labels
pkghttp_DATA=disorder.css
EXTRA_DIST=${pkgdata_DATA} $(pkghttp_DATA)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!--
This file is part of DisOrder.
-Copyright (C) 2004-2009 Richard Kettlewell
+Copyright (C) 2004-2011 Richard Kettlewell
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
<div class=section>
- <p>Copyright © 2003-2009 <a
+ <p>Copyright © 2003-2011 <a
href="http://www.greenend.org.uk/rjk/">Richard Kettlewell</a><br>
Portions copyright © 2007 <a
This file is part of DisOrder.
-Copyright (C) 2008, 2009 Richard Kettlewell
+Copyright (C) 2008, 2009, 2011 Richard Kettlewell
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
<a href="http://www.greenend.org.uk/rjk/disorder/"
title="DisOrder web site">DisOrder
version @version</a>
- © 2003-2009 Richard Kettlewell et al
+ © 2003-2011 Richard Kettlewell et al
</p>}
@# Expand to the time that @id will be played
# default label values
include options.labels
-# default columns
-include options.columns
-
# user overrides - you supply this
include options.user
+++ /dev/null
-columns playing when who artist album title length button
-columns recent when who artist album title length
-columns search artist album title