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.
196 Files with non recognized audio format are skippend and removed from
197 the playlist too.
198 .Sh ENVIRONMENT
199 .Bl -tag -width AMUSED_STATUS_FORMAT
200 .It Ev AMUSED_STATUS_FORMAT
201 The default format used by
202 .Nm
203 .Cm status .
204 .El
205 .Sh FILES
206 .Bl -tag -width "/tmp/amused-$UID" -compact
207 .It Pa /tmp/amused-$UID
208 .Ux Ns -domain
209 socket used for communication with the daemon.
210 .El
211 .Sh EXAMPLES
212 Load every file under the current directory recursively:
213 .Bd -literal -offset indent
214 $ find . | amused load
215 .Ed
216 .Pp
217 Enqueue all mp3 files in the current directory:
218 .Bd -literal -offset indent
219 $ amused add *.mp3
220 .Ed
221 .Pp
222 Recursively add all opus files:
223 .Bd -literal -offset indent
224 $ find . -type f -iname \\*.opus -exec amused add {} +
225 .Ed
226 .Pp
227 Save the state of the player to the file
228 .Pa state :
229 .Bd -literal -offset indent
230 $ amused show -p > state
231 .Ed
232 .Pp
233 Load a previous state:
234 .Bd -literal -offset indent
235 $ amused load < state
236 .Ed
237 .Pp
238 Shuffle the playlist:
239 .Bd -literal -offset indent
240 $ amused show | sort -R | amused load
241 .Ed
242 .Pp
243 Remove duplicates:
244 .Bd -literal -offset indent
245 $ amused show | sort | uniq | amused load
246 .Ed
247 .Pp
248 Select a song with
249 .Xr fzf 1
250 .Bd -literal -offset indent
251 $ amused jump "$(amused show | fzf +s)"
252 .Ed
253 .Sh AUTHORS
254 .An -nosplit
255 Then
256 .Nm
257 utility was written by
258 .An Omar Polo Aq Mt op@openbsd.org .