Skip to content

Commit 0237c70

Browse files
committed
thumbnail: Add some logging
1 parent b4ba7d3 commit 0237c70

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/classes/thumbnail.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ def run(self):
107107
self.server_address = ('127.0.0.1', self.find_free_port())
108108
self.thumbServer = httpThumbnailServer(self.server_address, httpThumbnailHandler)
109109
self.thumbServer.daemon_threads = True
110+
log.info(
111+
"Starting thumbnail server listening on port %d",
112+
self.server_address[1])
110113
self.thumbServer.serve_forever(0.5)
111114

112115
def __init__(self):
@@ -128,6 +131,8 @@ def log_error(self, msg_format, *args):
128131

129132
def do_GET(self):
130133
""" Process each GET request and return a value (image or file path)"""
134+
mask_path = os.path.join(info.IMAGES_PATH, "mask.png")
135+
131136
# Parse URL
132137
url_output = REGEX_THUMBNAIL_URL.match(self.path)
133138
if url_output and len(url_output.groups()) == 4:
@@ -147,6 +152,10 @@ def do_GET(self):
147152
only_path = url_output.group('only_path')
148153
no_cache = url_output.group('no_cache')
149154

155+
log.debug(
156+
"Processing thumbnail request for %s frame %d",
157+
file_id, file_frame)
158+
150159
try:
151160
# Look up file data
152161
file = File.get(id=file_id)
@@ -155,6 +164,7 @@ def do_GET(self):
155164
file_path = file.absolute_path()
156165
except AttributeError:
157166
# Couldn't match file ID
167+
log.debug("No ID match, returning 404")
158168
self.send_error(404)
159169
return
160170

@@ -183,7 +193,13 @@ def do_GET(self):
183193
overlay_path = os.path.join(info.IMAGES_PATH, "overlay.png")
184194

185195
# Create thumbnail image
186-
GenerateThumbnail(file_path, thumb_path, file_frame, 98, 64, os.path.join(info.IMAGES_PATH, "mask.png"), overlay_path)
196+
GenerateThumbnail(
197+
file_path,
198+
thumb_path,
199+
file_frame,
200+
98, 64,
201+
mask_path,
202+
overlay_path)
187203

188204
# Send message back to client
189205
if os.path.exists(thumb_path):

0 commit comments

Comments
 (0)