Webserver

Questions and comments specific to a particular plugin should go here.
User avatar
kgschlosser
Site Admin
Posts: 4652
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Webserver

Post by kgschlosser » Sat Mar 30, 2019 7:48 am

that is why a slider control is a better way to go instead of using a volume up or down when using a web app.


the logic is really simple to achieve even if you do not have a direct entry of the volume available. so long as you have a reporting of the current volume level. you would have the websocket event get generated in EG with the new volume and then in a script you can do something like the following.

Code: Select all

import time
new_volume = eg.event.payload

while eg.plugins.SomePlugin.GetVolume() != new_volume:
    eg.plugins.SomePlugin.VolumeUp()
    time.sleep(0.05) # 50 milliseconds is about the average for what a remote api can do for speed 
[code]
If you like the work I have been doing then feel free to Image

User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Webserver

Post by yokel22 » Sun Mar 31, 2019 3:51 pm

therealbiglou wrote:
Fri Mar 29, 2019 2:17 pm
I think what I could do is contain each remote interface into its own DIV and show/hide each DIV through JS. So, if EG sends an event like webserver.remote.cable, it would hide all DIVs without the ID of #cable and only show #cable. Does this sound feasible?
You shouldn't use #id's for multiple items. Use "class" instead. Id's are unique, classes are meant to apply to multiple items.

User avatar
kgschlosser
Site Admin
Posts: 4652
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Webserver

Post by kgschlosser » Sun Mar 31, 2019 4:53 pm

here is a link to learn how to make a slider in javascript. it is very simple to do.

https://www.w3schools.com/howto/howto_j ... slider.asp
If you like the work I have been doing then feel free to Image

therealbiglou
Experienced User
Posts: 123
Joined: Sat May 19, 2012 4:33 am

Re: Webserver

Post by therealbiglou » Mon Apr 01, 2019 8:49 pm

yokel22 wrote:
Sun Mar 31, 2019 3:51 pm
You shouldn't use #id's for multiple items. Use "class" instead. Id's are unique, classes are meant to apply to multiple items.
I've got it set up so each interface is contained in their own unique div with a unique ID. So, I have IDs of:

#RemoteCable
#RemoteStreaming
#RemoteChromecast
etc.

It was trivial to then hide/show the appropriate div based on what was going on inside EG. This actually works exceptionally well!

User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Webserver

Post by yokel22 » Tue Apr 02, 2019 7:00 pm

That's how id's should work. The way you described it. It sounded like you were going to try & use the same id on multiple divs. This can cause a number a # of problems for the webserver plugin..

Alternatively, you can use a class selector to hide/show multiple items with the same class with one variable change if need be.

Post Reply