pimoroni / pidi-spotify

MIT License
46 stars 12 forks source link

No FIFO event #6

Open KSuondProject opened 3 years ago

KSuondProject commented 3 years ago

Hi all, I've been installed the code and raspotify works very well if I don't add the "--onevent 'pidi_spotify --hook'" in OPTIONS in raspotify config file.

If I add this all breaks down. In tmp directory I haven't the log file, the cache art dir, the FIFO file, nothing. The display only show the play button and the static bar of volume and elapsed time.

I don't know how to solve this. Thanks in advance.

davidcsally commented 3 years ago

I'm also experiencing the same issue. With the onevent hook, playback freezes and the pi becomes unresponsive :(

KSuondProject commented 3 years ago

I'm also experiencing the same issue. With the onevent hook, playback freezes and the pi becomes unresponsive :(

I'm sadly happy to know that I'm not alone here! Have you done some other test to make this code working?

Gadgetoid commented 3 years ago

This sounds like pidi_spotify is not working for some reason or another.

Try running it directly from the command-line and see if it barfs up any error messages:

pidi_spotify --hook

My guess would be a missing dependency, but I'm not sure which. Everything is chaos at the moment, so it might take me some time to get around to digging up my SD card and testing this.

KSuondProject commented 3 years ago

This sounds like pidi_spotify is not working for some reason or another.

Try running it directly from the command-line and see if it barfs up any error messages:

pidi_spotify --hook

My guess would be a missing dependency, but I'm not sure which. Everything is chaos at the moment, so it might take me some time to get around to digging up my SD card and testing this.

Thanks in advance for your reply. Here's the result that terminal view when I write directly the command:


pi@raspberrypi:~/pidi-spotify $ pidi_spotify --hook
pi@raspberrypi:~/pidi-spotify $ sudo service pidi-spotify status
● pidi-spotify.service - PiDi Spotify Service
   Loaded: loaded (/etc/systemd/system/pidi-spotify.service; enabled; vendor pre
   Active: active (running) since Wed 2020-10-21 17:56:14 BST; 4s ago
 Main PID: 716 (pidi_spotify)
   CGroup: /system.slice/pidi-spotify.service
           └─716 /usr/bin/python3 /usr/local/bin/pidi_spotify

Oct 21 17:56:14 raspberrypi systemd[1]: Started PiDi Spotify Service.

pi@raspberrypi:~/pidi-spotify $ 

If I can do something for you with the pi zero let me know. I'm at your disposal.

KSuondProject commented 3 years ago

PLAYER_EVENT environment variable not set?

This message is in the pidi-spotify-hook.log file that I've open right now. I hope that helps to individuate the problem!

KSuondProject commented 3 years ago

Hi all,

There's some good news for us?

Gadgetoid commented 3 years ago

Try:

PLAYER_EVENT=start pidi_spotify --hook

To force the hook to process an event and see what happens.

You might also want to check /tmp/pidi-spotify-hook.log, which might shed some light if it exists.

KSuondProject commented 3 years ago

Try:

PLAYER_EVENT=start pidi_spotify --hook

To force the hook to process an event and see what happens.

You might also want to check /tmp/pidi-spotify-hook.log, which might shed some light if it exists.

I've tried the command that you say in the previus post but nothing change.

The log is here:

Traceback (most recent call last):
  File "/usr/local/bin/pidi_spotify", line 11, in <module>
    load_entry_point('pidi-spotify==0.0.1', 'console_scripts', 'pidi_spotify')()
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/__init__.py", line 156, in m$
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/hook.py", line 78, in main
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/hook.py", line 25, in dispat$
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/hook.py", line 30, in event_$
  File "/usr/lib/python3.7/os.py", line 678, in __getitem__
    raise KeyError(key) from None
KeyError: 'TRACK_ID'

What can I do to test where the process stuck?

KSuondProject commented 3 years ago

Someone can help me or the project is died?

N14BO commented 3 years ago

I am stuck, just like you ^^ not sure it is a good sign! I am using a RPi zero W if it helps troubleshooting... Which version of Python is required? 3.7? Gadgetoid, which version of Python are you using?

Gadgetoid commented 3 years ago

Project is on hiatus until I have a house and somewhere to set up a Pi :laughing: (I'm... not joking darn buyer chain really left us in the dust here)

Unfortunately I've no way of confirming my setup or figuring out what broke right now but I should - with any luck - get around to this in ~March.

N14BO commented 3 years ago

at the same time, I understand getitem is nothing new.... nothing Python 3 specific at least.

I'll give a try to an earlier release of Raspberry pi OS (Aug 2020) and see, lite and desktop, maybe will get more luck there...

Just adding the comment below if it help: Before reaching this step, I had issues with Pidi-spotify and read/write access to the tmp files. I edited the hook.py line 63 to 65 with w+ instead of a+ and r.

Gadgetoid, no worries at all!

KSuondProject commented 3 years ago

Hi,

There's some news here? after a 2 fresh install and all the pip3 module correctly installed I'm always on: PLAYER_EVENT environment variable not set?

Someone can help me please?

KSuondProject commented 3 years ago

Try:

PLAYER_EVENT=start pidi_spotify --hook

To force the hook to process an event and see what happens.

You might also want to check /tmp/pidi-spotify-hook.log, which might shed some light if it exists.

Hi @Gadgetoid, the log for the command: "PLAYER_EVENT=start pidi_spotify --hook" is this:

Traceback (most recent call last):
  File "/usr/local/bin/pidi_spotify", line 11, in <module>
    load_entry_point('pidi-spotify==0.0.1', 'console_scripts', 'pidi_spotify')()
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/__init__.py", line 156, in main
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/hook.py", line 78, in main
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/hook.py", line 25, in dispatch
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/hook.py", line 30, in event_start
  File "/usr/lib/python3.7/os.py", line 678, in __getitem__
    raise KeyError(key) from None
KeyError: 'TRACK_ID'

Thanks for the help, it would be beautiful if your code can works again.

Gadgetoid commented 3 years ago

I can't see why this would freeze playback, but it looks like some of the PLAYER_EVENT names were changed recently:

https://github.com/librespot-org/librespot/pull/526

This may conflate with the original issue here, just to make things all the more confusing.

The PLAYER_EVENT environment variable will only be set by librespot when it's calling an external script:

https://github.com/librespot-org/librespot/blob/632894a13e241209aacbbbe4f03e2fb9cf4273a9/src/player_event_handler.rs#L20-L72

If you're running the --hook command directly, it wont work. It needs to be added to Raspotify's config as per the README.

Edit: actually looks like the change to player event naming will not be released until at least librespot v0.1.7 - https://github.com/librespot-org/librespot/compare/v0.1.6...56f1fb6

KSuondProject commented 3 years ago

With a fresh install and all modules updated the playback doesn't freeze anymore but the display always show just the duration bar and the play symbols. I've read the --onevent function of librespot and how it works, I've tried to change a song while running the --hook but nothing happen. There's a way to see if the PLAYER_EVENT is detected correctly?

What does it mean PLAYER_EVENT environment variable not set? in the log? and this?

Traceback (most recent call last):
  File "/usr/local/bin/pidi_spotify", line 11, in <module>
    load_entry_point('pidi-spotify==0.0.1', 'console_scripts', 'pidi_spotify')()
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/__init__.py", line 156, in main
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/hook.py", line 78, in main
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/hook.py", line 25, in dispatch
  File "/usr/local/lib/python3.7/dist-packages/pidi_spotify-0.0.1-py3.7.egg/pidi_spotify/hook.py", line 30, in event_start
  File "/usr/lib/python3.7/os.py", line 678, in __getitem__
    raise KeyError(key) from None
KeyError: 'TRACK_ID'
735751363r commented 1 year ago

I have the same Probem as described. When I check the Status via: pi@raspberrypi:~/pidi-spotify $ sudo service pidi-spotify status

I get the following:

pi@raspberrypi:~/pidi-spotify $ sudo service pidi-spotify status
● pidi-spotify.service - PiDi Spotify Service
     Loaded: loaded (/etc/systemd/system/pidi-spotify.service; enabled; vendor preset: enabled)
     Active: inactive (dead)

Seems like pidi is not even working I dont know if it can help you or if you could help me! Sorry if might be offtopic.. But I am not deep into all this.