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