@@ -107,6 +107,9 @@ def run(self):
107
107
self .server_address = ('127.0.0.1' , self .find_free_port ())
108
108
self .thumbServer = httpThumbnailServer (self .server_address , httpThumbnailHandler )
109
109
self .thumbServer .daemon_threads = True
110
+ log .info (
111
+ "Starting thumbnail server listening on port %d" ,
112
+ self .server_address [1 ])
110
113
self .thumbServer .serve_forever (0.5 )
111
114
112
115
def __init__ (self ):
@@ -128,6 +131,8 @@ def log_error(self, msg_format, *args):
128
131
129
132
def do_GET (self ):
130
133
""" Process each GET request and return a value (image or file path)"""
134
+ mask_path = os .path .join (info .IMAGES_PATH , "mask.png" )
135
+
131
136
# Parse URL
132
137
url_output = REGEX_THUMBNAIL_URL .match (self .path )
133
138
if url_output and len (url_output .groups ()) == 4 :
@@ -147,6 +152,10 @@ def do_GET(self):
147
152
only_path = url_output .group ('only_path' )
148
153
no_cache = url_output .group ('no_cache' )
149
154
155
+ log .debug (
156
+ "Processing thumbnail request for %s frame %d" ,
157
+ file_id , file_frame )
158
+
150
159
try :
151
160
# Look up file data
152
161
file = File .get (id = file_id )
@@ -155,6 +164,7 @@ def do_GET(self):
155
164
file_path = file .absolute_path ()
156
165
except AttributeError :
157
166
# Couldn't match file ID
167
+ log .debug ("No ID match, returning 404" )
158
168
self .send_error (404 )
159
169
return
160
170
@@ -183,7 +193,13 @@ def do_GET(self):
183
193
overlay_path = os .path .join (info .IMAGES_PATH , "overlay.png" )
184
194
185
195
# 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 )
187
203
188
204
# Send message back to client
189
205
if os .path .exists (thumb_path ):
0 commit comments