INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: ezmote: Another Web Based Remote  (Read 1754 times)

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3961
ezmote: Another Web Based Remote
« on: January 29, 2018, 03:13:14 am »

I have found the existing remotes don't work brilliantly in my setup, specifically

- I use zoneswitch so content is automatically played in the right zone, all existing remotes make you choose a zone as an entry point which confuses users
- I use the WDM driver to allow external content (netflix, iplayer and other web based content, an hdmi capture card for my cable box) to be routed through jriver's audio engine & use a zoneswitch rule to route this content through a particular zone (the problem here being the active zone doesn't change when you do this so users can no longer use any existing solutions as a volume control)

i.e. I use my HTPC for the same role as you would typically use an AV processor, master volume control and source selection.

I wrote my own remote to fill this gap & thought I might as well mention it here in case anyone else finds it useful.

Features

Some pics are attached to show what it looks like and how it works, a brief recap

- the icons down the left are configured in the server and are effectively the "sources" you can choose between, clicking on any one will trigger the configured command to fire on the server
- all screens show the volume slider with +1/-1/mute buttons near the top, this controls the volume in the active zone
- commands can be configured to be driving jriver or triggering some external source
- if the command is talking to jriver
  - the top menu bar gets an autocomplete search feature which is based on the MCWS/v1/Browse/Children endpoint, selecting an item from that list will instruct jriver to start playback of that item
  - the main remote screen has 2 tabs; playing now (v similar to the jremote playing now screen) and remote control (much like the gizmo theatre view screen)
- if the command is talking to a tivo
  - the top menu bar gets a channel select feature (NB: this is hardcoded at the moment to the UK Virgin channel list)
  - the main remote screen is a tivo remote control which talks to a named tivo on the network using the web remote protocol (the backend for this is heavily inspired by https://github.com/wmcbrine/tivoremote)
- if the command is talking to anything else
  - you just get a volume control

The UI is designed to fit on a phone sized screen, I've tested this on an HTC One M8, a Pixel 2 XL and a Nexus 6. It does scale up somewhat gracefully as the screen gets bigger but I haven't sought to use that space for anything as I don't personally plan to run this on a bigger screen.

Selecting External Sources

I've used autohotkey for managing external sources. The scripts are in https://github.com/3ll3d00d/cmdserver/tree/master/ahk and are quite simple, they basically make sure that one and only one of the apps is running

e.g.

if you choose netflix and a browser is open on the iplayer, the browser will be closed and the netflix app will be opened
if you choose some jriver view and netflix is open, netflix will be closed and jriver switched to the requested view

It's important that any command that selects an external source is configured with the IPC zone id so that the app knows to set the zone accordingly.

The app also keeps track of which external source is playing so it can show this in the command list. I have done this via another AHK script (https://github.com/3ll3d00d/cmdserver/blob/master/ahk/getPlayingNow.ahk) which the app will call periodically if it sees the active zone is playing the Ipc library item.

Running it

You can grab the exe from https://github.com/3ll3d00d/ezmote/releases/tag/0.1.0 but refer to https://github.com/3ll3d00d/cmdserver/#configuration (or ask in this thread) on how to configure it. The exe fires up a webserver so simply runs in a command line window.

I was thinking of using http://nssm.cc/ to run it as a service but haven't got to that bit yet.

Technical Notes

- it's a webapp so it needs a webserver, the exe above is a python 3.6 app created by pyinstaller (http://www.pyinstaller.org/) running a twisted webserver (https://twistedmatrix.com/trac/), code for this can be found in https://github.com/3ll3d00d/cmdserver
- the webapp itself lives in the ezmote repo, it's a react-redux app which uses material-ui for the ui components
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 71354
  • Where did I put my teeth?
Re: ezmote: Another Web Based Remote
« Reply #1 on: January 29, 2018, 06:53:50 am »

Thanks for your contribution.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3961
Re: ezmote: Another Web Based Remote
« Reply #2 on: January 30, 2018, 03:22:25 am »

You can install as a service using nssm by

- setup the app in some local directory, mine is like

Code: [Select]
$ cd /c/Users/Matt/AppData/Local/ezmote
$ find
./cmdserver.yml
./icons
./icons/all4.ico
./icons/amazon.ico
./icons/iplayer.ico
./icons/itv.ico
./icons/netflix.ico
./icons/virgin.ico
./ezmote_server.exe
./scripts
./scripts/getPlayingNow.exe
./scripts/ezmote.exe
./logs

(the scripts dir contains the ahk scripts referenced in my cmdserver.yml)

- download nssm from https://nssm.cc/download
- extract this somewhere (& optionally put that directory on your path)
- open a cmd window (as an adminstrator) and type

Code: [Select]
nssm install ezmote

- on the Application tab, set Path = the full path to the ezmote_server.exe
- on the Details tab, set display name = ezmote (or whatever you like)
- on the Log On tab, log on as "Local System" (not sure if this is particularly secure, I'm not concerned as I don't open this to the outside world)
- on the Process tab, uncheck console window
- on the Exit actions tab, I set it to restart on failure with a 2000ms delay
- on the I/O tab, set stdout to log to a file named std.out in the logs dir next to the exe
- on the Environment tab, add the following env var ; CMDSERVER_CONFIG_HOME=<the path to the ezmote_server.exe>

click install then start the service
you should see a file name std.out pop out into the log dir and it should autogenerate a default cmdserver.yml file in the main directory
stop the service, edit the yml to setup your commands, restart the service and away you go

running through this makes me realise I need to add some default initial config to the webapp so you don't have to enter that each time you open it in a new browser...
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3961
Re: ezmote: Another Web Based Remote
« Reply #3 on: June 09, 2019, 04:51:51 pm »

I got round to adding a better browse feature to this, release (of the webapp bit) is https://github.com/3ll3d00d/ezmote/releases/tag/0.2.2 and the packaged version is https://github.com/3ll3d00d/cmdserver/releases/tag/0.1.0-beta.6

one thing I like about this vs panel is that it lazily loads the contents of the list (eagerly loading the visible portion only) which means the list loads *much* faster than panel does in the same situation. In case a panel dev passes by then this is done via https://bvaughn.github.io/react-virtualized/#/components/InfiniteLoader as seen in https://github.com/3ll3d00d/ezmote/blob/master/src/scenes/control/jriver/Browser.js#L220 (given the way panel uses react and talks to the same mcws endpoints, my guess is you could apply the same lib in much the same way and get a big uptick in page load speed & responsiveness, about 5-6s in panel in my case vs instant using this approach)

Logged
Pages: [1]   Go Up