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