-
Notifications
You must be signed in to change notification settings - Fork 94
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
How I got everything working #69
Comments
Did you use Adafrit Display with composite video? |
Hi, XEROxMEXICANO, thank you for your detailed instructions! I use an newer version of raspotify that seems to run smoothly https://github.com/dtcooper/raspotify/releases/tag/0.31.3 I previously had a 2inch screen running but found it easier to try to get it to work on a big screen and now have sPOT running and autostarting on my hdmi screen! Thank you for showing the detailed way you can get your Device id from spotify and where to type them in the spotify_manager.py and client.py files, also learning the keyboard shortcuts to get to a certain line in nano is very helpful :) I have a thing that I really don't really understand though when starting spotifypod.py If I use sudo python3 spotifypod.py & And when I use python3 spotifypod.py & I get no error message and the program runs fine. If I leave the sudo command out of the /etc/xdg/openbox/autostart It boots up fine, but I am still curious what I did wrong here. Hoping to learn what this could be. Thanks again for putting so much effort in how you got everything to work, it is really appreciated. Greetings! |
Hi XEROxMEXICANO, What nice work you did organizing and illustrating the "sPots" installation instructions ... again Nice Work! Hi fisjingtool: May I ask
Thanks |
Hi Doris, I am using Buster 10 (installed the lite images) I am now trying to get bluetooth to work using all the helpful pages you provided. Thanks |
If you need help getting Bluetooth working, follow XEROxMEXICANO's above excellent narrative. Is that the recent Legacy Raspberry Pi Os Buster 10. |
the image is from pi@raspberrypi:~$ cat /etc/os-release pi@raspberrypi:~$ cat /proc/version |
Thank You ... I couldn't get raspotify 0.31.3 to work I'm using version 0.14.0 0 ...16.0 works as well perhaps it was because I was using the newer Legacy Buster 10 |
I tried this yesterday two or three times, I have go to my spotifyApp on my phone and select raspotify, it would then begin to play on spot pretty fast. |
I cannot auto connect either checkout in issue #41 below: paulomurray commented on May 28, 2021 retro-ipod-spotify-client/frontend/spotify_manager.py Line 146 in 1c26cc6 device = UserDevice(item['id'], item['name'], item['is_active']) this totally works thanks "HOWEVER THE ABOVE NEVER WORKED FOR ME"! - doris |
Hi, I just checked this, it does autoconnect for me. Strangely yesterday I was able to play full songs but they stop now after a few seconds. I have been reading this somewhere in the issues as well. My idea was to use the newest raspotify version possible to avoid maybe these kinds of issues, not sure if it matters thanks |
I think it does matter! Read completely issue #66 in regards to the 2- or 3-seconds play issue and let me know what you think? |
running and authenticated, no errors. I see now that when I exit my SpotifyApp on the phone, the sPot stops/pauses so I will try to autoconnect first. |
Yes, |
● raspotify.service - Raspotify (Spotify Connect Client) Dec 11 15:10:09 raspberrypi systemd[1]: Started Raspotify (Spotify Connect Client). |
Did you first need to select "raspotify" with your phones Spotify app. ? |
No i didn't need to do that, it loads playlists etc. but stops playback after 2 seconds. I seems to me that the raspotify on the pi is doing what it should. |
You still have the same problem, that the sPot wil only play two seconds or so? And you can't autoconnect? |
No, my spot plays perfectly all tracks however only after I select "raspotify" via my phone or computer or make an http:// request and that takes many tries, once I'm successful I can close the Spotify app. and use my "sPot" without any issues however I have to do all the above again after rebooting ! From where did you download your version of Raspbian Buster 10? |
that is great! So you first startup the Pi (I swapped the zero out for a Pi3 for now as it is much faster) and let everything and sPot startup. You then use you phone to connect to raspotify and from then on your sPot works spotlessly? (pun intended ;) |
I'm using the Zero 2W (boots fast, poor on power consumption) my spot is closed and finished in its case, I just would like to not need to select with the Spotify app. first like you! |
http://debian.rutgers.edu/raspios_images/raspios_lite/raspios_lite_armhf-2021-01-12/ |
Thank You so much ... I'll let you know if it works! |
no problem, hopefully it does, it means strarting from (almost) scratch again right? I hope you make an image copy of your sd to fall back to? |
I've done it so often that I'm extremely fast at doing it from scratch! Thanks Again! |
No, i read that this was the last version with the same file structure in issue #61 raspotify no longer supported I figured out this part. you need to use a much older version of Raspotify, I used this one: raspotify_0.31.3.librespot.v0.3.1-19-gbbd575e_armhf.deb It looks like they changed the file structure in the newer one. /etc/default/raspotify does not exist. |
Correct I know that, however the new config might work in my zero 2W and your pi3 not the zero 1W |
Ah yes I see what you mean, but I only swapped it out temporarily for speed purpose while trying to get things to work. |
However, the newer versions of Raspotify may require a 64bit RPI-OS which seems to create a conflict and dependency problem with the "sPot App."! A host of dependencies were updated in November of 2021 that the sPot couldn't keep up with, which is why Buster 10 and Raspotify 14. 15. and 16 were recommended all three have the /etc/default/raspotify configuration so does 0.31.3 however I could not get 0.31.3 to work on the 1W or the 2W I was really surprised that you could ... perhaps due to the older version of Buster 10 that you're using 0.31.3 worked Raspotify FYI: Beginning with version 0.31.4 dtcooper/raspotify#470 librespot-org/librespot#886. The most obvious user facing change is that Raspotify's configuration file will change places (from /etc/default/raspotify to /etc/raspotify/conf) and change formats. Where as before the sections were basically "arg dumpsters" that you could put pretty much anything into, the new conf format will be closer to a traditional configuration file that sets environment variables that map 1 to 1 to librespot's options and flags. After you take note of your old config values and/or back your old config to a new location you should run sudo apt purge raspotify to completely remove purge Raspotify and then reinstall with sudo apt install raspotify. You can than migrate your settings to the new config. /etc/raspotify/conf will contain a non-exhaustive list of librespot options and flags. If you don't see the option or flag that you normally use you can add it and so long as it's valid it will work. To avoid name collisions environment variables must be prepended with LIBRESPOT_, so option/flag foo-bar becomes LIBRESPOT_FOO_BAR. If you look at the rest of /etc/raspotify/conf it should not be difficult to understand. |
Ah yes, I get it now, the sPot app is not for 64bit os |
Any Luck Jacob? I use Legacy Buster 10 Desktop version. I saved my .cache file on a usb thumb drive for any future copying & pasting to the pi Zero. I do remember now having the same or similar login issue and used the 10 digit username (not my e-mail address) and my password for logging into Spotify (try it both ways) best not to use VNC for this (use a monitor, keyboard and mouse connected to the pi Zero. I purchased a micro usb to usb "A" adapter with extra usb "A" ports and Ethernet port for that purpose off eBay. When all was correct I used sudo raspi-config to configure to boot to command line with auto login instead of booting to desktop with auto login. When doing the above disable (comment out in autostart #python3 spotifypod.py and in Xintric comment out #exec openbox-session ... uncomment (return both to normal) when your done. Be sure in sudo nano /etc/default/raspotify all is correct and exactly the same in your developer app. !!! Yes you can do everything on a pi Zero 2W, 3, 4 or 4B and then move the SD card to your Zero 1W. Re-read "The Post Install" concerning the .cache file generation! Also read all of including member comments in open issue #41 ,#22 and closed issue #30. |
Hi Doris! Thanks for pointing me at the various issue threads, but still no luck. I am unable to get past the spotify login page to get my .cache file. Today I tried fresh installs of Legacy Buster 10 Desktop & Lite versions, and confirmed that:
My zero W seems to slow down heavily once opening midori, so I also have an ethernet to usb adapter coming tomorrow since I've been working off my phone hotspot (only 2.4GHz network available). I'll also keep an eye out for any in-stock Pi 3's or 4's that may be able to get the .cache file then transfer to zero W. Where did you locate your 10 digit user ID? I tried logging in with my user id (no email) and email addresses with no success.
|
Hi Jake the below is a mistake ... I used the below for making a copy of an entire SD card so only use it for doing the above or moving or copying the .cache file via the desktop instead of using the command line! "When doing the above disable (comment out in autostart: You could try requesting a new password from your regular Spotify account and I believe you will receive the 10 digit username as well as the new password in an email. You can also search for your Premium Receipt e-mail if you still have it the 10 digit username should be in that email! I just used my iphone to look at my Spotify account settings via the dedicated Spotify app. and the 10 digit username is there under account settings !!! Can be seen when logging in via a web browser as well you will see the 10 digit username again under account settings !!! The 10 digit username can be used in sudo nano /etc/default/raspotify as well ... instead of your e-mail address! You want to login with your 10 digit username and your actual password! VNC server will slow down your pi ... if you have a monitor, keyboard and mouse connected to your pi you can stop VNC server via sudo raspi-config the midori browser should run better ... the zero w1 has a slow cpu compared to the Zero 2w both have 500mb of ram. Or stop/start VNC server via the command line: sudo service vncserver-x11-serviced stop or sudo service vncserver-x11-serviced start |
Hey is that method for getting the device id obsolete? I can't get it to work and can't find any other way online that does work. |
You really do not need a device ID just follow the above instructions |
Thanks for the quick reply! But how do I do the whole Entering Device ID step? I thought I have to add it into the refresh devices function. |
Which versions of Raspberry Pi OS and Raspotify are you using? |
I am using Raspotify 0.14.0, that's installed in the instructions. I am currently using the newest Raspberry Pi OS Lite Legacy, which I think might be a problem. I have tried the Image linked here but I had a problem with installing the requirements I think. But I will try it again if you think that could help. |
You must have a Spotify Premium Account! You should be okay with the above versions you have installed, be sure that you:
sudo nano /etc/default/raspotify OPTIONS="--username XXXXXXXX --password XXXXXXXXX" Ex: OPTIONS="--username 10 digit user ID or email_address@hotmail And in:
Go to line 173 using ctrl+shift+_ and type 173 You can comment out the entire refresh_device def and replace it with def refresh_devices(): Doing so will forgo the need for a device ID To obtain your device ID: You have to be logged-in to the Developer Dashboard Console then Click get token then copy all the terminal information in the lower black box then paste that into you computer's terminal and press enter "but I had a problem with installing the requirements I think. But I will try it again if you think that could help." pip3 install -r requirements.txt You must run from the frontend folder ! |
I think the method of obtaining the device ID is outdated. I can't find get token anywhere. Also I am facing a problem I had everytime. When generating the cache files, I am supposed to paste something in, but the URL doesn't change from localhost anymore. |
I do have a Spotify Premium Account and am currently trying to build it on a Pi 4 4gb. I used Raspberry Pi OS Lite Legacy, so command line, but I am already far enough for openbox to kick in as the Desktop enviroment. |
Viktor ... didn't you already have the project working once before using the "Vpod" fork ? I use a Pi 2w and the desktop lite version of Rpios legacy this way I can copy and paste when needed, I also saved my .cache file so i wouldn't. need to go through all the fuss whenever I needed it again it's been a long time since I originally generated the .cache file and I can't remember exactly how I obtained it other then following the instructions. The .cache file once created can & should be moved or preferably copied from the home or demo directory into the frontend folder! Read & Do Completely and Correctly the "Post Install" of this thread's installation instructions for the .cache file! To obtain your device ID: You have to be logged-in to the Developer Dashboard Console then Click get token then copy all the terminal information in the lower black box then paste that into you pi's terminal and press enter |
Thanks for being so patient. No that fork doesn't change anything, I created it when still figuring stuff out. I'll retry generating the cache now. Are you still able to get the device ID right now? When visiting my dashboard I don't have get token anywhere, I know the Layout was different like a year ago. |
You are so right !!! Not sure if obtaining .cache files have also been affected and I do not want to screw around with anything trying to find out and possibly render my spot device useless. I have been successful in the past achieving an operational "sPot" without using a device ID by making sure that the developer app name is exactly the same in:
|
I checked and I have the same device name at both spots. Right now I am trying to generate the cache and it tells me that it Found a cached token. Do you know how I can remove the Token again? Right now entering the localhost site I see the data I am supposed to, but the link I am supposed to paste into the terminal doesn't show up. |
When using the Spotipy Authorization Demo ... If I remember correctly the .cache file ends up in the "Home" directory or the directory of the "Authorization Demo" and you have to copy it (don't move it or you might lose it) to the front end directory ... I installed the desktop lite version for copy/paste ability. |
Yes but I don't have a .cache file to copy. I am stuck on it finding the cached token and expecting me to paste a link. I think if I had that link it would generate the file, but when opening localhost on my browser the link doesn't change anymore. |
Post Install sudo apt install midori cd ~ git clone https://github.com/perelin/spotipy_oauth_demo cd ~/spotipy_oauth_demo sudo apt-get install python-pip python-dev sudo apt-get install python3-pip python-dev pip install -r requirements.txt Before running it modify the client id and secret also your scopes in with: nano spotipy_oauth_demo.py Scope: SCOPE = "user-follow-read," Now you can save and exit the file python spotipy_oauth_demo.py Recommend using a Pi 4 or anything faster than a zero w, but if this is the only pi you have you should be fine but it will take a while. Your pi should be displaying a black screen then right click and click on browser then go to internet/ browser (midori). Once you did that go to http://localhost:8080/ There should be a spotify sign in page, sign in, once signed in it should redirect you to a page with gibberish code and spotify credits. Once you're on that screen exit the page and in your terminal stop running the program. cp ~/spotipy_oauth_demo/.spotipyoauthcache ~/retro-ipod-spotify-client/frontend/.cache The below will grant all permissions chmod 777 ~/retro-ipod-spotify-client/frontend/.cache The .cache file is derived when you copy over .spotipyoauthcache it will become .cache in the frontend folder. My "sPot" is fully operational without using a device ID, however you absolutly must have an authentic .cache file! FYI: When editing bash profile ... '#!/bin/bash' should be ... #!/bin/bash without the accent marks !!! Be sure to run ... pip3 install -r requirements.txt ... from the frontend folder Be sure to remove the <> symbols from your user name and password credentials |
After getting to the spotify login screen for the cache thing i cant seem to click on the login button. I can enter my login info (the email and the password) but not click the login button, nothing happens when i do. I am using vnc on the rpi zero w. |
Recommend using a Pi 4 or anything faster than a pi zero w for obtaining the .cache file ... using vnc can slow thing's down on a zero w, I used the desktop version of Raspberry Pi lite legacy so I could copy/paste and not need vnc. Once you secure your .cache file you can use the same existing SD card from the greater pi and return it to the pi zero w. I also used a pi zero 2w for speed. |
Thank you for responding so fast. I will try to maybe use a monitor or get a cheap pi from somewhere as I don't have another pi laying around. |
On a faster pi the browser works faster and you will be able to click/select sign in. Once the .cache file is obtained you can copy it to a usb stick and paste/transfer it to the zero of choice and save it on the stick for any future needs. |
I must thank you so much for just always helping here. I suddenly got it working on my pi zero w. It was just all a test of patience. |
Your right ... I found that a Big part of the fun is solving the issues that arise regardless of how long it might take. 😊 |
This testit.py script workes perfectly for me in the past. Could it be that spotify changed something in their API ? When I run the sript I get this output: pi@spotifypod:~/retro-ipod-spotify-client/frontend$ python3 testit.py Does some have the same issue? In that past it worked perfectly to update my playlists, etc. Thanks for your support and feedback! |
Perhaps the device ID has changed. Synchronize Spotify Data Synchronizing Spotify data! Last but not least, if you want to make sure all your playlists artists, etc are synchronized every time you turn on your Spotifypod, you can simply modify the script view_model.py instead of calling refresh_device, you can execute refresh_data. This will sync all your data and then will execute refresh.devices. This will make the boot up way slower! but it will synchronize every single time you switch on :). cd retro-ipod-spotify-client/frontend Then sudo nano view_model.py #spotify_manager.refresh_devices() spotify_manager.refresh_data() Comment out the first existing below line: add a second non existing below line un-commented: Then reboot! Be sure you throughly read issue 21 & 69. Another suggestion is to create a file called testit.py with the following 3 lines: import spotify_manager Place it in the frontend folder, and then run it from the command line: cd retro-ipod-spotify-client/frontend Then at the command prompt run: python3 testit.py This will only work if you created a .cache file, But if you're good to go you should see output to the screen as it downloads playlists, artists, etc. FYI: |
But for tracks and artists it worked: But I will check. Thanks! |
I'm also experiencing the same problem, a chat with GPT tells me that perhaps there are indeed problems with the Spotify API. Is this happening to you too? Below error messages (part) when running testit.py `Max Retries reached The above exception was the direct cause of the following exception: Traceback (most recent call last): |
Installing SpotifyPod (The code is modified for Ricardo's Alternate Build)
What you need to do before installing SpotifyPod
You need raspberry pi lite os legacy version We will also be using raspotify version 0.14 which we will be installing later
IMPORTANT This code works 2inch LCD Module ST7789V controller 240 x 320 Pixels For more hardware instructions please follow Ricardo's Alternate Build)
Installing updates
Install Required Packages
Change directory to home
Clone this repo and Install Dependencies
Installing Pi-btaudio
Install PigPio
Setup spotify API
Create a Spotify Developer Account, then create an app where you will get your Client ID, Client Secret, and create a Redirect URI
https://developer.spotify.com/dashboard/applications/
Add an app name and description can be anything
Save Client id and Save Secret id
Disable screen blanking
Disable Cursor and Screen Savers
Add or Create and Add this:
Then:
Configure Xintric
Run "spotifypod.py" with Autostart
Then paste this before exit
Please comment this out until I remind you to uncomment it, save the file and exit, then we are now going to make the the program that makes the clickwheel work an executable
change #define DATA_PIN 25 to #define DATA_PIN 5
when were running "gcc -Wall -pthread -o click click.c -lpigpio -lrt" just leave it alone till you see a blinking text box
Spotify credentials
Synchronize Spotify Data
Synchronizing Spotify data! Last but not least, if you want to make sure all your playlists artists, etc are synchronized every time you turn on your Spotypod, you can simply modify the script view_model.py
go to line 16
Configure Raspotify
Uncomment and fill the following line:
Enter your spotify login details, In the first XXX add your email address, and in the second XXX add your password
Ex:
Paste the following
Entering Device id
To obtain your device id you first have to go to https://developer.spotify.com/console/get-users-available-devices/
when you go the the website your ipod may not appear connect to it using the spotify app on the device list then retry the website and it should show up
Go to line 173 using ctrl+shift+_ and type 173 You can comment out the entire refresh_device def and replace it with
Replace the XXXXXXX with your device id
Ex:
def refresh_devices():
device = UserDevice(‘123456789','raspotify', True)
DATASTORE.setUserDevice(device)
After that you want to go save and exit the file then
Go to line 1734 using ctrl+shift+_
Paste this in:
Replace the xxxxxx with your device id
Post Install
Generate .cache files
Before running it modify the client id and secret also your scopes in with:
Scope:
Now you can save and exit the file
before reboot do the following:
Turn on vnc or connect a mouse to the pi, then reboot
Then you can run this program:
Recommend using a Pi 4 or anything faster than a zero w, but if this is the only pi you have you should be fine but it will take a while. Your pi should be displaying a black screen then right click and click on browser then go to internet/ browser (midori). Once you did that go to http://localhost:8080/ There should be a spotify sign in page, sign in, once signed in it should redirect you to a page with gibberish code and spotify credits. Once you're on that screen exit the page and in your terminal stop running the program.
Now move your cache file to the one in spotifypod
Once your done you can turn off vnc
If you get ERNO98 already in use go to issue 30
Install Display code
ssh into the pi and edit the config file
Add the code below:
DIsplay code
hdmi_group=2
hdmi_mode=87
hdmi_cvt=320 240 60 1 0 0 0
hdmi_force_hotplug=1
Also you have to comment out this code:
Then save it, after that download the display code:
Then we want to change the native resolution to take advantage of the whole display.
Go to line 18 which is ST7789
Change DISPLAY_NATIVE_HEIGHT from 240 to 320
After that save it and then nano into st7735r.cpp
Go to line 95 with ctrl+shift+_
Comment out the line beginning with SPI_TRANSFER with // then below it add this:
Then exit the file then run this command:
Once finished run:
After that is finished we want to make it run on boot:
Enter this before exit:
Uncomment the Autostart things:
Bluetooth
For bluetooth I these instructions:
To install blue-alsa link
To set up auto connect link
Use this to pair bluetooth device:
Please only follow the configuration instructions you already downloaded it in the previous link. link
When Done
Reboot and whenever you need to use the pod connect to it from your phone/ computer on the device list as if it were a speaker. It might take a while but it should connect eventually then you're free to exit the app and play songs from the pod.
Issues
Trying to recreate the Bluetooth settings (If you want to try and figure it out, I suggest going to #66 near the bottom there should be some links doris put)
If you have any issues please feel free to comment them below 😄
Resources:
Couldn't have done this without doris, they've helped me out so much.
https://hackaday.io/project/177034-spot-spotify-in-a-4th-gen-ipod-2004
https://github.com/dupontgu/retro-ipod-spotify-client
https://www.youtube.com/watch?v=KciKqGX8g94
#41
#22
#34
#65
#23
#66
http://rsflightronics.com/spotifypod
https://sigmdel.ca/michel/ha/rpi/bluetooth_n_buster_01_en.html
https://github.com/dtcooper/raspotify/wiki/Play-via-Bluetooth-Speaker
https://github.com/bablokb/pi-btaudio
The text was updated successfully, but these errors were encountered: