aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: fbc5ffaba7dc3c78a368c0fadd84d2e6fdff529b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# RSPlayer is a daemon driven CLI music player with scrobbling written in rust

## Installation
```
git clone https://codeberg.org/salmonik/RSPlayer.git
cd RSPlayer
./install.sh
```

install.sh will:  
- compile RSP (make sure you have rust properly installed!)
- install shell autocompletions (zsh, bash and fish supported)
- install user systemd service and activate it

## FreeBSD

FreeBSD is supported out of the box; no code changes or extra Rust crates are needed.
The audio backend (cpal) uses ALSA on FreeBSD, which is provided by the ports as a
userspace shim over the kernel's OSS (/dev/dsp).

Requirements:
```
pkg install alsa-lib alsa-plugins   # audio: ALSA API + OSS backend plugin (mandatory)
pkg install cmake                   # build-time only, for the rustls TLS stack (aws-lc-sys)
pkg install rust                    # if you don't have a Rust toolchain yet
```

Build and install (FreeBSD convention is /usr/local/bin):
```
cargo build --release
install -m 755 target/release/rsp /usr/local/bin/rsp
```

`install.sh` does all of the above on FreeBSD and additionally installs an rc.d
service. Enable it with:
```
sudo sysrc rsplayer_enable=YES
sudo sysrc rsplayer_user=salmon   # the user that runs the rsp CLI
sudo service rsplayer start
```

FreeBSD notes:
- There is no systemd: the rc.d service (rsplayer.rc) runs `rsp start-daemon`
  as rsplayer_user via daemon(8); `service rsplayer status`/`stop`/`restart`
  work as expected. You can also run `rsp start-daemon` manually from your
  login shell — `start-daemon`/`stop-daemon`/`restart` behave the same.
- The daemon socket and PID file live in ~/.local/state/rsplayer/ (the XDG
  state dir), not in XDG_RUNTIME_DIR: the path is identical whether the daemon
  was started by the service or manually. This matters on FreeBSD, where
  XDG_RUNTIME_DIR is often unset (previously the fallback was the
  world-writable /tmp/rsplayer).
- Desktop notifications and MPRIS (playerctl etc.) require a running D-Bus session
  bus (`pkg install dbus`) and a notification daemon; without them the daemon runs
  fine, those features are just disabled.
- If you have multiple sound cards, pick the output with:
  `sysctl hw.snd.default_unit=N` (persist in /etc/sysctl.conf).

## Usage

configuration is generated at startup in $XDG_CONFIG_HOME/rsplayer/config.toml
- most important values there are:
- listenbrainz_token (last.fm scrobbling not yet tested)
- display_format (supports $ARTIST $ALBUM and $TRACK)
- music_paths (for DB usage, still WIP)
- scan_interval (same as above)  

all other values can be changed in runtime using commands

as for commands:    
RSP will be installed as rsp, in this fragment, rsp will be ommited  

these commands should only be used in testing or by the init system (systemd/rc.d):  
- `start-daemon`  Start the daemon
- `stop-daemon`   Stop the daemon
- `restart`       Restart the daemon (kill existing and start new)

these are normal commands:  
- `play`          Play a track, album, or artist
- `pause`         Pause playback
- `resume`        Resume playback
- `toggle`        Toggle play/pause
- `stop`          Stop playback
- `next`          Skip to next track
- `previous`      Skip to previous track
- `volume`        Set volume (0-100)
- `shuffle`       Shuffle mode
- `queue`         Queue management
- `status`        Show player status
- `scan`          Scan music paths to populate database
- `settings`      Settings management
- `help`          Print this message or the help of the given subcommand(s)


## Technical stuff
The main culprit of this player is lack of integration with programs such as playerctl  
this is due to the daemon not being asynchronous