sched.c: Add checks for empty lists.
[paraslash.git] / afs.cmd
1 OF: afs_command_list
2 SF: afs.c aft.c attribute.c
3 HC: Prototypes for the commands of the audio file selector.
4 CC: Array of commands for the audio file selector.
5 AT: server_command
6 IN: para error string afh afs server list user_list
7 SN: list of afs commands
8 TM: mood lyr img pl
9 ---
10 N: add
11 P: AFS_READ | AFS_WRITE
12 D: Add new audio files to the database.
13 U: add [-l] [-f] [-v] path...
14 H: Each given path may be either the full path to an audio
15 H: file, or the full path of a directory. In case of a
16 H: directory, all audio files in that directory are added
17 H: recursively. Only absolute paths are accepted.
18 H:
19 H: Options:
20 H:
21 H: -a   Add all files. The default is to add only files ending in a
22 H:      known suffix for a supported audio format.
23 H:
24 H: -l   Add files lazily. If the path already exists in the
25 H:      database, skip this file.  This operation is really cheap.
26 H:      Use it when adding large directories if only a few files
27 H:      where added.
28 H:
29 H:-f    Force adding/updating. Recompute the audio format handler data
30 H:      even if a file with the same path and the same hash value exists.
31 H:
32 H: -v   Verbose mode. Print what is being done.
33 ---
34 N: init
35 P: AFS_READ | AFS_WRITE
36 D: Initialize the osl tables for the audio file selector.
37 U: init [table_name ...]
38 H: When invoked without arguments, this command creates all tables. Otherwise
39 H: only the tables given by table_name... are created.
40 ---
41 N: ls
42 P: AFS_READ
43 D: List audio files.
44 U: ls [-l[s|l|v|m]] -p -a -r -s{p|s|l|n|f|c|i|y|b|d|a} [pattern...]
45 H: Print a list of all audio files matching pattern.
46 H:
47 H: Options:
48 H:
49 H: -l   Change listing mode. Defaults to short listing if not given.
50 H:
51 H:              -ls:   short listing mode
52 H:
53 H:              -ll:   long listing mode (equivalent to -l)
54 H:
55 H:              -lv:   verbose listing mode
56 H:
57 H:              -lm:   mbox listing mode
58 H:
59 H: -p   List full path of audio file. If not specified, only the basename
60 H:      of each file is printed.
61 H:
62 H: -a   List only files that are admissible with respect to the current mood or
63 H:      playlist.
64 H:
65 H: -r   Reverse sort order.
66 H:
67 H: -s   Change sort order. Defaults to alphabetical path sort if not given.
68 H:
69 H:              -sp:  sort by path.
70 H:
71 H:              -sl:  sort by last played time.
72 H:
73 H:              -ss:  sort by score (implies -a).
74 H:
75 H:              -sn:  sort by num played count.
76 H:
77 H:              -sf:  sort by frequency.
78 H:
79 H:              -sc:  sort by number of channels.
80 H:
81 H:              -si:  sort by image id.
82 H:
83 H:              -sy:  sort by lyrics id.
84 H:
85 H:              -sb:  sort by bit rate.
86 H:
87 H:              -sd:  sort by duration.
88 H:
89 H:              -sa:  sort by audio format.
90 ---
91 N: lsatt
92 P: AFS_READ
93 D: List attributes
94 U: lsatt [-i] [-l] [-r] [pattern]
95 H: Print the list of all defined attributes which match the
96 H: given pattern. If no pattern is given, the full list is
97 H: printed.
98 H:
99 H: Options:
100 H:
101 H: -i   Sort attributes by id. The default is to sort alphabetically by name.
102 H:
103 H: -l   Print a long listing containing both identifier and attribute name. The
104 H:      default is to print only the name.
105 H:
106 H: -r   Reverse sort order.
107 ---
108 N: setatt
109 P: AFS_READ | AFS_WRITE
110 D: Set attribute(s) for all files matching a pattern.
111 U: setatt attribute{+|-}... pattern
112 H: Set ('+') or unset ('-') the given attributes for all audio files matching
113 H: pattern.  Example:
114 H:
115 H:         setatt rock+ punk+ classic- '*foo.mp3'
116 H:
117 H: sets the 'rock' and the 'punk' attribute but unsets the 'classic'
118 H: attribute of all files ending with 'foo.mp3'.
119 ---
120 N: addatt
121 P: AFS_READ | AFS_WRITE
122 D: Add new attribute(s).
123 U: addatt attribute1...
124 H: This adds new attributes to the attribute table. At most 64
125 H: attributes may be defined.
126 ---
127 N: mvatt
128 P: AFS_READ | AFS_WRITE
129 D: Rename an attribute.
130 U: mvatt old new
131 H: Rename attribute old to new.
132 ---
133 N: check
134 P: AFS_READ
135 D: Run integrity checks against osl tables.
136 U: check [-a] [-m] [-p]
137 H: Check the audio file table, the mood definitions and all
138 H: defined playlists and report any inconsistencies found.
139 H:
140 H: Options:
141 H:
142 H: -a   Run audio file table checks. Checks for entries in the audio file
143 H:      table which are not present in the file system. Moreover, it checks
144 H:      whether the lyrics id and all entries in the audio file table are
145 H:      valid.
146 H:
147 H: -m   Run syntax checks on all defined moods in the mood table.
148 H:
149 H: -p   Check all playlists for lines that correspond to files not contained
150 H:      in the audio file table.
151 H:
152 H: If called without arguments, all three checks are run.
153 ---
154 N: rmatt
155 P: AFS_READ | AFS_WRITE
156 D: Remove attribute(s).
157 U: rmatt pattern...
158 H: Remove all attributes matching any given pattern. All information
159 H: about this attribute in the audio file table is lost.
160 ---
161 N: rm
162 P: AFS_READ | AFS_WRITE
163 D: Remove entries from the audio file table.
164 U: rm [-v] [-f] [-p] pattern...
165 H: Delete all entries in the audio file table that match any given pattern.
166 H: Note that affects the table entries only; paraslash won't touch your
167 H: audio files in any way.
168 H: Options:
169 H:
170 H: -v   Verbose mode. Explain what is being done.
171 H:
172 H: -f   Force mode. Ignore nonexistent files. Don't complain if nothing
173 H:      was removed.
174 H:
175 H: -p   Pathname match. Match a slash in the path only with a slash
176 H:      in pattern and not by an asterisk (*) or a question mark
177 H:      (?) metacharacter, nor by a bracket expression ([]) containing
178 H:      a slash (see fnmatch(3)).
179 ---
180 N: touch
181 P: AFS_READ | AFS_WRITE
182 D: Manipulate the afs data for all audio files matching a pattern.
183 U: touch [-n numplayed] [-l lastplayed] [-y lyrics_id] [-i image_id] [-v] [-p] pattern
184 H: If no option is given, lastplayed is set to the current time
185 H: and numplayed is increased by one. Otherwise, only the given
186 H: options are taken into account.
187 H:
188 H: Options:
189 H:
190 H: -n   Set numplayed count. The number of times afs has selected this
191 H:      audio file for streaming.
192 H:
193 H: -l   Set lastplayed time. The last time this audio file was selected.
194 H:      Must be given as the number of seconds since the epoch. Example:
195 H:
196 H:              touch -l $(date +%s) file
197 H:
198 H:      sets the lastplayed time of 'file' to the current time.
199 H:
200 H: -y   Set the lyrics id. Specify the lyrics data file associated with
201 H:      this audio file.
202 H:
203 H: -i   Set the image id. Same as -y, but sets the image.
204 H:
205 H: -v   Verbose mode. Explain what is being done.
206 H:
207 H: -p   Pathname match. Match a slash in the path only with a slash
208 H:      in pattern and not by an asterisk (*) or a question mark
209 H:      (?) metacharacter, nor by a bracket expression ([]) containing
210 H:      a slash (see fnmatch(3)).
211 ---
212 N: cpsi
213 P: AFS_READ | AFS_WRITE
214 D: Copy audio file selector info.
215 U: cpsi [-a] [-y] [-i] [-l] [-n] [-v] source pattern...
216 H: If no option, or only the -v option is given, all fields of
217 H: the audio file selector info are copied to all files
218 H: matching pattern.  Otherwise, only the given options are
219 H: taken into account.
220 H:
221 H: Options:
222 H:
223 H: -a   Copy attributes.
224 H:
225 H: -y   Copy the lyrics id.
226 H:
227 H: -i   Copy the image id.
228 H:
229 H: -l   Copy the lastplayed time.
230 H:
231 H: -n   Copy the numplayed count.
232 H:
233 H: -v   Verbose mode.
234 ---
235 N: select
236 P: AFS_READ | AFS_WRITE
237 D: Activate a mood or a playlist.
238 U: select specifier/name
239 H: The specifier is either 'm' or 'p' to indicate whether a playlist or
240 H: a mood should be activated. Example:
241 H:
242 H:      select m/foo
243 H:
244 H: loads the mood named 'foo'.
245 ---
246 T: add
247 N: add@member@
248 O: int com_add@member@(int fd, int argc, char * const * const argv);
249 P: AFS_READ | AFS_WRITE
250 D: Read data from stdin and add it as a blob to the @member@ table.
251 U: add@member@ @member@_name
252 H: Read arbitrary binary data from stdin and send that data to
253 H: the audio file selector process which creates a new blob for
254 H: the data in the corresponding osl table.
255 H:
256 H: The names of the blobs of a table are unique. If an entry with the
257 H: given name already exists, its contents are replaced by the new data.
258 ---
259 T: cat
260 N: cat@member@
261 O: int com_cat@member@(int fd, int argc, char * const * const argv);
262 P: AFS_READ
263 D: Dump the contents of a blob of type @member@ to stdout.
264 U: cat@member@ @member@_name
265 H: This command may be used to retrieve the blob identified by
266 H: the given name from the corresponding osl table to which
267 H: they were previously added.
268 ---
269 T: ls
270 N: ls@member@
271 O: int com_ls@member@(int fd, int argc, char * const * const argv);
272 P: AFS_READ
273 D: List blobs of type @member@ matching a pattern.
274 U: ls@member@ [-i] [-l] [-r] [pattern]
275 H: Print a list of the names of all blobs in the corresponding
276 H: osl table which match the given pattern. If no pattern is
277 H: given, the full list is printed.
278 H:
279 H: Options:
280 H:
281 H: -i   Sort attributes by id. The default is to sort
282 H:      alphabetically by name.
283 H:
284 H: -l   Print a long listing containing both identifier and
285 H:      attribute name. The default is to print only the name.
286 H:
287 H: -r   Reverse sort order.
288 ---
289 T: rm
290 N: rm@member@
291 O: int com_rm@member@(int fd, int argc, char * const * const argv);
292 P: AFS_READ | AFS_WRITE
293 D: Remove blob(s) of type @member@ from the @member@ table.
294 U: rm@member@ pattern...
295 H: Remove all blobs from the corresponding table which match
296 H: any given pattern.
297 ---
298 T: mv
299 N: mv@member@
300 O: int com_mv@member@(int fd, int argc, char * const * const argv);
301 P: AFS_READ | AFS_WRITE
302 D: Rename a blob of type @member@.
303 U: mv@member@ old_@member@_name new_@member@_name
304 H: Rename the blob identified by the first name as the second name.