2019-06-05 18:19:08 +02:00
|
|
|
import hyperion, time
|
2017-10-12 12:00:32 +02:00
|
|
|
|
|
|
|
# Get the parameters
|
2021-10-02 18:02:52 +02:00
|
|
|
imageData = hyperion.args.get('url') if hyperion.args.get('imageSource', "") == "url" else hyperion.args.get('file')
|
2017-10-12 12:00:32 +02:00
|
|
|
framesPerSecond = float(hyperion.args.get('fps', 25))
|
2021-10-02 18:02:52 +02:00
|
|
|
reverse = bool(hyperion.args.get('reverse', False))
|
|
|
|
cropLeft = int(hyperion.args.get('cropLeft', 0))
|
|
|
|
cropTop = int(hyperion.args.get('cropTop', 0))
|
|
|
|
cropRight = int(hyperion.args.get('cropRight', 0))
|
|
|
|
cropBottom = int(hyperion.args.get('cropBottom', 0))
|
|
|
|
grayscale = bool(hyperion.args.get('grayscale', False))
|
2017-10-12 12:00:32 +02:00
|
|
|
|
|
|
|
sleepTime = 1./framesPerSecond
|
2021-10-02 18:02:52 +02:00
|
|
|
imageFrameList = []
|
2018-12-20 14:41:21 +01:00
|
|
|
|
2021-10-02 18:02:52 +02:00
|
|
|
if imageData:
|
|
|
|
if reverse:
|
|
|
|
imageFrameList = reversed(hyperion.getImage(imageData, cropLeft, cropTop, cropRight, cropBottom, grayscale))
|
|
|
|
else:
|
|
|
|
imageFrameList = hyperion.getImage(imageData, cropLeft, cropTop, cropRight, cropBottom, grayscale)
|
2017-10-12 12:00:32 +02:00
|
|
|
|
|
|
|
# Start the write data loop
|
2021-10-02 18:02:52 +02:00
|
|
|
while not hyperion.abort() and imageFrameList:
|
|
|
|
for image in imageFrameList:
|
|
|
|
if not hyperion.abort():
|
|
|
|
hyperion.setImage(image["imageWidth"], image["imageHeight"], image["imageData"])
|
|
|
|
time.sleep(sleepTime)
|