-
Notifications
You must be signed in to change notification settings - Fork 97
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 fixed Cache, env variables and got everything running #41
Comments
spotify refresh devices found results: {'devices': []} when i launch the spotifypod - the devices are either NULL value - meaning that i can navigate the playlists and such but i cannot click on a song - as the DEVICE is EMPTY and simply displays 0 minutes of the song is there a way to hard code the device ID into the code? |
After a quick search in the code, I would guess this is the section, where you could do something like this:
def refresh_devices():
# results = sp.devices()
DATASTORE.clearDevices()
device = UserDevice("your-device-id", "your-device-name", True)
DATASTORE.setUserDevice(device) I’m not sure if you pass a boolean value as |
this totally works thanks |
Hi! I'm definitely getting closer here! After running "python spotipy_oauth_demo.py", the hyperlink appears and when I click it, it says "INVALID_CLIENT: Invalid redirect URI." Would that be in the OAuth Demo file? Or in my source code? Or in the Spotify Developer tab? Thank you so much for your time! |
My first guess would be the Spotify Developer dashboard. Did you enter a callback URI in the application settings? I guess you can enter whatever you want as long as it fits the requirements of an URI. I did use The link in the readme indicates that
|
I am so close! I am stuck on the authentication step. when I click the authenticate button in Midori after signing in, I get lead to a page saying "Midori can't find the page you're looking for". I tried 127.0.0.1, spotify-iPod://callback, and localhost:8080 as URIs, along with changing them to the same thing in the demo.py, and they have all had the same issue. Is this a trial/error sort of thing? |
I guess you are even closer as you think (: If I remember correctly, you need to copy the link of this page into your terminal to complete the authentication. There should be a matching promt, which asks you to paste the url |
That's what I'm stuck on now I think. There is no prompt in the terminal, and if I paste it in, it doesn't do anything. |
You need to do it from X AFIAK. Just right click, open browser and do it that way. |
Hi Gents, Then you need to remove the folder /home/pie/.config/midori (rm -rf /home/pie/.config/midori ). This was at least for me important, because the midori browser always showed "INVALID_CLIENT: Invalid redirect URI" due to the fact it was cached. Other then tomaculum suggested I did not use VNC. I connected the PI zero directly to HDMI and started the midori browser through these two lines in /etc/xdg/openbox/autostart. sudo vi /etc/xdg/openbox/autostart python /home/pi/spotipy_oauth_demo/spotipy_oauth_demo.py & Hope that helps! |
Just a few notes on how I got things working, mostly based on what I have read in various issue threads. Credit to #22 #30
/boot/config.txt if you bought the screen from the tutorial
comment out hdmi_force_hotplug=1
#hdmi_force_hotplug=1
uncomment sdtv_mode
sdtv_mode=0
uncomment disable overscan
disable_overscan=1
also want to put in your wpa_supplicant.conf in the boot directory as well at this time
Install git:
Step 2.
Add
sudo apt install git
Clone repo
Step 3
add
git clone https://github.com/dupontgu/retro-ipod-spotify-client
before installing requirementsadd env variables to bash profile
Step 8
sudo nano ~/.bash_profile
pass env variables to spotify ipod script
Step 10
replace
sudo -H -u pi python3 spotifypod.py &
withsudo -H -u pi --preserve-env=SPOTIPY_REDIRECT_URI,SPOTIPY_CLIENT_ID,SPOTIPY_CLIENT_SECRET python3 spotifypod.py &
Also need to compile click.c
Post install
We need to generate a .cache file for the spotify token. I suggest doing this on a pi 3 or 4 and using VNC.
sudo apt install midori
git clone https://github.com/perelin/spotipy_oauth_demo
sudo apt install python python-pip
cd ~/spotipy_oauth_demo
pip install -r requirements.txt
modify spotipy_oauth_demo.py and add your client id and secret
run the oauth demo with
python spotipy_oauth_demo.py
using Midori, navigate to http://localhost:8080, you should see a hyperlink that says login to spotify, click it, you will be redirected to spotify login, just login and accept the terms
cp ~/.spotipyautocache ~/retro-ipod-spotify/frontend/.cache
chmod 777 ~/retro-ipod-spotify/frontend/.cache
Run
raspi-config
one more time to disable VNC from the interface menu, reboot and now you should be good.As a side note, be careful with the ipod case being metal it is really easy to short the various solder points you have made. I lined mine with electrical tape to avoid it, in the future I plan on 3d printing something to hold the various components in place and keep them from shorting.
The text was updated successfully, but these errors were encountered: