Fix remote thumbnailing
parent
ff7c2e41de
commit
33d83f3615
|
@ -284,7 +284,7 @@ class BaseMediaResource(Resource):
|
||||||
return
|
return
|
||||||
|
|
||||||
t_path = self.filepaths.remote_media_thumbnail(
|
t_path = self.filepaths.remote_media_thumbnail(
|
||||||
media_id, t_width, t_height, t_type, t_method
|
server_name, file_id, t_width, t_height, t_type, t_method
|
||||||
)
|
)
|
||||||
self._makedirs(t_path)
|
self._makedirs(t_path)
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,8 @@ class ThumbnailResource(BaseMediaResource):
|
||||||
server_name, media_id,
|
server_name, media_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
file_id = media_info["filesystem_id"]
|
||||||
|
|
||||||
for info in thumbnail_infos:
|
for info in thumbnail_infos:
|
||||||
t_w = info["thumbnail_width"] == desired_width
|
t_w = info["thumbnail_width"] == desired_width
|
||||||
t_h = info["thumbnail_height"] == desired_height
|
t_h = info["thumbnail_height"] == desired_height
|
||||||
|
@ -139,20 +141,22 @@ class ThumbnailResource(BaseMediaResource):
|
||||||
|
|
||||||
if t_w and t_h and t_method and t_type:
|
if t_w and t_h and t_method and t_type:
|
||||||
file_path = self.filepaths.remote_media_thumbnail(
|
file_path = self.filepaths.remote_media_thumbnail(
|
||||||
media_id, desired_width, desired_height, desired_type, desired_method,
|
server_name, file_id, desired_width, desired_height,
|
||||||
|
desired_type, desired_method,
|
||||||
)
|
)
|
||||||
yield self._respond_with_file(request, desired_type, file_path)
|
yield self._respond_with_file(request, desired_type, file_path)
|
||||||
|
return
|
||||||
|
|
||||||
logger.debug("We don't have a local thumbnail of that size. Generating")
|
logger.debug("We don't have a local thumbnail of that size. Generating")
|
||||||
|
|
||||||
# Okay, so we generate one.
|
# Okay, so we generate one.
|
||||||
path = yield self._generate_remote_exact_thumbnail(
|
file_path = yield self._generate_remote_exact_thumbnail(
|
||||||
server_name, media_id, desired_width, desired_height,
|
server_name, file_id, media_id, desired_width,
|
||||||
desired_method, desired_type
|
desired_height, desired_method, desired_type
|
||||||
)
|
)
|
||||||
|
|
||||||
if path:
|
if file_path:
|
||||||
yield self._respond_with_file(request, t_type, file_path)
|
yield self._respond_with_file(request, desired_type, file_path)
|
||||||
else:
|
else:
|
||||||
yield self._respond_default_thumbnail(
|
yield self._respond_default_thumbnail(
|
||||||
request, media_info, desired_width, desired_height,
|
request, media_info, desired_width, desired_height,
|
||||||
|
|
Loading…
Reference in New Issue