Fix cached thumbnails extensions
This commit is contained in:
parent
7ee83c5fe4
commit
46f3f15694
4
TODO.md
4
TODO.md
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Before release
|
## Before release
|
||||||
|
|
||||||
- Downloaded media filenames
|
- Fix highlighted account/room in MainPane
|
||||||
- "exception during sync" aren't caught
|
- "exception during sync" aren't caught
|
||||||
- nio ClientTimeout
|
- nio ClientTimeout
|
||||||
- Name
|
- Name
|
||||||
|
@ -153,6 +153,8 @@
|
||||||
|
|
||||||
## Backend
|
## Backend
|
||||||
|
|
||||||
|
- Have a `Thubmnail.from_existing_file()` to be called after generating and
|
||||||
|
and uploading a thumbnail, like the equivalent `Media.from_existing_file()`
|
||||||
- Saving the room settings
|
- Saving the room settings
|
||||||
- Refetch profile after manual profile change, don't wait for a room event
|
- Refetch profile after manual profile change, don't wait for a room event
|
||||||
|
|
||||||
|
|
|
@ -553,6 +553,8 @@ class MatrixClient(nio.AsyncClient):
|
||||||
content["info"].get("thumbnail_info", {}).get("w", 0),
|
content["info"].get("thumbnail_info", {}).get("w", 0),
|
||||||
thumbnail_height =
|
thumbnail_height =
|
||||||
content["info"].get("thumbnail_info", {}).get("h", 0),
|
content["info"].get("thumbnail_info", {}).get("h", 0),
|
||||||
|
thumbnail_mime =
|
||||||
|
content["info"].get("thumbnail_info", {}).get("mimetype", ""),
|
||||||
)
|
)
|
||||||
|
|
||||||
await self._send_message(room_id, content)
|
await self._send_message(room_id, content)
|
||||||
|
|
|
@ -197,6 +197,7 @@ class Event(ModelItem):
|
||||||
media_crypt_dict: Dict[str, Any] = field(default_factory=dict)
|
media_crypt_dict: Dict[str, Any] = field(default_factory=dict)
|
||||||
|
|
||||||
thumbnail_url: str = ""
|
thumbnail_url: str = ""
|
||||||
|
thumbnail_mime: str = ""
|
||||||
thumbnail_width: int = 0
|
thumbnail_width: int = 0
|
||||||
thumbnail_height: int = 0
|
thumbnail_height: int = 0
|
||||||
thumbnail_crypt_dict: Dict[str, Any] = field(default_factory=dict)
|
thumbnail_crypt_dict: Dict[str, Any] = field(default_factory=dict)
|
||||||
|
|
|
@ -140,6 +140,7 @@ class NioCallbacks:
|
||||||
|
|
||||||
thumbnail_width = thumb_info.get("w") or 0,
|
thumbnail_width = thumb_info.get("w") or 0,
|
||||||
thumbnail_height = thumb_info.get("h") or 0,
|
thumbnail_height = thumb_info.get("h") or 0,
|
||||||
|
thumbnail_mime = thumb_info.get("mimetype") or "",
|
||||||
thumbnail_crypt_dict = thumb_crypt_dict,
|
thumbnail_crypt_dict = thumb_crypt_dict,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ HMxcImage {
|
||||||
height: fitSize.height
|
height: fitSize.height
|
||||||
horizontalAlignment: Image.AlignLeft
|
horizontalAlignment: Image.AlignLeft
|
||||||
|
|
||||||
title: loader.title
|
title: thumbnail ? loader.thumbnailTitle : loader.title
|
||||||
animated: loader.singleMediaInfo.media_mime === "image/gif" ||
|
animated: loader.singleMediaInfo.media_mime === "image/gif" ||
|
||||||
utils.urlExtension(loader.mediaUrl).toLowerCase() === "gif"
|
utils.urlExtension(loader.mediaUrl).toLowerCase() === "gif"
|
||||||
thumbnail: ! animated && loader.thumbnailMxc
|
thumbnail: ! animated && loader.thumbnailMxc
|
||||||
|
|
|
@ -31,6 +31,19 @@ HLoader {
|
||||||
readonly property string title:
|
readonly property string title:
|
||||||
singleMediaInfo.media_title || utils.urlFileName(mediaUrl)
|
singleMediaInfo.media_title || utils.urlFileName(mediaUrl)
|
||||||
|
|
||||||
|
readonly property string thumbnailTitle:
|
||||||
|
singleMediaInfo.media_title.replace(
|
||||||
|
/\.[^\.]+$/,
|
||||||
|
singleMediaInfo.thumbnail_mime === "image/jpeg" ? ".jpg" :
|
||||||
|
singleMediaInfo.thumbnail_mime === "image/png" ? ".png" :
|
||||||
|
singleMediaInfo.thumbnail_mime === "image/gif" ? ".gif" :
|
||||||
|
singleMediaInfo.thumbnail_mime === "image/tiff" ? ".tiff" :
|
||||||
|
singleMediaInfo.thumbnail_mime === "image/svg+xml" ? ".svg" :
|
||||||
|
singleMediaInfo.thumbnail_mime === "image/webp" ? ".webp" :
|
||||||
|
singleMediaInfo.thumbnail_mime === "image/bmp" ? ".bmp" :
|
||||||
|
".thumbnail"
|
||||||
|
) || utils.urlFileName(mediaUrl)
|
||||||
|
|
||||||
readonly property var imageExtensions: [
|
readonly property var imageExtensions: [
|
||||||
"bmp", "gif", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "xbm", "xpm",
|
"bmp", "gif", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "xbm", "xpm",
|
||||||
"tiff", "webp", "svg",
|
"tiff", "webp", "svg",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user