=== spotify-tui === || !FreshPorts || [[https://www.freshports.org/audio/spotify-tui/ | audio/spotify-tui ]] || ----- == Current situation == As it stands Spotify have not released an official client for the varying BSD platforms. Unfortunately due to the small userbase from the BSDs and feasibility in porting such an application (requiring operating-system specific DRM), the likelihood of Spotify jumping through these complexities is very unlikely. Other than the client provided by Spotify via a distributed binary there's also the web frontend. However, FreeBSD lacks the necessary DRM support and more specifically Widevine—mandatory browser plugin to stream music on Spotify and similarly watch content on Netflix via your browser. There's been efforts to get it working but isn't practical by any means, ultimately it comes down to a binary blob that's incompatible with FreeBSD. Widevine came out with the following statement: {{{ "FreeBSD is not a supported platform, we have no plans or demands from content provider partners. Please consider reaching out to your streaming provider to request client support which will eventually get to us." }}} Luckily, Spotify has a neat little [[https://developer.spotify.com/documentation/web-api/ | Web API ]] which can be used to our advantage, and subsequently provide us with a Spotify experience, but within the terminal. With the combination of both [[https://www.freshports.org/audio/spotify-tui/ | audio/spotify-tui ]] and [[https://www.freshports.org/audio/spotifyd/ | audio/spotifyd ]] we can achieve this. '''Spotify-tui''' uses the Web API from Spotify, which doesn't handle streaming itself. So you'll need either an official Spotify client open or a lightweight alternative such as spotifyd (what we will be using). You can think of Spotify-tui as more of a "controller" or "frontend" to Spotify, with this setup you can control all your Spotify devices. '''Spotifyd''' streams music just like the official client, but is more lightweight and supports more platforms. Spotifyd also supports the Spotify Connect protocol, which makes it show up as a device that can be controlled from the official clients. == Getting started == /!\ If you want to play tracks, Spotify requires that you have a premium account. For this instance, we will be using portaudio as the audio backend and is the default for spotifyd—by far the simplest too. 1. Install [[https://www.freshports.org/audio/spotify-tui/ | audio/spotify-tui ]] and [[https://www.freshports.org/audio/spotifyd/ | audio/spotifyd ]]: {{{ # pkg install spotify-tui spotifyd }}} or from the ports collection {{{ # make -C /usr/ports/audio/spotify-tui install clean # make -C /usr/ports/audio/spotifyd install clean }}} 2. Setup a new Spotify application in the [[ https://developer.spotify.com/dashboard/ | developer dashboard ]], which is where you obtain your '''Client ID''' and '''Client Secret''' by following [[https://github.com/Rigellute/spotify-tui#connecting-to-spotifys-api | these instructions ]] from the official project repository. 3. As your desired user, edit '''~/.config/spotifyd/spotifyd.conf''' or globally '''/usr/local/etc/spotifyd.conf''', and ensure it contains the bare minimum: {{{ [global] username = example.com # Your Spotify email here password = foobar # Your Spotify password here backend = portaudio device = /dev/dsp5.0 # Rename to the according audio device device_name = bsd # Name the device as you please }}} {i} Optionally you can pass the username, password, device, etc in the terminal (using the configuration above for example): {{{ $ spotifyd --username example.com --password foobar --backend portaudio --device /dev/dsp5.0 --device-name bsd }}} For further help and configuration options, flags and usages view the help page with the '''-h''' flag or visit [[ https://github.com/Spotifyd/spotifyd#configuration-file | here ]] to see the full configuration file documentation. 4. Now start spotifyd and enjoy: {{{ $ spotifyd --no-daemon }}} {i} By default spotifyd will take precedence ('''~/.config/spotifyd/spotifyd.conf''') over the configuration in '''/usr/local/etc''', you can override this by passing '''--config-path''' and then the configuration file you wish to use. Start up '''spt''' (the executable for spotify-tui) within a terminal, press d and select your local device (what you set as '''device_name''' in the configuration file) by pressing enter, then q to go back to the previous screen. You can now play your favorite music and playlists from Spotify directly in your terminal. {i} Alternatively to start spotifyd automatically upon boot, rather than starting it manually through the terminal: {{{ # sysrc spotifyd_enable=YES # sysrc spotifyd_config="/path/to/config" # spotifyd.conf residing under /usr/local/etc is used as default here. }}} == Configuration == For theming, keybinding and custom behaviors for spotify-tui [[ https://github.com/Rigellute/spotify-tui#configuration | see here ]]. == See also == * [[https://www.youtube.com/watch?v=AK4EbPezMyU | Spotify-tui on FreeBSD ]]. * [[https://www.freshports.org/audio/ncspot/ | audio/ncspot ]]. ---- CategoryHowTo CategoryPorts