restreamer: Parse crop/location correctly and document it

pull/418/head
Mike Lang 1 month ago committed by Mike Lang
parent 2255bc7fc0
commit 8abc7c39a3

@ -489,8 +489,10 @@ def get_thumbnail_named_template(channel, quality):
template: Required. The template name to use. template: Required. The template name to use.
Must be one of the template names as returned by GET /thrimshim/templates Must be one of the template names as returned by GET /thrimshim/templates
crop: Left, upper, right, and lower pixel coordinates to crop the selected frame. crop: Left, upper, right, and lower pixel coordinates to crop the selected frame.
Should be a comma-seperated list of numbers.
Default is to use the crop in the database. Default is to use the crop in the database.
location: Left, top, right, bottom pixel coordinates to position the cropped frame. location: Left, top, right, bottom pixel coordinates to position the cropped frame.
Should be a comma-seperated list of numbers.
Default is to use the location in the databse. Default is to use the location in the databse.
""" """
crop = request.args.get('crop', None) crop = request.args.get('crop', None)
@ -514,7 +516,9 @@ def get_thumbnail_uploaded_template(channel, quality):
timestamp: Required. The frame to use as the thumbnail image. timestamp: Required. The frame to use as the thumbnail image.
Must be in ISO 8601 format (ie. yyyy-mm-ddTHH:MM:SS) and UTC. Must be in ISO 8601 format (ie. yyyy-mm-ddTHH:MM:SS) and UTC.
crop: Required. Left, upper, right, and lower pixel coordinates to crop the selected frame. crop: Required. Left, upper, right, and lower pixel coordinates to crop the selected frame.
Should be a comma-seperated list of numbers.
location: Required. Left, top, right, bottom pixel coordinates to position the cropped frame. location: Required. Left, top, right, bottom pixel coordinates to position the cropped frame.
Should be a comma-seperated list of numbers.
""" """
template = request.body template = request.body
return get_thumbnail(channel, quality, request.args['timestamp'], template, request.args['crop'], request.args['location']) return get_thumbnail(channel, quality, request.args['timestamp'], template, request.args['crop'], request.args['location'])
@ -527,6 +531,9 @@ def get_thumbnail(channel, quality, timestamp, template, crop, location):
timestamp = dateutil.parse_utc_only(timestamp) timestamp = dateutil.parse_utc_only(timestamp)
crop = [int(n) for n in crop.split(",")]
location = [int(n) for n in location.split(",")]
hours_path = os.path.join(app.static_folder, channel, quality) hours_path = os.path.join(app.static_folder, channel, quality)
if not os.path.isdir(hours_path): if not os.path.isdir(hours_path):
abort(404) abort(404)

Loading…
Cancel
Save