[ADD] Add autojoin, and raise PNG DPI.

This commit is contained in:
LoaD Accumulator 2023-06-14 18:24:47 +02:00
parent 60278db59e
commit 010bd2634b
No known key found for this signature in database
GPG key ID: 6898757653ABE3E6
3 changed files with 6 additions and 1 deletions

View file

@ -76,3 +76,7 @@ async def file_cb(room: MatrixRoom, event: RoomMessageFile) -> None:
with open(os.path.join(directory, filename), 'wb') as f: with open(os.path.join(directory, filename), 'wb') as f:
f.write(response.body) f.write(response.body)
async def invite_cb(room: MatrixRoom, event: InviteEvent) -> None:
import utils
await utils.get_client().join(room_id=room.room_id)

View file

@ -17,7 +17,7 @@ def render(user: str, source: str, png: bool = True) -> str:
tmp.write(bytes(fmt, encoding="utf8")) tmp.write(bytes(fmt, encoding="utf8"))
tmp.close() tmp.close()
if png: if png:
subprocess.run(["lilypond", "-d", "preview", "--png", tmp.name], cwd="/tmp") subprocess.run(["lilypond", "-d", "preview", "--png", "-dresolution=500", tmp.name], cwd="/tmp")
return tmp.name + ".preview.png" return tmp.name + ".preview.png"
subprocess.run(["lilypond", "-d", "preview", "--svg", tmp.name], cwd="/tmp") subprocess.run(["lilypond", "-d", "preview", "--svg", tmp.name], cwd="/tmp")

View file

@ -43,6 +43,7 @@ async def main() -> None:
utils.set_client(client) utils.set_client(client)
client.add_event_callback(callbacks.msg_cb, RoomMessageText) client.add_event_callback(callbacks.msg_cb, RoomMessageText)
client.add_event_callback(callbacks.file_cb, RoomMessageFile) client.add_event_callback(callbacks.file_cb, RoomMessageFile)
client.add_event_callback(callbacks.invite_cb, InviteEvent)
await client.sync_forever(timeout=10000, full_state=True) await client.sync_forever(timeout=10000, full_state=True)