Running textbased spotify client with a spotify daemon for native playback
#1
Music 
There's a text based spotify client that runs in text mode called spotify-tui, which I thought looked nice,
so I took some time to make it run on the pinephone.

[Image: 6xz0nokmuog61.jpg]
Here it is running in the st terminal in sxmo


Prereqs:
You need the following packages installed (there might be some missing from this list though)
  • libssl-dev or openssl-dev
  • cargo
  • rust
  • pkg-config
  • libxcb-dev
  • xdg-utils
  • firefox-esr (or chromium), to activate the spotify API, since surf doesn't seem to load the webpage properly
Just install them with apk (if you're running postmarketOS) in a console.
You also need to add the cargo bin dir to path, easiest way is to add this line to ~/.profile
Code:
export PATH=$PATH:~/.cargo/bin
Load the new path variable into environment with source:
Code:
source ~/.profile
After that installing spotify-tui should be easy:
Code:
cargo install spotify-tui -j4
Use -j4 if you want to, to speed things up a bit. Draws a lot of battery though.
And this operation might take an hour on the phone (I'm trying to figure out cross-compilation to make it faster, but openssl is giving me a hard time).
Now we need to temporarily change the default browers to firefox (or chromium), in order to open up the link to authenticate the spotify API.
You can do this in sxmo by setting the $BROWSER flag by setting
Code:
export BROWSER=firefox
Either in ~/.profile (you must make sure it's loaded, restarting the phone should fix that)
or by just passing it in a console you're running in your phones GUI (not in a ssh shell since it might not load the web browser properly)
After that just follow this guide:
https://github.com/Rigellute/spotify-tui...otifys-api
You can now run the client with the command
Code:
spt
in a console in the phones GUI where Wayland (or X) is running.
This will open the API authentication link in Firefox, login and confirm the authentication, and then close Firefox.
Now you can control your Spotify clients from your text interface.
But for native playback we need to have spotifyd installed and running as a daemon,
install should be as easy as installing spotify-tui:
Code:
cargo install spotifyd -j4
This will also take a while, probably 1 hour, again using -j4 is optional, makes it a bit faster, but also draws a lot of power.
After the install, try running it with:
Code:
spotifyd -u <spotify username> -p <spotify password>
Now a new device should appear in your device list in your spotify client, e.g. Spotifyd@sxmo
Make sure that your phone is set to play from the speakers (or headphones, if you have those plugged in)
In spotify-tui you might need to set which client you want to do the playback by pressing
Code:
d
Notes: If the volume is too high the sound quality really deteriorates, so play at lower volumes (or use headphones)
Spotifyd has systemd scripts to turn it into a service, you can convert that script into an openrc service by using initify: https://github.com/goose121/initify and placing it in /etc/init.d/
Some extra tweaks needs to be done here to make it run properly which I haven't done yet, it crashes on boot and needs to be restarted (probably need to add network prereq in rc script)
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  meet franz! (whatsapp,telegram,etc linux client) vanja 0 1,369 09-15-2022, 01:23 AM
Last Post: vanja
  Keyboard Case Power Management Daemon estokes 2 2,616 04-16-2022, 04:15 PM
Last Post: estokes
Bug My experience running desktop Linux on PinePhone Subsentient 5 6,122 12-31-2021, 05:41 PM
Last Post: Subsentient
  GTK Rust mobile Linux client for Signal Be. 14 22,441 11-11-2021, 05:35 PM
Last Post: sativista
  gnome-clocks waking the phone via a waking daemon (POC) seath 2 3,550 02-28-2021, 09:50 AM
Last Post: seath
  Native apps using local mysql server or equivalent rbclemen 2 3,169 02-18-2021, 08:45 PM
Last Post: rbclemen
  Clock and Power Rate running on Pinephone/Mobian Cynics 0 2,128 07-22-2020, 04:13 PM
Last Post: Cynics
  pplockd: Simple power management/CRUST daemon for X11 GUIs on PinePhone Subsentient 1 3,920 07-04-2020, 06:39 AM
Last Post: Subsentient

Forum Jump:


Users browsing this thread: 1 Guest(s)