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