Blob
Date:
Sun Jun 12 21:18:04 2022 UTC
Message:
add a simpler example
.\" Copyright (c) 2022 Omar Polo <op@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd June 12, 2022
.Dt AMUSED 1
.Os
.Sh NAME
.Nm amused
.Nd music player
.Sh SYNOPSIS
.Nm
.Op Fl dv
.Op Fl s Ar socket
.Oo
.Ar command
.Op Ar argument ...
.Oc
.Sh DESCRIPTION
.Nm
is a music player daemon and command-line utility to plays music.
The server is started automatically in the background on demand.
.Pp
The following options are available:
.Bl -tag -width Ds
.It Fl d
Do not daemonize:
.Nm
will run in the foreground and log to standard error.
It's ignored if any commands are given on the command line or if the
server is already running.
.It Fl v
Produce more verbose output.
.It Fl s Ar socket
Use
.Ar socket
instead of the default
.Pa /tmp/amused-$UID
to communicate with the daemon.
.It Ar command Op Ar argument ...
Specify the command to run.
If no commands are specified,
.Ic status
is assumed.
.El
.Pp
The following commands are available:
.Bl -tag -width Ds
.It Cm add Ar
Enqueue the given files.
.It Cm flush
Erase the playlist.
.It Cm jump Ar pattern
Play the first song in the playing queue that matches
.Ar pattern
.Pq a basic case-insensitive regexp .
.It Cm load Op Ar file
Load a playlist from
.Ar file
or standard input.
A playlist is a list of paths to music files given one per line
and optionally prefixed by
.Sq > \&
or two spaces.
If the list was generated by
.Nm
.Ic show Fl p
restores also the position in the playlist, otherwise if already playing
something tries to match the currently playing song in the new list.
Failing that, the playlist will be played from the first track onwards.
.It Cm monitor Op Ar events
Stop indefinitely and print when an event in the comma-separated list of
.Ar events
happen.
By default logs every event.
The
.Ar events
are triggered either by other instances of
.Nm
issuing commands or the player itself anvancing through the playing
queue.
The events name take after the command name that generates it, e.g.\&
.Ar play ,
.Ar toggle ,
.Ar ...
.It Cm next
Play the next song.
.It Cm pause
Pause the playback.
.It Cm play
Start or resume the playback.
.It Cm prev
Play the previous song.
.It Cm repeat one|all on|off
Enable or disable the automatic repetition of the current track
.Pq Cm one
or of the whole playing queue
.Pq Cm all .
.It Cm restart
Rewind the current song to the beginning.
.It Cm show Op Fl p
Print the current playlist.
With
.Fl p
it prints a
.Dq pretty
list with the current playing song prefixed by
.Sq > \& .
.It Cm status
Print playback status and current song.
.It Cm stop
Stop the music player.
.It Cm toggle
Play/pause the playback.
.El
.Pp
Commands can be abbreviated to the smallest unique prefix, for example
.Sq rep
can be given instead of
.Sq repeat .
.Pp
.Nm
skips non-regular or not supported audio file found in the playing
queue implicitly and advances to the next item.
.Sh FILES
.Bl -tag -width "/tmp/amused-$UID" -compact
.It Pa /tmp/amused-$UID
.Ux Ns -domain
socket used for communication with the daemon.
.El
.Sh EXAMPLES
Enqueue all mp3 files in the current directory:
.Bd -literal -offset indent
$ amused add *.mp3
.Ed
.Pp
Recursively add all opus files:
.Bd -literal -offset indent
$ find . -type f -iname \\*.opus -exec amused add {} +
.Ed
.Pp
Load every file under the current directory recursively:
.Bd -literal -offset indent
$ find . | amused load
.Ed
.Pp
Save the state of the player to the file
.Pa state :
.Bd -literal -offset indent
$ amused show -p > state
.Ed
.Pp
Load a previous state:
.Bd -literal -offset indent
$ amused load < state
.Ed
.Pp
Shuffle the playlist:
.Bd -literal -offset indent
$ amused show | sort -R | amused load
.Ed
.Pp
Remove duplicates:
.Bd -literal -offset indent
$ amused show | sort | uniq | amused load
.Ed
.Pp
Select a song with
.Xr fzf 1
.Bd -literal -offset indent
$ amused jump "$(amused show | fzf +s)"
.Ed
.Sh AUTHORS
.An -nosplit
Then
.Nm
utility was written by
.An Omar Polo Aq Mt op@openbsd.org .
Omar Polo