1
0
Fork 0
Commit Graph

11 Commits

Author SHA1 Message Date
nicoco 8cdf2b9d7b dev: set --dev-mode for dev container
and show thread name in log records
2024-04-29 20:14:13 +02:00
nicoco af1149313b chore: update go dependencies 2024-02-17 09:30:56 +01:00
Alex Palaistras 7eedd28d28 Update to latest GoPy version, fix issues
This fixes issues related to breaking changes in latest versions of
GoPy, which will now return concrete instances of corresponding classes
in iterators; previously, only a "pointer" would be returned, which
would've then needed to be set as the handle for a newly created
instance of a relevant class.

Closes: #17
2023-12-14 18:57:27 +00:00
Alex Palaistras ce1526bc6d Pin installed GoPy versions to 0.4.7
GoPy 0.4.8 and beyond introduce breaking changes related types returned
in function calls (e.g. slice element types). Previously, these would be
a pointer handle which would then need to be set into a concrete
instance of the type required by callers; GoPy will now return concrete
instances itself.

Moving to the new semantics requires changes to code, and additional
testing; pinning the version helps us migrate on our own timeline.
2023-12-14 13:49:39 +00:00
nicoco ba6d81a0ec ci: fix poetry install for arm64 containers 2023-09-11 20:32:15 +02:00
nicoco 906c3f7ec9 ci: build wheels for python 3.10+3.11 and amd64+arm64 2023-08-25 07:42:48 +02:00
Alex Palaistras 5473f25a24 Implement on-the-fly outgoing media conversion
WhatsApp clients are set to accept only a specific set of media files as
image, audio, or video messages, specifically:

  - Images must be in JPEG (non-progressive) format.
  - Audio messages must be in Opus-encoded Ogg if sent as voice messages,
    otherwise may be in MP3 or AAC format if not (though client support
    may vary).
  - Video messages must be in h264-encoded MP4, with some additional
    constraints on color format and profile used.

Several edge-cases exist, e.g. with GIF files needing to be re-encoded
as MP4 in order to be animated (and requiring extra metadata in messages
to be called out as such).

This commit implements a somewhat comprehensive media conversion scheme,
built upon FFmpeg for audio and video, and native Go facilities for
images, based on the source format. Specifically:

  - Audio files in `audio/mp4` or `audio/aac` format (corresponding to
    formats commonly used in Android and iOS XMPP clients, respectively)
    are automatically re-encoded as Opus-encoded voice messages.

  - Audio files in `audio/mpeg` (i.e. MP3 files) or `audio/ogg` format
    are sent as plain audio files in their own format, with varying client
    support assumed.

  - Images in `image/png` or `image/webp` format are automatically
    re-encoded as JPEG image messages. Conversely, images in `image/gif`
    format are re-encoded as MP4 video messages with auto-play enabled.

  - Videos in `video/webm` or `video/mp4` format are automatically
    re-encoded as MP4 video messages (the latter is re-encoded to ensure
    option compatibility).

As stated above, all audio and video conversions require FFmpeg and
FFprobe to be installed, and, if missing, will leave attachments
unchanged (which may result these being sent as binary files). Image
conversions do not rely on any external functionality, however.

Current limits are: 10MiB for images and 20MiB for audio and video
files; above these conversions will fail and original files will be sent
instead.

Future commits may see compatibility improved, or semantics corrected
where these do not match expectations on the WhatsApp side.
2023-07-22 09:58:22 +01:00
Alex Palaistras 868dd3f6ae Use local Slidge Core mount for development
Core changes are reflected in our development containers via a
locally-cloned `slidge` repository, adjacent to this repository.
2023-06-18 21:43:35 +01:00
Alex Palaistras ab6192436c Clean up Dockerfile for local development
Local development was subtly broken with our recent split, and this
commit fixes this.
2023-06-16 20:04:23 +01:00
nicoco 5d5d1d39fb fix dev container 2023-05-13 17:09:53 +02:00
nicoco f0ffdaa0be Initial commit (split from slidge core) 2023-05-02 16:35:30 +02:00