jishi / node-sonos-web-controller

A web based controller for Sonos utilizing web sockets for a native look and feel
MIT License
247 stars 45 forks source link

Search #61

Open coricidin12 opened 7 years ago

coricidin12 commented 7 years ago

Hi Jishi, thanks so much for this great software! I've used pieces of it to integrate sonos into my home control interface and it works great. I'm no javascript expert but I did make a couple changes in case anyone is interested:

-implemented noUIslider.js for volume sliders so they work across touch and non-touch interfaces -implemented hammer.js for drag and drop zone management so they work across touch and non-touch interfaces -changed current-track-art src to (ip + albumArtUri) instead of absoluteAlbumArtUri so it works when accessed from outside LAN

My question is if it is possible to implement search/browse of Google Music into the interface. That's the last thing I need to abandon the native sonos apps entirely. There are 3rd party apps for Windows that implement search such as Zonos and Phonos, so it seems like it must be possible, but I'm an inexperienced developer so I don't know where to start.

Any chance of implementing this? I would be happy to help or contribute to development however I can. Thanks again, awesome project.

jishi commented 7 years ago

I never planned on supporting touch, because I wanted a different interface for it. I started the work on the /m layout, but it lacks a lot of the features.

Google Music is troublesome, it doesn't have any official public API, and the Sonos-search endpoints are authenticated. The credentials is not easily accessible, and requires some sort of decryption (which, the author of Phonos knows, but won't tell), and I guess Zonos does the same.

If you can get a hold of a binary of the Zonos app, I can see if I can figure out how it's done. Email it to me at jimmy at shimizu.se if you can find it.

coricidin12 commented 7 years ago

Have you seen this?

https://www.npmjs.com/package/playmusic

Not as good as pulling the authentication from Sonos, but could it be used as a work-around? Put the login creds in the settings.json file and use that module for search?

jishi commented 7 years ago

No I haven't, good find. Need to verify that the track/playlist identifiers returned from the API is the same one that Sonos uses. If that is the case, it should be possible to use it.

coricidin12 commented 7 years ago

I have an extra gmusic all access account in my family plan, I can give it to you for dev purposes if you need it.

sw764206 commented 4 years ago

Hi Jishi, thanks so much for this great software! I've used pieces of it to integrate sonos into my home control interface and it works great. I'm no javascript expert but I did make a couple changes in case anyone is interested:

-implemented noUIslider.js for volume sliders so they work across touch and non-touch interfaces -implemented hammer.js for drag and drop zone management so they work across touch and non-touch interfaces -changed current-track-art src to (ip + albumArtUri) instead of absoluteAlbumArtUri so it works when accessed from outside LAN

My question is if it is possible to implement search/browse of Google Music into the interface. That's the last thing I need to abandon the native sonos apps entirely. There are 3rd party apps for Windows that implement search such as Zonos and Phonos, so it seems like it must be possible, but I'm an inexperienced developer so I don't know where to start.

Any chance of implementing this? I would be happy to help or contribute to development however I can. Thanks again, awesome project.

hi, are you able to share how and what exactly you did to enable drag and drop zone management and volume slider for touch devices. Does the drag and drop work on mobile devices too?

coricidin12 commented 4 years ago

Basically I replaced the slider elements in the original code with noUIslider.js sliders. noUIslider.js is a javascript library that generates customizable sliders that are touch friendly. I modified the code that sends and receives websocket updates regarding sonos zone volume to be linked to the noUIslider.js sliders instead of the sliders from the original code.

For the drag and drop piece, I used the hammer.js library. I replaced the drag and drop functions from the original code with hammer.js equivalents, which are touch friendly.

I didn't actually make any of these changes to jishi's original interface, I built my own gui and basically use jishi's code as the under the hood websocket communication for it.

sw764206 commented 4 years ago

Thank you for your reply! Is it as simple as replacing a line or two of code in the volume-slider.js file? or replacing the entire file? Same question for the hammer.js library? I'm a noob when it comes to coding, so not sure exactly how to go in and make these changes. I tried changing the first lines of code (var state=.....) in the volume-slider file with the code provided here https://refreshless.com/nouislider/ but I don't think I did it correctly.