Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jiab77/jellystream

A simple script that gives you the possibility to listen your music from your terminal within your Jellyfin server API.
https://github.com/jiab77/jellystream

api bash cli jellyfin music server streaming

Last synced: 2 days ago
JSON representation

A simple script that gives you the possibility to listen your music from your terminal within your Jellyfin server API.

Awesome Lists containing this project

README

        

# Jellystream

A simple script that gives you the possibility to listen your music from your terminal within your Jellyfin server API.

## Current version

The latest version is __`0.2.0`__.

## Content

* [Dependencies](#dependencies)
* [Music players](#music-players)
* [How to use it](#how-to-use-it)
* [Desktop notifications](#desktop-notifications)
* [Config file](#config-file)
* [Screenshots](#screenshots)
* [Todolist](#todolist)
* [Known issues](#known-issues)
* [Extra](#extra)
* [Author](#author)

---

## Dependencies

The script has some dependencies that needs to be installed before trying to run it:

```
sudo apt install curl jq sed
```

### Music players

Here is a list of currently supported music players:

* `mpg123`
* `mpv`

However, `mpv` remains the recommanded player as it provides extra functionalities like __desktop notifications__ which offer the possibility to control the player from a notification.

> Support for `gst123` will be added soon but already exist in the [random music player](#extra).

## How to use it

The script is quite easy to use, you basically just need to do the following before running it:

1. Create an API key on your Jellyfin server
2. Put your new API key and your server address in the script or in the config file
3. Save and run it

If the API key is correctly defined, you should see a text menu where you'll be asked to enter the number in front of the music genre. It will then automatically create an __IntantMix__ (_a feature from Jellyfin_) for the selected music genre which is apparently limited to __200__ songs.

That __InstantMix__ stream will be then passed to `mpg123` (or `mpv`) that will read it and play the songs.

To control the player, a support for `playerctl` has been implemented and you can pass the following actions to the scripts:

* `status`
* `stop`
* `play`
* `pause`
* `prev`
* `next`

> These actions are only for `mpv`.

Run the `man` command for `mpg123` or `mpv` to find the control keys for each music players.

### Desktop notifications

The support for __desktop notifications__ is based on `dbus` and provided by `mpv_mpris` library when `mpv` is installed. The script will look for the library and load it.

## Config file

Here is the config file structure:

> The script will look for a file called `jellystream.conf` and load it if exists.

```conf
SERVER_ADDR="YOUR-SERVER-ADDRESS-WITH-PORT-IF-ANY"
API_KEY="YOUR-API-KEY"
LOGIN_AS="YOUR-USERNAME"
```

__The `SERVER_ADDR` variable must contain the protocol and port.__

Here is an example of valid server addresses:

* `http://a.b.c.d:1234`
* `https://a.b.c.d:1234`
* `http://my-jellyfin-server.tld:1234`
* `https://my-jellyfin-server.tld:1234`
* `https://my-secret-jellyfin-tunnel.tld`

## Screenshots

![image](images/screenshot-1.png)
![image](images/screenshot-2.png)

> Screenshots needs to be updated.

## Todolist

* [X] Display songs metadata
* [X] Improve metadata display
* [X] Improve navigation between tracks
* [ ] Improve authentication method by using `AuthenticateByName` API endpoint
* [ ] Find a way to pass the generated stream to __Icecast__ or similar
* [X] Find a better way to kill the player

## Known issues

Nothing for the moment.

## Extra

I've kinda reused the same code / concept to create a random music player that can be run from CLI:

* [Random Music Player](rmp.sh) - (_Or 'RMP' for short_)

It will look for the default music folder (`XDG_MUSIC_DIR`) and generate a dynamic list of existing audio files in memory and pass it to one of the supported music players.

## Author

* __Jiab77__