pipeplayer/README.md

112 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

2022-08-08 02:42:22 +02:00
# Pipeplayer
Pipeplayer is a simple music daemon. It uses libmpg123 to decode files and libao to play sound. You can control it with named pipe (FIFO).
## Before using this
This program requires *playlist* file which is plain text of songs in the same directory.
For example, you have folder with this files: `song1.mp3`, `song_2.mp3`, `4.mp3` and `56.mp3`.
Your playlist file shoul'd look like:
```
song1.mp3
song_2.mp3
4.mp3
56.mp3
```
**Tip**: cd into folder with music and run command `ls -1N | tee playlist` to automatically generate playlist file. Note that order may differ.
## Usage
First, you need to check your XDG_RUNTIME_DIR variable
2022-08-08 02:42:22 +02:00
```
echo $XDG_RUNTIME_DIR
```
If you see no output, then you need to export variable:
On bash, zsh etc.:
```
export XDG_RUNTIME_DIR="$HOME/.local/runtime"
```
On fish:
```
set -x XDG_RUNTIME_DIR "$HOME/.local/runtime"
```
Then make sure directory $XDG_RUNTIME_DIR exists:
```
mkdir -p "$XDG_RUNTIME_DIR"
2022-08-08 02:42:22 +02:00
```
Then, you can start daemon either during start of your desktop environment or window manager or even in tty with this command:
```
2022-08-13 14:49:26 +02:00
pipeplayer
2022-08-08 02:42:22 +02:00
```
Note: add `&` at the end of command to run process in background.
2022-08-13 14:49:26 +02:00
Or if you prefer old way:
```
pipeplayer /path/to/named/pipe
```
2022-08-08 02:42:22 +02:00
Now you can send commands to created named pipe like this:
```
2022-08-13 14:49:26 +02:00
echo l$HOME/Music/playlist > "$XDG_RUNTIME_DIR/pipeplayer"
2022-08-08 02:42:22 +02:00
```
2022-08-13 14:49:26 +02:00
Note: change "$XDG_RUNTIME_DIR/pipeplayer" to path to named pipe if you don't use XDG_RUNTIME_DIR variable.
2022-08-08 02:42:22 +02:00
2022-08-08 03:31:39 +02:00
### Available commands
* `l/path/to/playlist` — load playlist from /path/to/playlist
* `b` — play previous song
* `f` — play next song
* `e` — exit pipeplayer
2022-08-13 14:49:26 +02:00
* `p` — pause
* `c` — clear playlist (don't exit)
2022-08-08 03:31:39 +02:00
Also, you can find all commands in man page. Run `man pipeplayer` after installation.
2022-08-08 02:42:22 +02:00
# Installation
You need a few things:
* git
* C compiler, such as **gcc**, **clang** or **tcc**
* make
* libmpg123
* libao
Install that stuff, clone this repository, cd into it and simply run make and sudo (or doas) make install:
```
git clone https://git.disroot.org/elijah.dev/pipeplayer.git
cd pipeplayer
make
sudo make install
```
If you prefer gcc, then run `make CC=gcc` instead of `make`.
Also, if you prefer clang, run `make CC=clang.`
2022-08-08 02:42:22 +02:00
2022-08-14 01:38:42 +02:00
Replace `make` with `make NOTIFICATION=0` if you want to disable notification.
Make sure you change NOTIFICATION variable in `config.h`.
2022-08-08 02:42:22 +02:00
Here some tips for installing dependencies on some distros:
### Archlinux and arch-based distros
```
pacman -Syu --needed tcc mpg123 libao
```
* Install `libnotify` package for notification support
2022-08-08 02:42:22 +02:00
Guides for other distibutions will appear in future. If you know one, feel free to add.
## TODO
- [x] Add pause command
2022-08-13 06:05:43 +02:00
- [x] Add clear playlist command
2022-08-08 02:42:22 +02:00
- [ ] Add navigation inside song
2022-08-14 01:38:42 +02:00
- [x] Add notification support
2022-08-08 02:42:22 +02:00
## Bugs
If you have found bugs, you can open issue or contact me via email elijah.dev@disroot.org