vergoh / micropython-spotify-status-display Goto Github PK
View Code? Open in Web Editor NEW"Currently playing" display for Spotify with play/pause/next/save controls
License: MIT License
"Currently playing" display for Spotify with play/pause/next/save controls
License: MIT License
Hi. Any one can help me? I am getting this error after uploading all files with Micropython and reloading:
MPY: soft reboot
no "memdebug" file or directory found, memory debug output disabled
Traceback (most recent call last):
File "main.py", line 3, in <module>
File "spotify.py", line 38, in __init__
File "oled.py", line 15, in __init__
File "ssd1306.py", line 124, in __init__
File "ssd1306.py", line 40, in __init__
File "ssd1306.py", line 65, in init_display
File "ssd1306.py", line 129, in write_cmd
OSError: [Errno 116] ETIMEDOUT
MicroPython v1.21.0 on 2023-10-05; Generic ESP32 module with ESP32
Type "help()" for more information.
I reasearched about the issue but I am not getting a clear answer. Maybe someone had this problem too?
I am facing this error:
MPY: soft reboot
no "memdebug" file or directory found, memory debug output disabled
buttons enabled
network configured
connected at 192..... as spostatus
listening on ('0.0.0.0', 80) as http://192.... - login at http://spostatus.local
client connected from ('192....', 57234)
GET / HTTP/1.1
not callback path, giving login
client connected from ('192....', 57235)
GET /callback/?code=A... HTTP/1.1
got params: {'code': 'A...'}
reply reports error: None
authorization_code content: A....()
POST https://accounts.spotify.com/api/token
OSError: [Errno 113] ECONNABORTED
failed, retrying...
POST https://accounts.spotify.com/api/token
OSError: -202
token status received: 0
Traceback (most recent call last):
File "main.py", line 4, in <module>
File "spotify.py", line 561, in start
File "asyncio/core.py", line 1, in run_until_complete
File "asyncio/core.py", line 1, in run_until_complete
File "asyncio/core.py", line 1, in run_until_complete
File "spotify.py", line 507, in _looper
File "spotify.py", line 375, in _initial_token_request
File "spotify.py", line 234, in _get_api_tokens
File "spotify.py", line 224, in _validate_api_reply
RuntimeError: token api error 0 - -202
MicroPython v1.21.0 on 2023-10-05; Generic ESP32 module with ESP32
Type "help()" for more information.
This happens after I go to the prompted url and accept the permissions.
Btw, I am not using an oled screen, I just commented all the oled part for now. Maybe this could be something?
My Esp32 is this: ESP-WROOM-32 TYPE C (CP2104)
Using Mycropython to load the files
Thony: 4.1.4
Python: 3.10.11
I just have the two buttons connected
Thank you in advance for your reply!
Example of what podcast returns from API:
{'json': {'item': None, 'actions': {'disallows': {'resuming': True}}, 'context': None, 'timestamp': 1678973668576, 'progress_ms': 6149773, 'currently_playing_type': 'episode', 'is_playing': True}, 'text': 'No reply content', 'status_code': 200}
Script ends up in state where None ends up to be iterated and it fails:
TypeError: 'NoneType' object isn't iterable
Quick fix that prevents this and prints 'Podcast' to screen (no podcast or episode name apparently available at the moment from API).
diff from spotify.py:
252a253,255
> if r['json']['currently_playing_type'] == 'episode':
> r['json']['item'] = {'podcast': 'true'}
>
343,344c346,351
< self.oled.show(cp['item'].get('artists', [{}])[0].get('name'), cp['item'].get('name'))
< await asyncio.sleep(seconds)
---
> if 'podcast' in cp['item']:
> self.oled.show('Podcast', '')
> await asyncio.sleep(seconds)
> else:
> self.oled.show(cp['item'].get('artists', [{}])[0].get('name'), cp['item'].get('name'))
> await asyncio.sleep(seconds)
Screen says:
Spotify status
next api error
202
Using:
MicroPython v1.19.1 on 2022-06-18; ESP32 module with ESP32
next button pressed
POST https://api.spotify.com/v1/me/player/next
Traceback (most recent call last):
File "main.py", line 4, in <module>
File "spotify.py", line 511, in start
File "uasyncio/core.py", line 1, in run_until_complete
File "uasyncio/core.py", line 1, in run_until_complete
File "uasyncio/core.py", line 1, in run_until_complete
File "spotify.py", line 484, in _looper
File "spotify.py", line 168, in _handle_buttons
File "spotify.py", line 308, in _next_playback
File "spotify.py", line 187, in _validate_api_reply
RuntimeError: Error 202 -
Might be user error, but this was working ok earlier.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.