Skip to content

Instantly share code, notes, and snippets.

@bazwilliams
Last active January 10, 2018 19:05
Show Gist options
  • Save bazwilliams/ec10fea509b3182420237244ff0ea52a to your computer and use it in GitHub Desktop.
Save bazwilliams/ec10fea509b3182420237244ff0ea52a to your computer and use it in GitHub Desktop.
Pass This Parcel in a Docker! This plays music on a Linn device for a random period of time between 8 and 18 seconds. When running the Docker, set the environment variable `DEVICE_URI` to the URL of the device description of the player you want to control, e.g. http://192.168.1.122:55178/4c494e4e-0026-0f21-fd5a-01387403013f/Upnp/device.xml
FROM python:3
RUN pip3 install openhomedevice
COPY main.py /app/
ENTRYPOINT python3 /app/main.py
from openhomedevice.Device import Device
from random import randint
import time
import os
device = Device(os.environ['DEVICE_URI'])
device.Play()
time.sleep(randint(8,18))
device.Pause()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment