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: PluginError

Exception 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: object

Send messages via Matrix.

The matrix extra is required to be installed. Install it with: pip install flexget[matrix]

Configuration:

  • server

  • one of:

    • token

    • user, password and optional device_name

  • one of:

    • room_id

    • room_address

  • images (optional)

server

Matrix server hostname to integrate to, e.g. https://matrix.org.

token

View in Element Desktop -> settings -> Help & About -> Advanced -> Access Token.

user

@user_id:user_server, e.g., @gazpachoking:matrix.org.

password

Your password.

device_name

The session name used by FlexGet, defaults to FlexGet Notifier.

room_id

View in Element Desktop -> room settings -> Advanced -> Access Token. It should start with !.

room_address

View 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.

images

An array of file paths to images. You need to install the two Python packages pillow and python-magic. Additionally, python-magic requires the libmagic C library:

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 get_room_id(config, client)[source]#
Return type:

str

async login(config, client)[source]#
Return type:

None

async main(message, config)[source]#
notify(title, message, config)[source]#

Send notification to Matrix room.

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

async send_message(message, client, room_id)[source]#
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'}#
flexget.components.notify.notifiers.matrix.register_plugin()[source]#