summaryrefslogtreecommitdiff
path: root/m4/lls/server_cmd.suite.m4
blob: ecbb87abc72832cb79c4fcf860de516c2bfb57d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
[suite server_cmd]
caption = list of server commands
aux_info_prefix = Permissions:

[introduction]
	The server process listens on a network socket and accepts connections
	from para_client or para_audiod. For the connection to succeed the
	connecting peer must authenticate as one of the users stored in the
	user table of para_server. Each entry of the user table contains the
	set of permission bits that are granted to the user. Authenticated
	users may execute one of the commands below if the set of permission
	bits of the command is a subset of the permission bits that are
	granted to the user.
[/introduction]

[subcommand add]
	purpose = add or update audio files
	non-opts-name = path...
	aux_info = AFS_READ | AFS_WRITE
	[description]
		Each path must be absolute and refer to either an audio file or a
		directory. In case of a directory, all audio files in that directory
		are added recursively. Note that the given paths refer to files or
		directories on the host on which para_server is running.
	[/description]
	[option all]
		short_opt = a
		summary = add all files
		[help]
			The default is to add only files ending in a known suffix for a
			supported audio format.
		[/help]
	[option lazy]
		short_opt = l
		summary = add files lazily
		[help]
			If the path already exists in the database, skip this file. This
			operation is really cheap. Useful to update large directories after
			some files have been added.
		[/help]
	[option force]
		short_opt = f
		summary = force adding/updating
		[help]
			Recompute the audio format handler data even if a file with the same
			path and the same hash value exists.
		[/help]
	[option verbose]
		short_opt = v
		summary = enable verbose mode
		[help]
			Print what is being done.
		[/help]

[subcommand addatt]
	purpose = add new attribute(s)
	non-opts-name = attribute...
	aux_info = AFS_READ | AFS_WRITE
	[description]
		This adds new attributes to the attribute table. At most 64 attributes
		may be defined.
	[/description]

[subcommand check]
	purpose = run integrity checks on database tables
	aux_info = AFS_READ
	[description]
		If no options are given, all checks are run.
	[/description]
	[option aft]
		short_opt = a
		summary = run audio file table checks
		[help]
			Report stale paths and invalid image and lyrics ids of the audio
			file table.
		[/help]
	[option attribute]
		short_opt = A
		summary = deprecated, has no effect, will be removed, so don't use
	[option mood]
		short_opt = m
		summary = check for invalid mood definitions
		[help]
			Run syntax checks on all moods of the mood table.
		[/help]
	[option playlist]
		short_opt = p
		summary = find invalid paths in playlists
		[help]
			Check all playlists for paths not contained in the audio file table.
		[/help]

[subcommand cpsi]
	purpose = copy selected parts of the audio file selector info
	non-opts-name = source pattern...
	aux_info = AFS_READ | AFS_WRITE
	[description]
		If no option, or only --verbose is given, all fields of the audio
		file selector info structure are copied to each row of the audio file
		table whose path matches at least one of the given patterns. Otherwise,
		only those fields which correspond to the given options are copied.
	[/description]
	[option attribute-bitmap]
		short_opt = a
		summary = copy the attribute bitmap
	[option image-id]
		short_opt = i
		summary = copy the image id
	[option lyrics-id]
		short_opt = y
		summary = copy the lyrics id
	[option lastplayed]
		short_opt = l
		summary = copy the lastplayed timestamp
	[option numplayed]
		short_opt = n
		summary = copy the numplayed counter
	[option verbose]
		short_opt = v
		summary = enable verbose mode

[subcommand ff]
	purpose = jump forward or backward in the current audio file
	synopsis = seconds
	aux_info = VSS_READ | VSS_WRITE
	[description]
		This enqueues a request to reposition the audio stream according to
		the argument, which may be a signed or an unsigned integer. Negative
		values correspond to backward jumps.

		If a negative number is given whose absolute value exceeds the current
		postition of the stream, a jump to the beginning of the audio file
		is performed. If a positive amount of seconds is given which exceeds
		the remaining time of the audio file, the next audio file is loaded.

	[/description]

[subcommand help]
	purpose = list available commands or print command-specific help
	non-opts-name = [command]
	aux_info = NO_PERMISSION_REQUIRED
	[description]
		When executed without any arguments, the available server commands
		are listed. Otherwise, if the first argument is the name of a server
		command, the description of this command is shown.
	[/description]
	m4_include(`long-help.m4')

[subcommand hup]
	purpose = reload config file, log file and user list
	aux_info = VSS_WRITE
	[description]
		Reread the config file and the user list file, close and reopen the log
		file, and ask the afs process to do the same. Sending the HUP signal
		to the server process has the same effect as running this command.
	[/description]

m4_include(`com_ll.m4')

[subcommand jmp]
	purpose = reposition the current stream
	non-opts-name = n
	aux_info = VSS_READ | VSS_WRITE
	[description]
		Set the 'R' (reposition request) bit of the vss status flags and
		enqueue a request to jump to n% of the current audio file, where 0 <=
		n <= 100.
	[/description]

[subcommand ls]
	purpose = list audio files which match a pattern
	non-opts-name = [pattern...]
	aux_info = AFS_READ
	[description]
		If no pattern is given, all files are listed.  Otherwise, the command
		lists all files of the audio file table whose path matches at least
		one of the given patterns.
	[/description]
	[option listing-mode]
		short_opt = l
		summary = use alternative output format
		arg_type = string
		arg_info = optional_arg
		typestr = mode
		default_val = long
		[help]
			The optional mode argument is either a single character or a word
			according to the following list.

			short (s). List only the path or basename (last component of the path),
			depending on whether -p is also given. This listing mode acts as if
			--listing-mode had not been given.

			long (l). Show detailed information. This is the default if no argument
			to --listing-mode is supplied.

			verbose (v). Multi-line output, one row per data field stored in the
			audio file table.

			parser-friendly (p). Like verbose listing mode, but use numerical
			values for the names of the output fields and prefix each line with
			a length field.
		[/help]
	[option limit]
		short_opt = L
		summary = list at most this many files
		arg_type = uint32
		arg_info = required_arg
		typestr = num
		[help]
			An argument of zero means "unlimited". This is also the default which
			applies if the option is not given.
		[/help]
	[option basename]
		short_opt = b
		summary = list and match basenames only
		[help]
			Print only the basename of each matching file and match only the
			basenames of the paths stored in the audio file table against the
			given patterns. The default is to print and match the full path.
		[/help]
	[option admissible]
		short_opt = a
		summary = list only admissible files
		arg_type = string
		arg_info = optional_arg
		typestr = specifier/name
		default_val = .
		[help]
			If the optional argument is supplied, it must be of the form "p/foo"
			or "m/bar" (which refer to the playlist named "foo" and the mood named
			"bar", respectively). The command then restricts its output to the set
			of files which are admissible with respect to the thusly identified
			mood or playlist.

			If no argument is given, or if the argument is the special value ".",
			the current mood or playlist is assumed.
		[/help]
	[option reverse]
		short_opt = r
		summary = reverse sort order
	[option unix-date]
		short_opt = d
		summary = print dates as seconds after the epoch
	[option sort]
		short_opt = s
		summary = change sort order
		arg_type = string
		arg_info = required_arg
		typestr = order
		default_val = path
		[help]
			The sort order must be given as an required argument. Like for
			--listing-mode, this argument may either be a single character or a
			word, according to the following list.

			path (p). Sort alphabetically by path or basename, depending on
			whether -b is given. This is the default if --sort is not given.

			score (s). Iterate over the entries of the score table, rather than
			the audio file table. This sort order implies --admissible, since
			the score table contains only admissible files.

			lastplayed (l)

			numplayed (n)

			frequency (f)

			channels (c)

			image-id (i)

			lyrics-id (y)

			bitrate (b)

			duration (d)

			audio-format (a)

			hash (h)

			If --sort is not given, path sort is implied.
		[/help]

[subcommand lsatt]
	purpose = list attributes
	aux_info = AFS_READ
	non-opts-name = pattern...
	[description]
		Print the list of all defined attributes which match the given
		pattern. If no pattern is given, the full list is printed.
	[/description]

	[option id-sort]
		short_opt = i
		summary = sort attributes by id
		[help]
			The default is to sort alphabetically by name.

			Attributes are internally represented as an 64 bit array. The attribute
			id is the bit number in this array.
		[/help]
	[option long]
		short_opt = l
		summary = print long listing
		[help]
			The long listing prints the attribute id in addition to the name of
			the attribute. The id is printed as a decimal number and is separated
			from the name by a tab character.
		[/help]
	[option reverse]
		short_opt = r
		summary = reverse sort order

[subcommand mvatt]
	purpose = rename an attribute
	synopsis = source dest
	aux_info = AFS_READ | AFS_WRITE
	[description]
		Rename the attribute given by the first argument to the destination
		given by the second argument. It is an error if the destination
		attribute exists.
	[/description]

[subcommand next]
	purpose = close the stream and start to stream the next audio file
	aux_info = VSS_READ | VSS_WRITE
	[description]
		Set the 'N' (next audio file) bit of the vss status flags. This
		instructs the server to close the current stream, if any. The 'P'
		(playing) bit is not modified by this command. If it is on, playing
		continues with the next audio file.

		This command is equivalent to stop if paused, and has no effect
		if stopped.
	[/description]

[subcommand nomore]
	purpose = stop playing after current audio file
	aux_info = VSS_READ | VSS_WRITE
	[description]
		Set the 'O' (no more) bit of the vss status flags which asks
		para_server to clear the 'P' (playing) bit after the 'N' (next audio
		file) bit transitions from off to on (because the end of the current
		audio file is reached). Use this command instead of stop if you don't
		like sudden endings.
	[/description]

[subcommand pause]
	purpose = suspend the current stream
	aux_info = VSS_READ | VSS_WRITE
	[description]
		Clear the 'P' (playing) bit of the vss status flags.
	[/description]

[subcommand play]
	purpose = start or resume playback
	aux_info = VSS_READ | VSS_WRITE
	[description]
		This operates on the status flags of the virtual streaming system as follows:
		Set the 'P' (playing) flag, clear the 'O' (nomore) flag, then check the
		value of the 'N' (next) flag. If it is set. open the next audio file and
		stream it. Otherwise, continue to stream the current file.
	[/description]
	[option next]
		short_opt = n
		summary = switch to the next file
		[help]
			This sets the 'N' (next) flag in addition to the 'P' flag. Equivalent to
			executing "next", then "play".
		[/help]

[subcommand rm]
	purpose = remove rows from the audio file table
	non-opts-name = pattern...
	aux_info = AFS_READ | AFS_WRITE
	[description]
		Remove all rows of the audio file table which match any of the given
		patterns. Note that this affects only the database table; the command
		won't touch your audio files on disk.
	[/description]
	[option verbose]
		short_opt = v
		summary = print paths of deleted rows
	[option force]
		short_opt = f
		summary = don't complain if nothing was removed
	[option pathname-match]
		short_opt = p
		summary = modify matching behaviour
		[help]
			Match a slash in the path only with a slash in pattern and not by an
			asterisk (*) or a question mark (?) metacharacter, nor by a bracket
			expression ([]) containing a slash (see fnmatch(3)).
		[/help]

[subcommand rmatt]
	purpose = remove attribute(s)
	non-opts-name = pattern...
	aux_info = AFS_READ | AFS_WRITE
	[description]
		Remove all attributes which match any given pattern. All information
		about the removed attributes in the audio file table is lost.
	[/description]

[subcommand select]
	purpose = activate a mood or a playlist
	non-opts-name = mop
	aux_info = AFS_READ | AFS_WRITE
	[description]
		The argument is either a special string or a string of the form
		"specifier/name", where the specifier is either "m" or "p" to indicate
		whether a playlist or a mood should be activated. For example, "select m/foo"
		activates the mood "foo".

		The following two special strings are supported: "-" activates the previous
		mood or playlist, and "." reloads the current mood or playlist, recomputing
		the score of each admissible file.
	[/description]
	[option verbose]
		short_opt = v
		summary = print information about the loaded mood or playlist

[subcommand sender]
	purpose = control paraslash senders
	synopsis = [sender subcmd [arguments]]
	aux_info = VSS_READ | VSS_WRITE
	[description]
		This command executes a subcommand for the given sender, which is either
		"http" or "udp". Various subcommands exist to print information about the
		sender, to activate and deactivate the sender, and to change the access
		permissions and targets. The following subcommands are available:

		       help, status, on, off, allow, deny, add, delete.

		All senders support the first four commands. The "allow" and "deny" commands
		are only supported by the http sender while "add" and "delete" are only
		supported by the udp sender. If no sender is given, the list of available
		senders is shown.

		Examples:

		Get help for the udp sender (contains further examples):

			sender udp help

		Show the access control list and the number of connected clients of
		the http sender:

			sender http status

		Senders may be activated and deactivated independently of each
		other. The following command switches off the http sender:

			sender http off

		Add an UDP unicast for a client to the target list of the UDP sender:

			sender udp add client.foo.org

		Start UDP multicast, using the default multicast address:

			sender udp add 224.0.1.38

	[/description]

[subcommand si]
	purpose = print server info
	aux_info = NO_PERMISSION_REQUIRED
	[description]
		Show server and afs PID, number of connections, uptime and more.
	[/description]

[subcommand stat]
	purpose = print information about the current audio file
	aux_info = VSS_READ
	[option num]
		short_opt = n
		summary = number of times to show the status info
		arg_info = required_arg
		arg_type = uint32
		typestr = num
		[help]
			Exit after the status information has been shown num times. If this
			option is not given, the command runs in an endless loop.
		[/help]
	[option parser-friendly]
		short_opt = p
		summary = enable parser-friendly output
		[help]
			Show status item identifiers as numerical values and prefix each
			status item with its size in bytes.
		[/help]

[subcommand stop]
	purpose = stop playback
	aux_info = VSS_READ | VSS_WRITE
	[description]
		Clear the 'P' (playing) bit and set the 'N' (next audio file) bit of
		the vss status flags, effectively stopping playback.
	[/description]

[subcommand term]
	purpose = ask the server to terminate
	aux_info = VSS_READ | VSS_WRITE
	[description]
		Shut down the server. Instead of this command, you can also send
		SIGINT or SIGTERM to the para_server process. It should never be
		necessary to send SIGKILL.
	[/description]

[subcommand touch]
	purpose = manipulate the afs information of audio files
	non-opts-name = pattern...
	aux_info = AFS_READ | AFS_WRITE
	[description]
		This command modifies the afs info structure of all rows of the audio
		file table whose path matches at least one of the given patters.

		If one or more options which affect the afs information are given, only
		the corresponding fields of the afs info structure are updated. All other
		fields stay unmodified. For example, "touch --numplayed=42" only modifies
		the numplayed field.

		If no such option is given, the lastplayed field is set to the current
		time and the value of the numplayed field is increased by one while
		all other fields are left unchanged. This mimics what happens when
		the virtual streaming system selects the file for streaming.

		If the file is admissible for the current mood, its score is recomputed.
	[/description]
	[option numplayed]
		short_opt = n
		summary = set the numplayed count manually
		arg_type = uint32
		arg_info = required_arg
		typestr = num
		[help]
			The numplayed count of an audio file is the number of times the file
			was selected for streaming. It is one of the inputs to the scoring
			function which determines the order in which admissible files are
			streamed.

			The virtual streaming system increases this number automatically each
			time it opens the file for streaming.
		[/help]
	[option lastplayed]
		short_opt = l
		summary = set the lastplayed time manually
		arg_type = uint64
		arg_info = required_arg
		typestr = num
		[help]
			The lastplayed time of an audio file is the time when the file was
			last opened for streaming.

			Like the numplayed count, it is an input for the scoring function
			and is updated automatically by the virtual streaming system.

			The argument must be a number of seconds since the epoch. Example:

				touch -l=$(date +%s) file

			sets the lastplayed time of 'file' to the current time.
		[/help]
	[option image-id]
		short_opt = i
		summary = set the image id
		arg_type = uint32
		arg_info = required_arg
		typestr = num
		[help]
			The afs info structure of each row of the audio file table contains
			a slot for the image id of the audio file that corresponds to the
			row. The image id stored in this slot refers to the key in the image
			table that identifies the blob.

			When a new audio file is added to the audio file table, its image
			id starts out as zero, indicating that there is no image associated
			with the file. Setting the image id to a non-zero number associates
			the file with a particular blob of the image table, for example the
			cover art of the album in jpg format.
		[/help]
	[option lyrics-id]
		short_opt = y
		summary = set the lyrics id
		arg_type = uint32
		arg_info = required_arg
		typestr = num
		[help]
			This option works just like --image-id, but sets the lyrics ID rather
			than the image id.
		[/help]
	[option amp]
		short_opt = a
		summary = set the amplification value (0-255)
		arg_type = uint32
		arg_info = required_arg
		typestr = num
		[help]
			The amplification value of an audio file is a number which is stored
			in the afs info structure.

			The value determines the scaling factor by which the amplitude of
			the decoded samples should be multiplied in order to normalize the
			volume. A value of zero means no amplification, 64 means the amplitude
			should be multiplied by a factor of two, 128 by three and so on.

			The amp filter of para_audiod amplifies the volume according to
			this value.
		[/help]
	[option set-attribute]
		short_opt = s
		summary = turn on a bit in the attribute bitmask of each matching file
		arg_type = string
		arg_info = required_arg
		typestr = attr
		default_val = none
		flag multiple
		[help]
			May be given more than once to set multiple attributes in one invocation.
		[/help]
	[option unset-attribute]
		short_opt = u
		summary = turn off a bit in the attribute bitmask of each matching file
		arg_type = string
		arg_info = required_arg
		typestr = attribute
		default_val = none
		flag multiple
		[help]
			Like --set-attribute, this may be given multiple times.
		[/help]
	[option verbose]
		short_opt = v
		summary = explain what is being done
	[option dry-run]
		summary = do not store the modified afs information
	[option pathname-match]
		short_opt = p
		summary = modify matching behaviour
		[help]
			Match a slash in the path only with a slash in pattern and not by an
			asterisk (*) or a question mark (?) metacharacter, nor by a bracket
			expression ([]) containing a slash (see fnmatch(3)).
		[/help]

[subcommand version]
	purpose = print the git version string of para_server
	aux_info = NO_PERMISSION_REQUIRED
	[option verbose]
		short_opt = v
		summary = print detailed (multi-line) version text

m4_define(`BLOB_COMMANDS', `
[subcommand rm`$2']
	purpose = remove `$1' blob(s)
	non-opts-name = pattern...
	aux_info = AFS_READ | AFS_WRITE
	[description]
		Remove all `$1' blobs which match any of the given patterns.
	[/description]

[subcommand mv`$2']
	purpose = rename `$1' blob(s)
	non-opts-name = source dest
	aux_info = AFS_READ | AFS_WRITE
	[description]
		Rename `$1' source to dest. The command fails if the source `$1'
		does not exist or if the destination `$1' already exists.
	[/description]

[subcommand add`$2']
	purpose = add a blob to the `$1' table
	non-opts-name = `$1'_name
	aux_info = AFS_READ | AFS_WRITE
	[description]
		Read from stdin and ask the audio file selector to create a blob in
		the `$1' table. If the named blob already exists, it gets replaced
		with the new data.
	[/description]

[subcommand cat`$2']
	purpose = dump a `$1' blob to stdout
	non-opts-name = `$1'_name
	aux_info = AFS_READ

[subcommand ls`$2']
	purpose = list blobs of type `$1' which match a pattern
	non-opts-name = [pattern...]
	aux_info = AFS_READ
	[description]
		Print the list of all blobs which match the given pattern. If no
		pattern is given, the full list is printed.
	[/description]
	[option id-sort]
		short_opt = i
		summary = sort by identifier
		[help]
			The default is to sort alphabetically by name.
		[/help]
	[option long]
		short_opt = l
		summary = long listing
		[help]
			Print identifier and name. The default is to print only the name.
		[/help]
	[option reverse]
		short_opt = r
		summary = reverse sort order
')

BLOB_COMMANDS(`moods', `mood')
BLOB_COMMANDS(`playlist', `pl')
BLOB_COMMANDS(`image', `img')
BLOB_COMMANDS(`lyrics', `lyr')