Schlaubischlump / shairport-metadatareader-python

A shairport-metadata-reader package written in Python, which supports reading the metadata from the pipe file, the UDP-server and the MQTT server if configured.
GNU General Public License v3.0
9 stars 4 forks source link

StringProperty can only accepts strings #1

Closed artenverho closed 6 years ago

artenverho commented 6 years ago

Hi Schlaubischlump,

I have tried to install and run one of the example scripts and I seem to get the following error:

  File "simple_print.py", line 11, in <module>
    from shairportmetadatareader.util import IS_PY2
  File "/usr/local/lib/python2.7/dist-packages/shairportmetadatareader/__init__.py", line 2, in <module>
    from .airplaylistener import AirplayListener, DEFAULT_PIPE_FILE, DEFAULT_SOCKET
  File "/usr/local/lib/python2.7/dist-packages/shairportmetadatareader/airplaylistener.py", line 61, in <module>
    class AirplayListener(EventDispatcher):
  File "/usr/local/lib/python2.7/dist-packages/shairportmetadatareader/airplaylistener.py", line 78, in AirplayListener
    client_name = StringProperty([])
  File "/usr/local/lib/python2.7/dist-packages/eventdispatcher/stringproperty.py", line 24, in __init__
    raise ValueError('StringProperty can only accepts strings.')
ValueError: StringProperty can only accepts strings.

Probably I am doing something wrong here. Can you help?

Thanks! I am curious if I can use your tool!

Arten

artenverho commented 6 years ago

I found a temporary fix

I changed the Evendispatcher part in the the airplay listener.py from:

   client_name = StringProperty([])
    '''Name of the airplay client e.g John's iPhone.'''

    playback_state = StringProperty("stop", options=["play", "pause", "stop"])
    '''Playback state.'''

to

    client_name = StringProperty("")
    '''Name of the airplay client e.g John's iPhone.'''

   #playback_state = StringProperty("stop", options=["play", "pause", "stop"])
    '''Playback state.'''

I am probably missing some info now but at least I can run the code..

my plan is to use the code to make a simple arduino based USB display/remote that shows the currently played song and can control the client with hardware buttons.

cheers,

Arten

Schlaubischlump commented 6 years ago

Hi Arten,

I only tested the code with kivy, not with eventdispatcher. Of course playback_state should be an OptionProperty, not a StringProperty. I pushed an updated version, which should fix this error. Could you please test the new version and report back ? Which version of python did you use ?

If you need further help on how to use the library let me know.

Schlaubi