Blob


1 .\" Copyright (c) 2022 Omar Polo <op@openbsd.org>
2 .\"
3 .\" Permission to use, copy, modify, and distribute this software for any
4 .\" purpose with or without fee is hereby granted, provided that the above
5 .\" copyright notice and this permission notice appear in all copies.
6 .\"
7 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 .\"
15 .Dd July 9, 2022
16 .Dt AMUSED 1
17 .Os
18 .Sh NAME
19 .Nm amused
20 .Nd music player
21 .Sh SYNOPSIS
22 .Nm
23 .Op Fl dv
24 .Op Fl s Ar socket
25 .Oo
26 .Ar command
27 .Op Ar argument ...
28 .Oc
29 .Sh DESCRIPTION
30 .Nm
31 is a music player daemon and command-line utility to plays music.
32 The server is started automatically in the background on demand.
33 .Pp
34 The following options are available:
35 .Bl -tag -width Ds
36 .It Fl d
37 Do not daemonize:
38 .Nm
39 will run in the foreground and log to standard error.
40 It's ignored if any commands are given on the command line or if the
41 server is already running.
42 .It Fl v
43 Produce more verbose output.
44 .It Fl s Ar socket
45 Use
46 .Ar socket
47 instead of the default
48 .Pa /tmp/amused-$UID
49 to communicate with the daemon.
50 .It Ar command Op Ar argument ...
51 Specify the command to run.
52 If no commands are specified,
53 .Ic status
54 is assumed.
55 .El
56 .Pp
57 The following commands are available:
58 .Bl -tag -width Ds
59 .It Cm add Ar
60 Enqueue the given files.
61 .It Cm flush
62 Erase the playlist.
63 .It Cm jump Ar pattern
64 Play the first song in the playing queue that matches
65 .Ar pattern
66 .Pq a basic case-insensitive regexp .
67 .It Cm load Op Ar file
68 Load a playlist from
69 .Ar file
70 or standard input.
71 A playlist is a list of paths to music files given one per line
72 and optionally prefixed by
73 .Sq > \&
74 or two spaces.
75 If the list was generated by
76 .Nm
77 .Ic show Fl p
78 restores also the position in the playlist, otherwise if already playing
79 something tries to match the currently playing song in the new list.
80 Failing that, the playlist will be played from the first track onwards.
81 .It Cm monitor Op Ar events
82 Stop indefinitely and print when an event in the comma-separated list of
83 .Ar events
84 happen.
85 By default logs every event.
86 The
87 .Ar events
88 are triggered either by other instances of
89 .Nm
90 issuing commands or the player itself anvancing through the playing
91 queue.
92 The events name take after the command name that generates it, e.g.\&
93 .Ar play ,
94 .Ar toggle ,
95 .Ar ...
96 .It Cm next
97 Play the next song.
98 .It Cm pause
99 Pause the playback.
100 .It Cm play
101 Start or resume the playback.
102 .It Cm prev
103 Play the previous song.
104 .It Cm repeat one|all on|off
105 Enable or disable the automatic repetition of the current track
106 .Pq Cm one
107 or of the whole playing queue
108 .Pq Cm all .
109 .It Cm restart
110 Rewind the current song to the beginning.
111 It's a shorthand for
112 .Nm
113 .Cm seek
114 .Ar 0 .
115 .It Cm seek Oo Oo Ar hours : Oc Ns Ar minutes : Oc Ns Ar seconds | Ar percentage Ns %
116 Seek by the specified amount of time into the current song.
117 If the argument is prefixed by either
118 .Sq +
119 or
120 .Sq -
121 then the seek is done relative to the current position.
122 .It Cm show Op Fl p
123 Print the current playlist.
124 With
125 .Fl p
126 it prints a
127 .Dq pretty
128 list with the current playing song prefixed by
129 .Sq > \& .
130 .It Cm status Op Fl f Ar format
131 Print playback status and current song.
132 The
133 .Ar format
134 is a comma-separated list of words that select the information to
135 print, in order.
136 It defaults to
137 .Ev AMUSED_STATUS_FORMAT
138 or to
139 .Dq status,time,repeat
140 if not defined.
141 The format available are:
142 .Pp
143 .Bl -tag -compact -width time:percentage
144 .It path
145 Path of the current song
146 .It repeat:oneline
147 Repeat status in a single line.
148 .It repeat
149 Repeat all and repeat one status, one per line.
150 .It status
151 Playback status by the path to the current song.
152 .It time:oneline
153 Position and duration in a single line.
154 .It time:percentage
155 Percentage of the current position.
156 .It time:raw
157 Current position and duration in seconds.
158 .It time
159 Current position and duration in a human-readable format.
160 .El
161 .It Cm stop
162 Stop the music player.
163 .It Cm toggle
164 Play/pause the playback.
165 .El
166 .Pp
167 Commands can be abbreviated to a unique prefix, for example
168 .Sq rep
169 can be given instead of
170 .Sq repeat .
171 .Pp
172 .Nm
173 automatically skips and removes from the playlist non-regular files by
174 default.
175 Files with non recognized audio format are skippend and removed from
176 the playlist too.
177 .Sh ENVIRONMENT
178 .Bl -tag -width AMUSED_STATUS_FORMAT
179 .It Ev AMUSED_STATUS_FORMAT
180 The default format used by
181 .Nm
182 .Cm status .
183 .El
184 .Sh FILES
185 .Bl -tag -width "/tmp/amused-$UID" -compact
186 .It Pa /tmp/amused-$UID
187 .Ux Ns -domain
188 socket used for communication with the daemon.
189 .El
190 .Sh EXAMPLES
191 Enqueue all mp3 files in the current directory:
192 .Bd -literal -offset indent
193 $ amused add *.mp3
194 .Ed
195 .Pp
196 Recursively add all opus files:
197 .Bd -literal -offset indent
198 $ find . -type f -iname \\*.opus -exec amused add {} +
199 .Ed
200 .Pp
201 Load every file under the current directory recursively:
202 .Bd -literal -offset indent
203 $ find . | amused load
204 .Ed
205 .Pp
206 Save the state of the player to the file
207 .Pa state :
208 .Bd -literal -offset indent
209 $ amused show -p > state
210 .Ed
211 .Pp
212 Load a previous state:
213 .Bd -literal -offset indent
214 $ amused load < state
215 .Ed
216 .Pp
217 Shuffle the playlist:
218 .Bd -literal -offset indent
219 $ amused show | sort -R | amused load
220 .Ed
221 .Pp
222 Remove duplicates:
223 .Bd -literal -offset indent
224 $ amused show | sort | uniq | amused load
225 .Ed
226 .Pp
227 Select a song with
228 .Xr fzf 1
229 .Bd -literal -offset indent
230 $ amused jump "$(amused show | fzf +s)"
231 .Ed
232 .Sh AUTHORS
233 .An -nosplit
234 Then
235 .Nm
236 utility was written by
237 .An Omar Polo Aq Mt op@openbsd.org .