mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 14:24:58 -04:00
Store URL cache preview downloads seperately
This makes it easier to clear old media out at a later date
This commit is contained in:
parent
e204062310
commit
7fe8ed1787
7 changed files with 94 additions and 20 deletions
|
@ -71,3 +71,21 @@ class MediaFilePaths(object):
|
|||
self.base_path, "remote_thumbnail", server_name,
|
||||
file_id[0:2], file_id[2:4], file_id[4:],
|
||||
)
|
||||
|
||||
def url_cache_filepath(self, media_id):
|
||||
return os.path.join(
|
||||
self.base_path, "url_cache",
|
||||
media_id[0:2], media_id[2:4], media_id[4:]
|
||||
)
|
||||
|
||||
def url_cache_thumbnail(self, media_id, width, height, content_type,
|
||||
method):
|
||||
top_level_type, sub_type = content_type.split("/")
|
||||
file_name = "%i-%i-%s-%s-%s" % (
|
||||
width, height, top_level_type, sub_type, method
|
||||
)
|
||||
return os.path.join(
|
||||
self.base_path, "url_cache_thumbnails",
|
||||
media_id[0:2], media_id[2:4], media_id[4:],
|
||||
file_name
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue