flexget.components.notify.notifiers.matrix module#
- exception flexget.components.notify.notifiers.matrix.PotentialCacheError(value, logger=<loguru.logger handlers=[(id=0, level=10, sink=<stderr>)]>, **kwargs)[source]#
Bases:
PluginErrorException to be thrown when the failure is suspected to result from cache inconsistency or invalidation.
- Parameters:
logger (loguru.Logger)
- class flexget.components.notify.notifiers.matrix.MatrixNotifier[source]#
Bases:
objectSend messages via Matrix.
The
matrixextra is required to be installed. Install it with:pip install flexget[matrix]Configuration:
serverone of:
tokenuser,passwordand optionaldevice_name
one of:
room_idroom_address
images(optional)
serverMatrix server hostname to integrate to, e.g.
https://matrix.org.tokenView in Element Desktop -> settings -> Help & About -> Advanced -> Access Token.
user@user_id:user_server, e.g.,@gazpachoking:matrix.org.passwordYour password.
device_nameThe session name used by FlexGet, defaults to
FlexGet Notifier.room_idView in Element Desktop -> room settings -> Advanced -> Access Token. It should start with
!.room_addressView in Element Desktop -> room settings -> General -> Internal room ID. It should start with
#. You will be joined automatically if you haven’t entered the room.imagesAn array of file paths to images. You need to install the two Python packages
pillowandpython-magic. Additionally,python-magicrequires thelibmagicC library:For Linux and macOS, see ahupp/python-magic.
On Windows, add the
file.exeprovided by nscaife/file-windows to yourPATHenvironment variable.
Example 1:
notify: entries: via: - matrix: server: https://matrix.org token: mat_K0a8IbdhQL5EsSghilk0axaTeOiUKq_dsBde4 room_id: '!yVNsbqQZjUqpxOyEgk:matrix.org'
Example 2:
notify: entries: via: - matrix: server: https://matrix.org user: '@gazpachoking:matrix.org' password: ZrJ32Der0ret device_name: FlexGet room_address: '#flexget:matrix.org'
Example 3:
notify: entries: via: - matrix: server: https://matrix.org user: '@gazpachoking:matrix.org' password: ZrJ32Der0ret room_id: '!yVNsbqQZjUqpxOyEgk:matrix.org' images: - photo.png - C:/Users/vivodi/Desktop/image.jpg
- async send_image(client, room_id, image)[source]#
Send image to room.
This is a working example for a JPG image:
"content": { "body": "someimage.jpg", "info": { "size": 5420, "mimetype": "image/jpeg", "thumbnail_info": { "w": 100, "h": 100, "mimetype": "image/jpeg", "size": 2106 }, "w": 100, "h": 100, "thumbnail_url": "mxc://example.com/SomeStrangeThumbnailUriKey" }, "msgtype": "m.image", "url": "mxc://example.com/SomeStrangeUriKey" }
- Parameters:
client (AsyncClient)
room_id (str)
image (Path)
- Return type:
None
- schema = {'additionalProperties': False, 'allOf': [{'oneOf': [{'not': {'required': ['device_name']}, 'required': ['token']}, {'required': ['user', 'password']}]}, {'oneOf': [{'required': ['room_id']}, {'required': ['room_address']}]}], 'properties': {'device_name': {'type': 'string'}, 'images': {'items': {'type': 'string'}, 'type': 'array'}, 'password': {'type': 'string'}, 'room_address': {'type': 'string'}, 'room_id': {'type': 'string'}, 'server': {'type': 'string'}, 'token': {'type': 'string'}, 'user': {'type': 'string'}}, 'required': ['server'], 'type': 'object'}#