kershner / screenBloom

Fake Ambilight for Philips Hue via Python
http://www.screenbloom.com
329 stars 48 forks source link

Cant Run on. Possibly some python issue on my end. #17

Closed hipstersmoothie closed 7 years ago

hipstersmoothie commented 7 years ago

i get this when i run ./screenBloom from the command line

Traceback (most recent call last): File "", line 355, in socket.gaierror: [Errno 8] nodename nor servname provided, or not known screenbloom returned -1

kershner commented 7 years ago

Thanks for reporting this. I've gotten a handful of reports about this error (on the Mac version, correct)? It has something to do with not being able to find your machine's IP, I believe. I currently don't know what is causing the error because I can't reproduce it on my Mac. I will keep trying to solve it.

hipstersmoothie commented 7 years ago

Yeah I'm on a macOS Sierra. if there is anything else i can do to help you. just holler away

kershner commented 7 years ago

If you have the time can you let me know what these commands output? Open up a Python shell and do the following:

import socket
print socket.gethostbyname(socket.getfqdn())  # Let me know what this outputs
print socket.gethostbyname(socket.gethostname())  # This should produce the error

I appreciate it!

hipstersmoothie commented 7 years ago
>>> import socket
>>> print socket.gethostbyname(socket.getfqdn())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
>>> print socket.gethostbyname(socket.gethostname())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

some extra

>>> print socket.getfqdn()
Andrews-MacBook-Pro.local
>>> print socket.gethostname()
Andrews-MacBook-Pro.local
kershner commented 7 years ago

Can you try this one? I think this is the winner:

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
print(s.getsockname()[0])
s.close()
hipstersmoothie commented 7 years ago
>>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> s.connect(("8.8.8.8", 80))
>>> print(s.getsockname()[0])
192.168.0.15
>>> s.close()
kershner commented 7 years ago

Just beautiful. I've had a few other confirmations that this code produces the right IP, from people who also got the socket.gaierror before. I'm going to do some more testing with it and probably put it into the next version, which should be ready pretty soon.

Thanks so much for your help!

hipstersmoothie commented 7 years ago

Awesome! Glad i could help.

Btw I got it working on my work computer, and a I have some gen 3 lights. They program doesnt really produce the full spectrum the new lights can produce. Specifically bringing up a blue or green screen produces gen2 looking color.

kershner commented 7 years ago

Interesting, can you send a link or a screen of the image that produces the color?

hipstersmoothie commented 7 years ago

example for green

image used (I zoomed in a lot):

color produced in hue app img_0507 png

all of these produce basically the same shade of yellow leaning lime green https://upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Color_icon_green.svg/1024px-Color_icon_green.svg.png

hipstersmoothie commented 7 years ago

Light blue comes out purple:

image used:

screen shot 2016-11-14 at 7 28 24 pm

color produced: img_0508 png

kershner commented 7 years ago

Thanks for the info. The ScreenBloom parsing algorithm came up with this color for that image, so I think it's just the RGB->Hue conversion. The library I use is pretty old so the gamuts could be out of wack with the new Hue stuff. I'll look into getting it updated, and I should probably get some new Hue stuff for testing (a convenient excuse to get new Hue shit haha).