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 play 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 consume Op Cm on|off
62 When consume mode is enabled the tracks are removed from the playlist
63 once played til the end.
64 .It Cm flush
65 Erase the playlist.
66 .It Cm jump Ar pattern
67 Play the first song in the playing queue that matches
68 .Ar pattern
69 .Pq a basic case-insensitive regexp .
70 .It Cm load Op Ar file
71 Load a playlist from
72 .Ar file
73 or standard input.
74 A playlist is a list of paths to music files given one per line
75 and optionally prefixed by
76 .Sq > \&
77 or two spaces.
78 If the list was generated by
79 .Nm
80 .Ic show Fl p
81 restore also the position in the playlist.
82 Otherwise, if already playing something, try to match the currently
83 song in the new list.
84 Failing that, the playlist will be played from the first track
85 onwards.
86 .It Cm monitor Op Ar events
87 Stop indefinitely and print when an event in the comma-separated list
88 of
89 .Ar events
90 happened, or all if not given.
91 The available
92 .Ar events
93 are:
94 .Pp
95 .Bl -tag -compact -width Ds
96 .It add
97 Added a song to the playlist.
98 .It jump
99 Jumped to a different song in the playlist.
100 .It load
101 Loaded a new playlist.
102 .It mode
103 Mode changed
104 .Pq repeat or consume .
105 .It next
106 Advanced to next song.
107 .It pause
108 Paused.
109 .It play
110 Playing or resuming a song.
111 .It prev
112 Gone back to previous song.
113 .It seek
114 Seeked in the current track.
115 .It stop
116 Stopped.
117 .El
118 .It Cm next
119 Play the next song.
120 .It Cm pause
121 Pause the playback.
122 .It Cm play
123 Start or resume the playback.
124 .It Cm prev
125 Play the previous song.
126 .It Cm repeat one|all Op Cm on|off
127 Enable or disable the automatic repetition of the current track
128 .Pq Cm one
129 or of the whole playing queue
130 .Pq Cm all .
131 .It Cm restart
132 Rewind the current song to the beginning.
133 It's a shorthand for
134 .Nm
135 .Cm seek
136 .Ar 0 .
137 .It Cm seek Oo Oo Ar hours : Oc Ns Ar minutes : Oc Ns Ar seconds | Ar percentage Ns %
138 Seek by the specified amount of time into the current song.
139 If the argument is prefixed by either
140 .Sq +
141 or
142 .Sq -
143 then the seek is relative to the current position.
144 .It Cm show Op Fl p
145 Show the playlist.
146 With
147 .Fl p
148 it prints a
149 .Dq pretty
150 list with the current playing song prefixed by
151 .Sq > \& .
152 .It Cm status Op Fl f Ar format
153 Print playback status and current song.
154 The
155 .Ar format
156 is a comma-separated list of words that select the information to
157 print, in order.
158 It defaults to
159 .Ev AMUSED_STATUS_FORMAT
160 or to
161 .Dq status,time,repeat
162 if not defined.
163 The format available are:
164 .Pp
165 .Bl -tag -compact -width time:percentage
166 .It path
167 Path of the current song
168 .It repeat:oneline
169 Repeat status in a single line.
170 .It repeat
171 Repeat all and repeat one status, one per line.
172 .It status
173 Playback status by the path to the current song.
174 .It time:oneline
175 Position and duration in a single line.
176 .It time:percentage
177 Percentage of the current position.
178 .It time:raw
179 Current position and duration in seconds.
180 .It time
181 Current position and duration in a human-readable format.
182 .El
183 .It Cm stop
184 Stop the music player.
185 .It Cm toggle
186 Play/pause the playback.
187 .El
188 .Pp
189 Commands can be abbreviated to a unique prefix, for example
190 .Sq rep
191 can be given instead of
192 .Sq repeat .
193 .Pp
194 .Nm
195 automatically skips and removes from the playlist non-regular files by
196 default.
197 Files with non recognized audio format are skippend and removed from
198 the playlist too.
199 .Sh ENVIRONMENT
200 .Bl -tag -width AMUSED_STATUS_FORMAT
201 .It Ev AMUSED_STATUS_FORMAT
202 The default format used by
203 .Nm
204 .Cm status .
205 .El
206 .Sh FILES
207 .Bl -tag -width "/tmp/amused-$UID" -compact
208 .It Pa /tmp/amused-$UID
209 .Ux Ns -domain
210 socket used for communication with the daemon.
211 .El
212 .Sh EXAMPLES
213 Enqueue all mp3 files in the current directory:
214 .Bd -literal -offset indent
215 $ amused add *.mp3
216 .Ed
217 .Pp
218 Recursively add all opus files:
219 .Bd -literal -offset indent
220 $ find . -type f -iname \\*.opus -exec amused add {} +
221 .Ed
222 .Pp
223 Load every file under the current directory recursively:
224 .Bd -literal -offset indent
225 $ find . | amused load
226 .Ed
227 .Pp
228 Save the state of the player to the file
229 .Pa state :
230 .Bd -literal -offset indent
231 $ amused show -p > state
232 .Ed
233 .Pp
234 Load a previous state:
235 .Bd -literal -offset indent
236 $ amused load < state
237 .Ed
238 .Pp
239 Shuffle the playlist:
240 .Bd -literal -offset indent
241 $ amused show | sort -R | amused load
242 .Ed
243 .Pp
244 Remove duplicates:
245 .Bd -literal -offset indent
246 $ amused show | sort | uniq | amused load
247 .Ed
248 .Pp
249 Select a song with
250 .Xr fzf 1
251 .Bd -literal -offset indent
252 $ amused jump "$(amused show | fzf +s)"
253 .Ed
254 .Sh AUTHORS
255 .An -nosplit
256 Then
257 .Nm
258 utility was written by
259 .An Omar Polo Aq Mt op@openbsd.org .