GithubHelp home page GithubHelp logo

vergoh / micropython-spotify-status-display Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 3.0 2.41 MB

"Currently playing" display for Spotify with play/pause/next/save controls

License: MIT License

Python 98.92% Makefile 1.08%

micropython-spotify-status-display's People

Contributors

vergoh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

micropython-spotify-status-display's Issues

OSError: [Errno 116] ETIMEDOUT

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?

OSError: [Errno 113] ECONNABORTED

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!

Does not work with podcasts (TypeError: 'NoneType' object isn't iterable)

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)

RuntimeError: Error 202 - when pressing either of buttons.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.