diff --git a/cutter/cutter/main.py b/cutter/cutter/main.py index 9de8067..030f589 100644 --- a/cutter/cutter/main.py +++ b/cutter/cutter/main.py @@ -458,6 +458,7 @@ class Cutter(object): image_data = frame elif job.thumbnail_mode == 'TEMPLATE': template, crop, location = get_template(self.dbmanager, job.thumbnail_template, job.thumbnail_crop, job.thumbnail_location) + self.logging.info('Generating thumbnail from the video frame at {} using {} as template'.format(job.thumbnail_time, job.thumbnail_template)) image_data = compose_thumbnail_template(template, frame, crop, location) else: # shouldn't be able to happen given database constraints @@ -771,6 +772,7 @@ class VideoUpdater(object): thumbnail_image = frame elif job.thumbnail_mode == 'TEMPLATE': template, crop, location = get_template(self.dbmanager, job.thumbnail_template, job.thumbnail_crop, job.thumbnail_location) + self.logging.info('Generating thumbnail from the video frame at {} using {} as template'.format(job.thumbnail_time, job.thumbnail_template)) thumbnail_image = compose_thumbnail_template(template, frame, crop, location) else: assert False, "Bad thumbnail mode: {}".format(job.thumbnail_mode) diff --git a/restreamer/restreamer/main.py b/restreamer/restreamer/main.py index eaa2e31..57841c8 100644 --- a/restreamer/restreamer/main.py +++ b/restreamer/restreamer/main.py @@ -501,6 +501,7 @@ def get_thumbnail_named_template(channel, quality): template, crop, location = get_template(app.db_manager, request.args['template'], crop, location) except ValueError: return 'Template {} not found'.format(request.args['template']), 404 + logging.info('Generating thumbnail from the video frame at {} using {} as template'.format(request.args['timestamp'], request.args['template'])) return get_thumbnail(channel, quality, request.args['timestamp'], template, crop, location) @@ -517,6 +518,7 @@ def get_thumbnail_uploaded_template(channel, quality): location: Required. Left, top, right, bottom pixel coordinates to position the cropped frame. """ template = request.body + logging.info('Generating thumbnail from the video frame at {} using a custom template'.format(request.args['timestamp'])) return get_thumbnail(channel, quality, request.args['timestamp'], template, request.args['crop'], request.args['location']) diff --git a/thrimshim/thrimshim/main.py b/thrimshim/thrimshim/main.py index 9a90d84..28866a0 100644 --- a/thrimshim/thrimshim/main.py +++ b/thrimshim/thrimshim/main.py @@ -606,6 +606,7 @@ def list_templates(): SELECT name, description, attribution, crop, location FROM templates ORDER BY name """ results = database.query(conn, query) + logging.info('List of thumbnail templates fetched') return json.dumps([row._asdict() for row in results.fetchall()]) @@ -623,6 +624,7 @@ def get_template(name): return 'Template {} not found'.format(name), 404 image = row[0] + logging.info('Thumbnail image of {} fetched'.format(name)) return flask.Response(image, mimetype='image/png') @@ -638,6 +640,7 @@ def get_template_metadata(name): row = results.fetchone() if row is None: return 'Template {} not found'.format(name), 404 + logging.info('Thumbnail metadata of {} fetched'.format(name)) return json.dumps(row._asdict()) def validate_template(new_template): @@ -691,6 +694,7 @@ def add_template(artist=None): ) database.query(conn, query, **new_template) + logging.info('Thumbnail template {} added'.format(new_template['name'])) return '', 201 @app.route('/thrimshim/update-template/', methods=['POST']) @@ -728,6 +732,10 @@ def update_template(name, artist=None): ) for column in columns)) database.query(conn, query, old_name=name, **new_template) + if name == new_template['name']: + logging.info('Thumbnail template {} updated'.format(name)) + else: + logging.info('Thumbnail template {} renamed to {} and updated'.format(name, new_template['name'])) return '', 200 @@ -746,6 +754,7 @@ def get_thumbnail(ident): event = row._asdict() if event['thumbnail_mode'] != 'NONE' and event['thumbnail_image']: + logging.info('Thumbnail for event {} fetched'.format(ident)) return flask.Response(event['thumbnail_image'], mimetype='image/png') else: return '', 404