tryffel / jellycli

Jellyfin terminal client
GNU General Public License v3.0
206 stars 8 forks source link

Jellycli

Godoc Reference Go Report Card

Terminal music player, works with:

Screenshot

Features

Available features vary depending on server being used. E.g. Subsonic-servers do not support remote control.

Platforms tested:

Jellycli (headless & Gui) has been tested and works with Windows. However, there are some limitations, namely poor colors, missing characters and some keybindings might not work as expected. Windows Console works better than Cmd.

On raspi 2 you need to increase audio buffer duration in config file to somewhere around 400.

(Experimental) Local metadata caching

Jellycli features caching metadata locally. This is handy and speeds up browsing, especially with slow internet. Cache is very basic and supports every other resource except genres at the moment. Also filtering/searching is not supported. For Subsonic servers, local caching is the only way to actually browse full library.

To enable caching, set config option player.enable_local_cache = true, then index manually with: jellycli refresh. This will create new db file if needed and update library. Depending on library size, this might take some minutes. If something goes wrong, you can always remove db file by hand and run this command again. Database file is located in /home/user/.cache/jellycli/*.db, and is visible in help page->info too. Refer to help page to get correct file. Each server backend uses separate db file.

Official Windows build does not support local cache yet.

Building

You will need Go 1.13 or later installed and configured

Download & build package

go get tryffel.net/go/jellycli
cd jellycli
# checkout tag:
# git checkout vx.x.x
go build .
./jellycli

Run

Binaries for 64-bit Linux & Windows are available under latest release.

On Arch Linux you can install Jellycli with pre-built AUR package 'jellycli-bin'.

# Gui
./jellycli

# Headless mode
./jellycli --no-gui

Docker

Jellycli has experimental docker image tryffel/jellycli. Do note that you might run into issues using audio with docker. Jellycli relies on alsa and might clash with pulseaudio. In case of problems, ensure you have alsa installed on host machine and disable / kill pulseaudio if required.

mkdir ~/jellycli-config
# Gui
docker run -it --rm --device /dev/snd:/dev/snd  -v ~/jellycli-config/jellycli-conf:/root/.config jellycli

# Headless mode
docker run -it --rm --device /dev/snd:/dev/snd  -v ~/jellycli-config/jellycli-conf:/root/.config jellycli --no-gui

Configuration

Config file

On first time application asks for Jellyfin host, username, password and default collection for music.

To connect directly to Subsonic, create new config file by running Jellycli for the first time and stop program, edit config file and set player.server=subsonic and run Jellycli and insert server info. Alternatively, use env var JELLYCLI_PLAYER_SERVER=subsonic

All this is stored in configuration file:

See config.sample.yaml for more info and up-to-date version of config file.

When Jellycli upgrades existing config file to new version, some values, especially new boolean have default value 'false', even when the value should be true. Be sure to check those values after upgrading application.

Configuration file location is also visible in help page. You can use multiple config files by providing argument:

jellycli --config temp.yaml

Log file is located at '/tmp/jellycli.log' or 'C:\Users\\AppData\Local\Temp/jellycli.log' by default. This can be overridden with config file. At the moment jellycli does not inform user about errors but rather just silently logs them. For development purposes you should set log-level either to debug or trace.

Environment variables:

It is possible to override any config file value with environment variable. In addition to that, it is also possible to define passwords for servers. This way it would be possible to use Jellycli without persisting config file (with e.g. Docker). Jellycli will still create config file, nevertheless.

Note: #14: environment variables override config values, and env variables will be saved in config file.


# Config overrides, see config.sample.yaml for more info.
JELLYCLI_JELLYFIN_URL
JELLYCLI_JELLYFIN_TOKEN
JELLYCLI_JELLYFIN_USERID
JELLYCLI_JELLYFIN_DEVICE_ID
JELLYCLI_JELLYFIN_SERVER_ID
JELLYCLI_JELLYFIN_MUSIC_VIEW

JELLYCLI_SUBSONIC_URL
JELLYCLI_SUBSONIC_USERNAME
JELLYCLI_SUBSONIC_SALT
JELLYCLI_SUBSONIC_TOKEN

JELLYCLI_PLAYER_SERVER
JELLYCLI_PLAYER_LOGFILE
JELLYCLI_PLAYER_LOGLEVEL
JELLYCLI_PLAYER_HTTP_BUFFERING_S
JELLYCLI_PLAYER_HTTP_BUFFERING_LIMIT_MEM
JELLYCLI_PLAYER_AUDIO_BUFFERING_MS
JELLYCLI_PLAYER_ENABLE_REMOTE_CONTROL
JELLYCLI_PLAYER_SEARCH_RESULTS_LIMIT
JELLYCLI_PLAYER_ENABLE_LOCAL_CACHE
JELLYCLI_PLAYER_ENABLE_LOCAL_CACHE_DIR

# Additional environment variables
JELLYCLI_GUI_PAGESIZE
JELLYCLI_GUI_DEBUG_MODE
JELLYCLI_GUI_LIMIT_RECENTLY_PLAYED
JELLYCLI_GUI_MOUSE_ENABLED
JELLYCLI_GUI_DOUBLE_CLICK_MS
JELLYCLI_GUI_SEARCH_RESULTS_LIMIT
JELLYCLI_GUI_SEARCH_TYPES
JELLYCLI_GUI_VOLUME_STEPS

JELLYCLI_GUI_ENABLE_SORTING
JELLYCLI_GUI_ENABLE_FILTERING
JELLYCLI_GUI_ENABLE_RESULTS_FILTERING

# Additional environment variables. If Jellycli asks for password (due to failed auth),
# it would normally ask password from user. Supply password here to skip interactive input.
JELLYCLI_JELLYFIN_PASSWORD
JELLYCLI_SUBSONIC_PASSWORD

# disable gui
JELLYCLI_PLAYER_NOGUI

Keybindings & Color Scheme

Keybindings and color scheme are hardcoded at build time. They are located in files

To create a debug goroutines dump, enable 'player.debug_mode' and then press Ctrl+W to write a text file that's located in log directory.

Acknowledgements

Thanks natsukagami for implementing Mpris-interface.