Skip to main content

Python module, server and utility to control greenscreen.

Project description

A simple module, command line utility and tcp server to headlessly control a GreenScreen installation and a set of Chromecasts. Controls the assignment of GreenScreen channels to Chromecasts using the GreenScreen API, and then can start/stop casting to a particular Chromecast.

Requires a working GreenScreen installation.

AppID

In these instructions, $APPID is the value of your “Application ID” from the Google Cast Developer Console. This will have been setup as part of the GreenScreen installation.

Using the command line utility

Set the CCTV channel on the Kitchen Chromecast:

$ greenscreen_control -c CCTV set-channel Kitchen

Start casting a given AppID on a Chromecast:

$ greenscreen_control -a $APPID cast Kitchen

Stop casting on the Kitchen Chromecast:

$ greenscreen_control stop-cast Kitchen

Available arguments:

usage: greenscreen_control_cli.py [-h] [-g GREENSCREEN_SERVER] [-a APPID]
                                  [-c CHANNEL] [-l {ERROR,WARNING,INFO,DEBUG}]
                                  [-r TRIES] [-t TIMEOUT] [-w RETRY_WAIT]
                                  {set-channel,cast,stop-cast} chromecast

positional arguments:
  {set-channel,cast,stop-cast}
                        Command
  chromecast            Chromecast name

optional arguments:
  -h, --help            show this help message and exit
  -g GREENSCREEN_SERVER, --greenscreen_server GREENSCREEN_SERVER
                        GreenScreen server:port
  -a APPID, --appid APPID
                        Chromecast Greenscreen App ID
  -c CHANNEL, --channel CHANNEL
                        GreenScreen channel to set
  -l {ERROR,WARNING,INFO,DEBUG}, --loglevel {ERROR,WARNING,INFO,DEBUG}
                        Logging level
  -r TRIES, --tries TRIES
                        Chromecast connection tries. Default is infinite.
  -t TIMEOUT, --timeout TIMEOUT
                        Chromecast socket timeout seconds. Default is 30.
  -w RETRY_WAIT, --retry_wait RETRY_WAIT
                        Seconds to wait between Chromecast retries. Default is
                        5.

Starting the server

Start a simple TCP server (default port 4995) to control greenscreen and Chromecast casting.

$ greenscreen_control_server -l INFO -a $APPID

Available arguments:

usage: greenscreen_control_server.py [-h] [-g GREENSCREEN_SERVER] [-a APPID]
                                     [-c CHANNEL]
                                     [-l {ERROR,WARNING,INFO,DEBUG}]
                                     [-r TRIES] [-t TIMEOUT] [-w RETRY_WAIT]
                                     [-p PORT]

optional arguments:
  -h, --help            show this help message and exit
  -g GREENSCREEN_SERVER, --greenscreen_server GREENSCREEN_SERVER
                        GreenScreen server:port
  -a APPID, --appid APPID
                        Chromecast Greenscreen App ID
  -c CHANNEL, --channel CHANNEL
                        GreenScreen channel to set
  -l {ERROR,WARNING,INFO,DEBUG}, --loglevel {ERROR,WARNING,INFO,DEBUG}
                        Logging level
  -r TRIES, --tries TRIES
                        Chromecast connection tries. Default is infinite.
  -t TIMEOUT, --timeout TIMEOUT
                        Chromecast socket timeout seconds. Default is 30.
  -w RETRY_WAIT, --retry_wait RETRY_WAIT
                        Seconds to wait between Chromecast retries. Default is
                        5.
  -p PORT, --port PORT  TCP server port number

Server Protocol

The TCP server uses a simple line-based protocol, easily controlled from scripts, cron or home automation.

Assign the “CCTV” channel to the “Kitchen” chromecast, and start casting it:

chromecast=Kitchen,channel=CCTV,cast=1

Assign the “CCTV” channel to the “Kitchen” chromecast, don’t cast it (either prepares for future casting, or assumes already casted):

chromecast=Kitchen,channel=CCTV

Cast the currently assigned channel (whatever that is):

chromecast=Kitchen,cast=1

Stop casting:

chromecast=Kitchen,cast=0

Starting the server by default

Use the included greenscreen_control.service to start the server as a systemd unit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

greenscreen_control-0.0.2.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

greenscreen_control-0.0.2-py2.py3-none-any.whl (10.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file greenscreen_control-0.0.2.tar.gz.

File metadata

File hashes

Hashes for greenscreen_control-0.0.2.tar.gz
Algorithm Hash digest
SHA256 342e0e6cd76ceaa149d7599653591fd4d95c9efeef78cda92f801ee1a0c6e897
MD5 dc7b8191f55521c7fd5b8488015993b7
BLAKE2b-256 aec14dba71537b8f4c08229ccb535f139646c341f9f06624e3bee85bfcf3f30c

See more details on using hashes here.

File details

Details for the file greenscreen_control-0.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for greenscreen_control-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7b3ab016975ffd7f0b6abf40b38df9beaac230fcf6f1ad7ec04512e7ccfb097f
MD5 b7d16f7744aad1f96ba209c5ed225c27
BLAKE2b-256 4ce728902d71994c0927f79d1fc10f1507dc13e464337a77e75a1ebe4797905f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page