Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support album art and basic controls for spotify #678

Open
alfredvaa opened this issue Aug 26, 2024 · 9 comments
Open

Support album art and basic controls for spotify #678

alfredvaa opened this issue Aug 26, 2024 · 9 comments

Comments

@alfredvaa
Copy link

Is there any plans on supporting album art, song title and maybe also basic controls for when streaming through Spotify?

@moodeaudio
Copy link
Contributor

moodeaudio commented Aug 26, 2024

We build librespot and use the resulting binary directly. I don't think it supports a metadata feed and so someone would prolly need to wrap it in some sort of daemon and then integrate that into moode. I personally don't have the bandwidth for that type of effort but maybe another dev will volunteer to do it.

Here's a link I found that discusses librespot metadata.
librespot-org/librespot#592

@moodeaudio
Copy link
Contributor

Will reopen if there is new information posted

@sm00th
Copy link

sm00th commented Sep 20, 2024

Hi, from what I saw, a recurring approach to this is to leave librespot to play audio and then use spotify's WebAPI to fetch metadata(e.g. https://github.com/Rigellute/spotify-tui) . This is not very user friendly: the user will have to create an "app" in spotify's developer dashboard (https://github.com/Rigellute/spotify-tui?tab=readme-ov-file#connecting-to-spotifys-api), auth and even then it will only show metadata for the authenticated user, not just anyone streaming to moode endpoint. But it is better than nothing and covers the most common usecase.

I've cobbled together a very rough PoC sm00th@9018f53 that is able to show some metadata on the "Spotify Active" overlay. I think with some pointers on how to properly integrate this I can shape it into something usable.

Do you think this angle is worth pursuing?

@moodeaudio moodeaudio reopened this Sep 20, 2024
@moodeaudio
Copy link
Contributor

Could be problematic since getting these dev API authentication tokens requires agreeing to legal terms.

@sm00th
Copy link

sm00th commented Sep 20, 2024

Yes, but since we are using end-user tokens it is that user who accepts terms and conditions and decides whether they comply. So any possible liability also lies with that user and not the project.

@moodeaudio
Copy link
Contributor

Maybe, but I'm not a lawyer.

In any case the main issue with deep integration of a feature into moode code is that our project becomes responsible for ongoing support and maintenance and so I need to be reasonably sure that a fair number of users are going to use it. Most of our users are not devs or techs and so the process of getting Spotify API tokens might be a barrier to use.

Is there a way you can provide an installer or an image that users can test out? You could post a Thread about it in our Forum and see how the discussion goes.

@sm00th
Copy link

sm00th commented Sep 21, 2024

Right, I didn't think about the fact that most userbase is non-technical. I am sure I'll be able to build an image, but before that I'd try to iron-out some sharp corners, right now it is to raw to show to non-devs I think.

@moodeaudio
Copy link
Contributor

You might want to do an installer/remover which would prolly be easier than a whole test image

Something like below (not tested). You would need to upload the two shell scripts and lib.min.js file to your repo. You could also have just one shell script with -install and -remove options.

User download and run

wget -q https://some_location_in_repo/install_spotmeta.sh -O ./install_spotmeta.sh
wget -q https://some_location_in_repo/remove_spotmeta.sh -O ./remove_spotmeta.sh
sudo chmod +x ./*spotmeta.sh
sudo ./install_spotmeta.sh

install_spotmeta.sh

echo "Installing 2024-MM-DD metadata update for Spotify Connect"
# Save original files
# If dir already exists skip this step so script can be run to install updated files and retain originals
if [ ! -d ./spotmeta-backup ]; then 
    mkdir ./spotmeta-backup
    cp  /var/www/ren-config.php ./spotmeta-backup
    cp  /var/www/inc/autocfg.php ./spotmeta-backup
    cp  /var/www/js/lib.min.js ./spotmeta-backup
    cp  /var/www/templates/ren-config.html ./spotmeta-backup
fi
# Install updated files 
moodeutl -q "INSERT OR IGNORE INTO cfg_system (id, param, value) VALUES (176, 'spotifyclientid', '')"
moodeutl -q "INSERT OR IGNORE INTO cfg_system (id, param, value) VALUES (177, 'spotifyclientsecret', '')"
moodeutl -q "INSERT OR IGNORE INTO cfg_system (id, param, value) VALUES (178, 'spotifyredirecturl', '')"
mkdir /var/www/spotify
wget -q https://github.com/sm00th/moode/blob/spotify/www/ren-config.php -O /var/www/ren-config.php
wget -q https://github.com/sm00th/moode/blob/spotify/www/inc/autocfg.php -O /var/www/inc/autocfg.php
wget -q https://github.com/sm00th/moode/blob/spotify/www/js/lib.min.js -O /var/www/js/lib.min.js
wget -q https://github.com/sm00th/moode/blob/spotify/www/spotify/index.html -O /var/www/spotify/index.html
wget -q https://github.com/sm00th/moode/blob/spotify/www/templates/ren-config.html -O /var/www/templates/ren-config.html
echo "Update successfully installed, reboot to make the changes effective."

remove_spotmeta.sh

echo "Removing 2024-MM-DD metadata update for Spotify Connect"
# SQL
moodeutl -q "DELETE FROM cfg_system WHERE param='spotifyclientid'"
moodeutl -q "DELETE FROM cfg_system WHERE param='spotifyclientsecret'"
moodeutl -q "DELETE FROM cfg_system WHERE param='spotifyredirecturl'"
# Session vars
moodeutl -D spotifyclientid
moodeutl -D spotifyclientsecret
moodeutl -D spotifyredirecturl
# Files
cp  ./spotmeta-backup/ren-config.php /var/www/
cp  ./spotmeta-backup/autocfg.php /var/www/inc/
cp  ./spotmeta-backup/lib.min.js /var/www/js/
cp  ./spotmeta-backup/ren-config.html /var/www/templates/
# Dirs
rm -rf /var/www/spotify
rm -rf ./spotmeta-backup
echo "Update successfully removed, reboot to make the changes effective."

@sm00th
Copy link

sm00th commented Sep 25, 2024

It seems lib.min.js is generated so is unavailable in the repo. There also might be other problems if these files, which are based on 9.1.2 are copied over a stable (9.1.0) install. Package creation is pretty straightforward and should be more reliable, so I'll go with that and database update instructions along it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants