question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autostart, Clickwheel, Spotify Credentials... How I made the screen work

See original GitHub issue

So, I’ve spent more nights than I should have working on this, my first Raspberry Pi project.

Here are the things I’ve done following the README file and trying to make it work for myself…

For the ones that don’t know, you can code everything from your PC/Mac terminal and you can copy/paste the codes. I didn’t know for the first days.

Details on what works and what doesn’t at the end of this…

So:

Install Raspberry Pi OS Lite to your Pi and then configure your WiFi on first boot

  1. Install Updates sudo apt-get update sudo apt-get upgrade

  2. Install Dependencies sudo apt install python-setuptools python3-setuptools sudo apt install python3-pip sudo curl-sL https://dtcooper.github.io/raspotify/install.sh | sh sudo apt install install xorg sudo apt-get install python3-tk sudo apt-get install redis-server sudo apt-get install openbox sudo apt-get install lightdm sudo apt-get install x11-xserver-utils

  3. Install Dependencies pip3 install -r requirements.txt This command didn’t work. So I ran the following: sudo apt-get install git git clone https://github.com/dupontgu/retro-ipod-spotify-client After this: cd /home/pi/retro-ipod-spotify-client/frontend/ To finally run this… pip3 install -r requirements.txt

  4. Install pi-btaudio git clone https://github.com/bablokb/pi-btaudio.git cd pi-btaudio sudo tools/install

All worked fine. For bluetooth pairing and instructions, go to https://github.com/bablokb/pi-btaudio

  1. Install PiGPIO wget https://github.com/joan2937/pigpio/archive/master.zip unzip master.zip cd pigpio-master make sudo make install

I don’t know if it works because I haven’t been able to use the Clickwheel. Still don’t know it it’s a hardware or software issue…

  1. 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. I recommend watching this video and try to make something like the link on README. I think it hasn’t worked 100% right for me though…

  2. Disable Screen Blanking sudo raspi-config Display Option > Screen Blanking > OFF / Disable

  3. Disable Cursor and Screen Savers Add or Create and Add this: sudo nano /root/.bash_profile Then: ‘#!/bin/bash’ [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor # Disable any form of screen saver / screen blanking / power management xset s off xset s noblank

  4. Configure xinitrc sudo nano /etc/X11/xinit/xinitrc Inside, make sure the following is there: #!/bin/sh # /etc/X11/xinit/xinitrc # global xinitrc file, used by all X sessions started by xinit (startx) # invoke global X session script #. /etc/X11/Xsession' exec openbox-session #-> This is the one that launches Openbox ;)`

  5. Run “spotifypod.py” with Autostart sudo nano /etc/xdg/openbox/autostart and add the following command to launch spotifypod.py: I made some changes and didn’t use the /fork/ folder as in README cd /home/pi/retro-ipod-spotify-client/frontend/ sudo -H -u pi python3 spotifypod.py & sudo /home/pi/retro-ipod-spotify-client/clickwheel/click & There is no clickso in order to get that: cd /home/pi/retro-spotify-client/clickwheel gcc -Wall -pthread -o click click.c -lpigpio -lrt It returns some warnings but everything is fine. I guess…

  6. Spotify Credentials ‘sudo nano /etc/xdg/openbox/environment’ Add you credentials: export SPOTIPY_CLIENT_ID='your_SPOTIPY_CLIENT_ID' export SPOTIPY_CLIENT_SECRET='your_SPOTIPY_CLIENT_SECRET' export SPOTIPY_REDIRECT_URI='your_SPOTIPY_REDIRECT_URI'

  7. Syncronize 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 with the following at line 16: #spotify_manager.refresh_devices() spotify_manager.refresh_data()

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 😃. If you don’t run at least once refresh_data() no playlist, artist or anything related with your account will be displayed!

I had errors with this part so I left it as it was…

  1. Configure Raspotify sudo nano /etc/default/raspotify Uncomment and fill the following line: OPTIONS="--username <USERNAME> --password <PASSWORD>" And maybe you want also to consider the following: # The displayed device type in Spotify clients. # Can be "unknown", "computer", "tablet", "smartphone", "speaker", "tv", # "avr" (Audio/Video Receiver), "stb" (Set-Top Box), and "audiodongle". DEVICE_TYPE="smartphone"

All good. I also changed the Device Name

  1. Display Configuration! sudo nano /boot/config.txt uncomment (erase #): sdtv_mode=2 comment add (#) hdmi_force_hotplug=1 then add: hdmi_ignore_hotplug=1

After this if it throws error for displaying spotifypod.py try the following command: export DISPLAY=:0.0

So that’s what I’ve got. The app doesn’t autostart. When I start it I get the frontend screen that shows NOW PLAYING when I play a song on my phone. I still haven’t been able to work with the clickwheel, it is running with no errors apparently, but it doesn’t work with my clickwheel at least so I haven’t tried the app on itself. I connected the Pi to my bluetooth speaker and from my phone I used the Pi as a Remote Device and I got Spotify audio out of it. Is it able to choose it’s own songs and play them, I still don’t know. I hope this works for someone and if anybody has any info on how to solve the rest of this, please share hahaha.

Cheers and thanks @dupontgu for this fun project.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:27 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
doctorleachcommented, Mar 9, 2021

@doctorleach omg thank you so much for posting that, I had no idea what might have caused that error and also prevented the whole UI from loading…

Bitte sehr!

0reactions
annalynmcommented, Apr 26, 2021

@theswz I had to temporarily table this project as the peak of the semester hit, so I haven’t made much progress since my last post.

The most recent Spotify credential error I received said that the program couldn’t the browser to verify the URI.

I connected a mouse to the pi and when it boots to the blank screen with a mouse icon I was able to right click to access a drop down menu and run the midori browser from there. I made a bit of progress trying to get the Spotify credentials to authorize there, but I was struggling because I had to keep alternating between having the keyboard and the mouse plugged in and the pi would reboot if I switched them too many times. (I bought a usb splitter, but I haven’t had time to work on the project since then).

The same drop down menu I was running the midori browser from also has a terminal option listed. I’ve read elsewhere in these forums that some people had more success getting the Spotipy program to run in there.

If you figure it out, please share the secret! I’m hoping to pick the project back up in the next week or so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · dupontgu/retro-ipod-spotify-client · GitHub
The software that powers the sPot: a 4th generation "Click Wheel" iPod with a ... Autostart, Clickwheel, Spotify Credentials... How I made the...
Read more >
How to Enable or Disable Spotify to Automatically Start at Login
Method 1: Enable Spotify to start automatically at login from the app. First, open Spotify on your desktop and click your profile username ......
Read more >
Lumafield's CT scanner reveals the insides of classic iPods
The click-wheel mechanism is the most striking element in this 3D scan of the original iPod. [Photo: courtesy of Lumafield] Apple went ahead ......
Read more >
sPot: Spotify in a 4th-gen iPod (2004) | Hackaday.io
Full-on Spotify scrolling and streaming via a Raspberry Pi Zero W and the original iPod clickwheel. Bluetooth, WiFi, and haptic feedback!!
Read more >
You Might Also Like - Hacker News
Maybe some day Scott Forstall will return in Jobs-like fashion and ... because making both of your products work together better might mean ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found