<div align="center">
<h1>Selene</h1>

[<img alt="Crates.io" src="https://img.shields.io/crates/v/selene-core?style=for-the-badge" height="22"/>](https://crates.io/crates/selene-core)
[<img alt="Docs.rs" src="https://img.shields.io/badge/docs.rs-selene--daemon-brightgreen?style=for-the-badge" height="22"/>](https://docs.rs/selene-daemon)
[<img alt="Docs.rs" src="https://img.shields.io/badge/docs.rs-selene--core-brightgreen?style=for-the-badge" height="22"/>](https://docs.rs/selene-core)
[<img alt="License" src="https://img.shields.io/crates/l/selene-core?style=for-the-badge" height="22"/>](https://www.mozilla.org/en-US/MPL/2.0/)

<p>
    <strong>
        Selene is a locally hosted music server with support for all common music formats, designed to be easy and convenient for anyone looking to replace streaming services
    </strong>
</p>
</div>

---

Selene is designed to be as simple as possible for anyone who just wants to listen locally to music on their own device, while also offering support for remote connections and hosting multiple sessions. A single session is capable of being remotely controlled by any number of clients, and can send audio packets to any number of clients.

If the `local-session` feature is enabled, the server will host its own local session, which is identical to any other session, but with its own playback thread and specific ID. Plugins can also be connected to receive events from the local session, similarly remote clients.

### Supported formats

| Codec                        | Gapless | Feature Flag | Depends   |
|------------------------------|:-------:|--------------|-----------|
| FLAC                         | Yes     |              |           |
| MP3                          | Yes     |              |           |
| Opus                         | -       | `opus`       | `libopus` |
| PCM (eg. wav)                | Yes     |              |           |
| Vorbis (eg. ogg)             | Yes     |              |           |
| AAC-LC (eg. m4a)             | No      |              |           |
| ALAC                         | Yes     |              |           |
| HE-AAC (AAC+, aacPlus)       | No      |              |           |
| HE-AACv2 (eAAC+, aacPlus v2) | No      |              |           |

For an extended list, see [Symphonia](https://github.com/pdeljanov/Symphonia). opus codec support is included via [symphonia-adapter-libopus](https://github.com/aschey/symphonia-adapters)

### Plugin Support

Selene supports dynamically loaded plugins via [stabby](https://github.com/ZettaScaleLabs/stabby)! Plugin support can be enabled with the `plugin-support` feature

Official plugins are listed here:
| Plugin                                                             | Summary                                                     | Version   |
|:-------------------------------------------------------------------|:------------------------------------------------------------|:---------:|
| [selene-mpris](https://codeberg.org/selene-player/selene-plugins)  | Provides an MPRIS implementation for the local session      | v0.9.0+   |
| [selene-lastfm](https://codeberg.org/selene-player/selene-plugins) | Provides scrobbling support for the local session to lastfm | v0.9.0+   |

Start creating your own plugin, see the [selene-plugin-sdk](https://codeberg.org/selene-player/selene-plugins)

*There is currently no registry for third party plugins; However, you can package your plugin as `selene-plugin-*` for package visibility

# Installation
An arch package is available on the [AUR](https://aur.archlinux.org/packages/selene-player-git).
To install, use your AUR helper of choice, such as `paru`:
```sh
paru -S selene-player-git # Install Selene
systemctl --user enable selene # Run the daemon
```

### Uninstallation
If you are uninstalling selene, after uninstalling the selene package, the remaining files can be cleaned up here:
```sh
rm -rf ~/.config/selene
rm -rf ~/.local/share/selene
rm -rf ~/.local/state/selene
```

# Building from source
<details>
<summary><h3>Prerequisites</h3></summary>

- cargo
- git
- ffmpeg

It is recommended to install **cargo** via [rustup](https://rustup.rs/).

</details>

### 1. Download the repository and navigate to its directory
```sh
git clone https://codeberg.org/selene-player/selene.git
cd selene
```

### 2. Install the main binary
```sh
cargo install --path selene-cli
```
*All features are optional

### 3. Run the daemon
```sh
selene server
```

### 4. Start listening

I will make a wiki soon soon about more config options and initial setup, but for now, your best bet is to use `selene -h` to navigate the help menus