cees-elzinga / script.xbmc.hue.ambilight

XBMC add-on for Philips Hue lights with ambilight support
Do What The F*ck You Want To Public License
127 stars 123 forks source link

Picture Slideshow #33

Open AwesomeAustn opened 10 years ago

AwesomeAustn commented 10 years ago

Picture Slideshow does not work for me. I would like to use Ambilight. Is there a setting that I have to configure or is it not implemented yet?

johnslayer commented 10 years ago

I'd like to second this request! I filed a separate feature request about a week ago for the same thing. Since a picture is on the screen longer than each scene in a video I think the effect may be even more impressive with slideshows.

cees-elzinga commented 10 years ago

Not yet, but I like the idea and would be a nice addition!

I'll have to look into it. I'm closing the other report johnslayer, but I'll keep this one open.

cees-elzinga commented 10 years ago

Do you use an add-on for the slideshow? If so, which one?

johnslayer commented 10 years ago

Hey cees-elzinga! I don't currently use an add-on for the slideshow, but would be willing to if needed to make this work.

AwesomeAustn commented 10 years ago

Same here. I just use the default slideshow on Aeon Nox, but will use any add-on.

Sorry for posting a duplicate issue by the way.

cees-elzinga commented 10 years ago

I took some time to look into the issue. It took some more work than expected.

The add-on currently uses the XBMC video player API to take screenshots of the video being watched. A picture slideshow is not played by the "video player", but by a "picture player". I haven't figured out an easy way to take screenshots using the "picture player".

I put together a stand-alone scripts that can be used as a proof of concept. Instead of creating a screenshot it uses the XBMC HTTP API to check what file is being displayed by the "picture player". The script is available at: https://gist.github.com/cees-elzinga/8943531

To get it running you need to enable the HTTP API in XBMC (see the script), and configure the top part with the XBMC API settings and Philips Hue configuration. Then run the script and start XBMC and run a slideshow.

It needs some more work to be included in the add-on. Please give it a try and let me know if it's worth the effort ;-)

MattGrimes commented 10 years ago

Hey cees-elzinga,

Thanks for working on this! Much appreciated. I wanted to give you an update just so you know there is still interest. I tried to get the script running here at home, but it keeps throwing an error every time I try to start it. I have edited the script settings according to your recommendations. I'm running XBMC on Ouya and can't figure out how to view the error log or I'd post it here. Anyway, I'll take another stab at it this weekend. A couple of questions: 1) Is username/password required? I don't have them set for the webserver, but I can if needed. 2) Can I use the same key used in the original ambilight script? If not, how do I generate a new one?

MattGrimes commented 10 years ago

Any insights on the above? I'm gonna try again this afternoon and hopefully I'll make some progress. Any tips would be appreciated though. Anyone else get this working yet?

cees-elzinga commented 10 years ago

Hello Matt,

Thanks for trying it out. What exact error message do you get?

1) It's required in the current script. It should work without if you change line 22 to "AUTH = None" 2) Yes, you can re-use the key from the original script. I've also published a python script to add a new device: https://gist.github.com/cees-elzinga/9077169

MattGrimes commented 10 years ago

Traceback (most recent call last): File "pictureslideshow.py", line 40, in r = requests.get("http://{}:{}/jsonrpc".format(HOST, PORT), auth=AUTH) ValueError: zero length field name in format

is the error I am getting. I'm obviously a python newbie, so apologies there!

cees-elzinga commented 10 years ago

No problem, can you check if you specified the HOST and PORT variable correctly on the first few lines? try putting quotes around them?

On 18 feb. 2014, at 21:34, MattGrimes notifications@github.com wrote:

Traceback (most recent call last): File "pictureslideshow.py", line 40, in r = requests.get("http://{}:{}/jsonrpc".format(HOST, PORT), auth=AUTH) ValueError: zero length field name in format

is the error I am getting. I'm obviously a python newbie, so apologies there!

Reply to this email directly or view it on GitHubhttps://github.com/cees-elzinga/script.xbmc.hue.ambilight/issues/33#issuecomment-35430215 .

MattGrimes commented 10 years ago

Seemed to be an issue with my version of python. I updated to 2.7 and no longer getting that issue. Now I'm seeing this: # Traceback (most recent call last): File "pictureslideshow.py", line 294, in screen = Screenshot(get_pixels(picture), SIZE[0], SIZE[1]) File "pictureslideshow.py", line 81, in get_pixels im = Image.open(filename) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 1952, in open fp = builtin.open(fp, "rb") IOError: [Errno 2] No such file or directory: u'http://farm3.staticflickr.com/2875/12603283224_88494e17cd_b.jpg' # I get the same error even if the picture is on an SMB drive on my local network. Thanks again for the help.

cees-elzinga commented 10 years ago

Ah it doesn't work (yet) with streaming pictures . I only tested it with a slideshow with pictures on my machine. It now tries to open a website or smb share as a local file and will fail. Can you try with a local slideshow?

On 18 Feb 2014, at 22:39, MattGrimes notifications@github.com wrote:

Seemed to be an issue with my version of python. I updated to 2.7 and no longer getting that issue. Now I'm seeing this:

Traceback (most recent call last): File "pictureslideshow.py", line 294, in screen = Screenshot(get_pixels(picture), SIZE[0], SIZE[1]) File "pictureslideshow.py", line 81, in get_pixels im = Image.open(filename) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 1952, in open fp = builtin.open(fp, "rb") IOError: [Errno 2] No such file or directory: u' http://farm3.staticflickr.com/2875/12603283224_88494e17cd_b.jpg'

I get the same error even if the picture is on an SMB drive on my local network. Thanks again for the help.

Reply to this email directly or view it on GitHubhttps://github.com/cees-elzinga/script.xbmc.hue.ambilight/issues/33#issuecomment-35437530 .

MattGrimes commented 10 years ago

After figuring out all the python packages I was missing and the local vs external image issue, I did finally get it working. It does exactly as I'd hoped. I think with a few customization options this will be the perfect mood setter. The transitions don't need to be as fast, so you really notice the effect.

Thanks for working on this. Looking forward to seeing it in the final addon!

cees-elzinga commented 10 years ago

Awesome that you got it working ! You can adjust the transition time yourself if you like, it's on the last line of the script:

set_light(h, s, v, 10)

10 is the transition time in milli seconds , you can just change it to eg 1000

MattGrimes commented 10 years ago

Hey cees-elzinga,

Any updates on adding slideshow support to the main addon? It really is an amazing effect. If you want to see just how much more dramatic it is than using it with a fast moving video, try downloading this video from youtube: https://www.youtube.com/watch?v=xj8ska-zIyE

It is a video slideshow of different landscapes set to (terrible) music. I've been looping it with the sound off and the hue affect makes it quite beautiful. It would be really awesome to be able to do this with photo slideshows through the addon.