mirror of
https://git.freetards.xyz/array.in.a.matrix/TexLiLy.git
synced 2025-04-02 13:21:42 -04:00
[ADD] Add autojoin, and raise PNG DPI.
This commit is contained in:
parent
60278db59e
commit
010bd2634b
3 changed files with 6 additions and 1 deletions
|
@ -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)
|
||||||
|
|
|
@ -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")
|
||||||
|
|
1
main.py
1
main.py
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue