attribute.c: Implement pattern matching for com_rmatt().
[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 afh 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] path1 ...
14 H: Each given path may be either the full path to an audio file, or the full path
15 H: of a directory. In case of a directory, all audio files in that directory
16 H: are added recursively.
17 H:
18 H: Options:
19 H:
20 H: -l   Add files lazily. If a file already exists in the database, skip this file.
21 H:      This operation is really cheap. Use it when adding large directories if only a
22 H:      few files where added.
23 H:
24 H:-f    Force adding/updating. Recompute the audio format handler data
25 H:      even if a file with the same path and the same hash value exists.
26 H:
27 H: -v   Verbose mode. Print what is being done.
28 ---
29 N: init
30 P: AFS_READ | AFS_WRITE
31 D: Initialize the osl tables for the audio file selector.
32 U: init [table_name ...]
33 H: When invoked without arguments, this command creates all tables. Otherwise
34 H: only the tables given by table_name... are created.
35 ---
36 N: afs_ls
37 P: AFS_READ
38 D: List audio files.
39 U: ls [-l[s|l|v|m]] -p -a -r -s{p|s|l|n|f|c|i|y|b|d|a} [pattern...]
40 H: Print a list of all audio files matching pattern.
41 H:
42 H: Options:
43 H:
44 H: -l   Change listing mode. Defaults to short listing if not given.
45 H:      -ls: short listing mode
46 H:      -ll: long listing mode (equivalent to -l)
47 H:      -lv: verbose listing mode
48 H:      -lm: mbox listing mode
49 H:
50 H: -p   List full path of audio file. If not specified, only the basename
51 H:      of each file is printed.
52 H:
53 H: -a   List only file that are admissible with respect to the current mood or
54 H:      playlist.
55 H:
56 H: -r   Reverse sort order.
57 H:
58 H: -s   Change sort order. Defaults to alphabetical path sort if not given.
59 H:
60 H:              -sp:  sort by path.
61 H:
62 H:              -sl:  sort by last played time.
63 H:
64 H:              -ss:  sort by score (implies -a).
65 H:
66 H:              -sn:  sort by num played count.
67 H:
68 H:              -sf:  sort by frequency.
69 H:
70 H:              -sc:  sort by number of channels.
71 H:
72 H:              -si:  sort by image id.
73 H:
74 H:              -sy:  sort by lyrics id.
75 H:
76 H:              -sb:  sort by bitrate.
77 H:
78 H:              -sd:  sort by duration.
79 H:
80 H:              -sa:  sort by audio format.
81 ---
82 N: lsatt
83 P: AFS_READ
84 D: List attributes
85 U: lsatt [-a] [-l]
86 H:
87 H: Print the list of all defined attributes.
88 H:
89 H: Options:
90 H:
91 H: -a   Sort attributes alphabetically by name. The default is to sort by
92 H:      identifier.
93 H:
94 H: -l   Print a long listing containing both identifier and attribute name. The
95 H:      default is to print only the name.
96 ---
97 N: setatt
98 P: AFS_READ | AFS_WRITE
99 D: Set attribute(s) for all files matching a pattern.
100 U: setatt attribute{+|-}... pattern
101 H: Set ('+') or unset ('-') the given attributes for all audio files matching
102 H: pattern.  Example:
103 H:
104 H:         sa rock+ punk+ classic- '*foo.mp3'
105 H:
106 H: sets the 'rock' and the 'punk' attribute but unsets the 'classic'
107 H: attribute of all files ending with 'foo.mp3'.
108 ---
109 N: addatt
110 P: AFS_READ | AFS_WRITE
111 D: Add new attribute(s).
112 U: addatt attribute1 [attribute2 ...]
113 H: This adds new attributes to the attribute table. At most 64 attributes
114 H: may be defined.
115 ---
116 N: check
117 P: AFS_READ
118 D: Run integrity checks against osl tables.
119 U: check [-a] [-m] [-p]
120 H: This command checks the audio file table, the mood definitions and all
121 H: defined playlists and reports any inconsistencies found.
122 H:
123 H: Options:
124 H:
125 H: -a   Run audio file table checks. Checks for entries in the audio file
126 H:      table which are not present in the filesystem. Moreover, it checks
127 H:      whether the lyrics id and all entries in the audio file table are
128 H:      valid.
129 H:
130 H: -m   Run syntax checks on all defined moods in the mood table.
131 H:
132 H: -p   Check all playlists for lines that correspond to files not contained
133 H:      in the audio file table.
134 H:
135 H: If called without arguments, all three checks are run.
136 ---
137 N: rmatt
138 P: AFS_READ | AFS_WRITE
139 D: Remove attribute(s).
140 U: rmatt pattern...
141 H: Remove all attributes matching any given pattern. All information
142 H: about this attribute in the audio file table is lost.
143 ---
144 N: afs_rm
145 P: AFS_READ | AFS_WRITE
146 D: Remove entries from the audio file table.
147 U: rm [-v] [-f] [-p] pattern...
148 H: Delete all entries in the audio file table that match any given pattern.
149 H: Note that affects the table entries only; paraslash won't touch your
150 H: audio files in any way.
151 H: Options:
152 H:
153 H: -v   Verbose mode. Explain what is being done.
154 H:
155 H: -f   Force mode. Ignore nonexistent files. Don't complain if nothing
156 H:      was removed.
157 H:
158 H: -p   Pathname match. Match a slash in the path only with a slash
159 H:      in pattern and not by an asterisk (*) or a question mark
160 H:      (?) metacharacter, nor by a bracket expression ([]) containing
161 H:      a slash (see fnmatch(3)).
162 ---
163 N: touch
164 P: AFS_READ | AFS_WRITE
165 D: Manupulate the afs data for all audio files matching a pattern.
166 U: touch [-n numplayed] [-l lastplayed] [-y lyrics_id] [-i image_id] [-v] [-p] pattern
167 H: If no option is given, lastplayed is set to the current time and numplayed is
168 H: increased by one. Otherwise, only the given options are taken into account.
169 H:
170 H: Options:
171 H:
172 H: -n   Set numplayed count. The number of times afs has selected this
173 H:      audio file for streaming.
174 H:
175 H: -l   Set lastplayed time. The last time this audio file was selected.
176 H:      Must be given as the number of sectonds since the epoch. Example:
177 H:
178 H:              touch -l $(date +%s) file
179 H:
180 H:      sets the lastplayed time of 'file' to the current time.
181 H:
182 H: -y   Set the lyrics id. Specify the lyrics data file associated with
183 H:      this audio file.
184 H:
185 H: -i   Set the image id. Same as -y, but sets the image.
186 H:
187 H: -v   Verbose mode. Explain what is being done.
188 H:
189 H: -p   Pathname match. Match a slash in the path only with a slash
190 H:      in pattern and not by an asterisk (*) or a question mark
191 H:      (?) metacharacter, nor by a bracket expression ([]) containing
192 H:      a slash (see fnmatch(3)).
193 ---
194 T: add
195 N: add@member@
196 O: int com_add@member@(int fd, int argc, char * const * const argv);
197 P: AFS_READ | AFS_WRITE
198 D: Read data from stdin and add it as a blob to an osl table.
199 U: add@member@ @member@_name
200 H: Each command of this family reads arbitrary binary data from stdin and sends
201 H: that data to the audio file selector process. The afs process then creates a
202 H: new blob for the data in the corresponding osl table. Example:
203 H:
204 H:      addimg foo.jpg < bar.jpg
205 H:
206 H: adds the contents of the file 'bar.jpg' as a blob named 'foo.jpg' to the image
207 H: table.  The names of the blobs of a table must be unique, i.e. it is an error
208 H: if an entry named 'foo.jpg' already exists.
209 ---
210 T: cat
211 N: cat@member@
212 O: int com_cat@member@(int fd, int argc, char * const * const argv);
213 P: AFS_READ
214 D: Dump the contents of a blob to stdout.
215 U: cat@member@ @member@_name
216 H: These commands may be used to retrieve the blob identified by the given name from
217 H: the corresponding osl table to which they were previously added.
218 ---
219 T: ls
220 N: ls@member@
221 O: int com_ls@member@(int fd, int argc, char * const * const argv);
222 P: AFS_READ
223 D: List blobs of an osl table matching a pattern.
224 U: ls@member@ [-v] [pattern]
225 H: Print a list of the names of all blobs in the corresponding osl table which
226 H: match the given pattern. If no pattern is given, the full list is printed. If
227 H: the optional -v pattern is given, the blob id is printed as well.
228 ---
229 T: rm
230 N: rm@member@
231 O: int com_rm@member@(int fd, int argc, char * const * const argv);
232 P: AFS_READ | AFS_WRITE
233 D: Remove blob(s) from an osl table.
234 U: rm@member@ pattern...
235 H: Remove all blobs from the corresponding table which match any given pattern.
236 ---
237 T: mv
238 N: mv@member@
239 O: int com_mv@member@(int fd, int argc, char * const * const argv);
240 P: AFS_READ | AFS_WRITE
241 D: Rename a blob.
242 U: mv@member@ old_@member@_name new_@member@_name
243 H: Rename the blob identified by the first name as the second name.