Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Parameter --download-media does not work with --listen tail or --listen all #90

Closed
produnis opened this issue Aug 6, 2022 · 4 comments
Labels
invalid This doesn't seem right

Comments

@produnis
Copy link

produnis commented Aug 6, 2022

Hi there, while --download-media works fine with --listen forever, it won't work with --listen all or --listen tail and a given room.

In these cases, all messages of the given room are printed to sdout, but no files are saved to the folder.

@produnis produnis changed the title --download-media does not work with --listen tail or --listen all Parameter --download-media does not work with --listen tail or --listen all Aug 6, 2022
@produnis produnis changed the title Parameter --download-media does not work with --listen tail or --listen all Parameter --download-media does not work with --listen tail or --listen all Aug 6, 2022
@produnis
Copy link
Author

produnis commented Aug 9, 2022

Here is some output,

if I run --listen forever, stdout shows something like this:

Message received for room FooBar [!foobar:matrix.org] | sender Alice [@alice:nerdsin.space] | 2022-08-09 10:20:02 | Received image: 85473 - pk9ypp.jpg [https://myserver.org/_matrix/media/r0/download/nerdsin.space/434a507a8b5d3106f334548ca87096ee4a984a9c] [Downloaded media file to /my-matrix-commander/forever/85473 - pk9ypp.jpg]
and the file ist downloaded....

If I run --listen all, stdout shows something like this:

Message received for room FooBar [!foobar:matrix.org] | sender Bob [@bob:nerdsin.space] | 2022-08-08 17:25:33 | Received unknown event: MegolmEvent(source={'content': {'algorithm': 'm.megolm.v1.aes-sha2', 'ciphertext': 'a-real-long-cypher', 'device_id': 'FOOBAR', 'sender_key': 'super-secret-foobar', 'session_id': 'sessionfoobar'}, 'origin_server_ts': 1659972333591, 'room_id': '!foobar:matrix.org', 'sender': '@bob:nerdsin.space', 'type': 'm.room.encrypted', 'unsigned': {'m.relations': {'m.annotation': {'chunk': [{'type': 'm.reaction', 'key': '😍', 'count': 2}, {'type': 'm.reaction', 'key': '😋', 'count': 1}]}}}, 'event_id': 'foobar232342423423', 'user_id': '@bob:nerdsin.space'}, event_id='$234235345foobar', sender='@bob:nerdsin.space', server_timestamp=1659972333591, decrypted=False, verified=False, sender_key='3245ljkh2345kjh234', session_id='blafaseldsfsdfsadf', transaction_id=None, device_id='FOOBAR', ciphertext='AwgDEtA-longcyphertext', algorithm='m.megolm.v1.aes-sha2', room_id='!foobar:matrix.org')

@8go 8go added the bug Something isn't working label Oct 2, 2022
@8go
Copy link
Owner

8go commented Oct 2, 2022

OK, thanks @produnis for reporting this. I will have a look into this during the next days.

@8go
Copy link
Owner

8go commented Oct 3, 2022

I looked into this today and I could not find a bug.

Your above example response given with --listen all is an emojii so there would be no download of media. Emojiis are not media.

I tested: matrix-commander -d -y --tail 1 --download-media media and it worked.

The output was:

$ matrix-commander  -d -y --tail 1 --download-media media
...
Message received for room rrr [!xxx:xxx.xxx.xxx] | sender sss [@sss:xxx.xxx.xxx] | 2022-10-03 xx:xx:xx | Received encrypted image: test.s.svg [https://xxx.xxx.xxx/_matrix/media/r0/download/xxx.xxx.xxx/xxx] [Downloaded and decrypted media file to media/test.s.svg]
2022-10-03 xxx:    DEBUG: matrix-commander: The program matrix-commander.py left the event loop.
2022-10-03 xxx:    DEBUG: matrix-commander: Cleanup: cleaning up.
$ ls -l media/
.rw-rw-r-- 1,602 user  3 Oct xx:xx test.s.svg

Then I tested this command: matrix-commander -y -d --listen all --download-media media --room "\!rrr:xxx.xxx.xxx". The command took a long long time because it pulled 1000+ messages from server. But it also worked.

$ matrix-commander -y  --listen all --download-media media --room "\!rrr:xxx.xxx.xxx"
...
Message received for room rrr [!rrr:xxx.xxx.xxx] | sender uuu [@uuu:xxx.xxx.xxx] | 2022-10-03 xx:xx:xx | Received encrypted image: test.s.svg [https://xxx.xxx.xxx/_matrix/media/r0/download/xxx.xxx.xxx/xxx] [Downloaded and decrypted media file to media/test.s_0.svg]
...
$ ll media/
.rw-rw-r--     919 user  3 Oct xx:xx test.s.png
.rw-rw-r--   1,602 user  3 Oct xx:xx test.s.svg
.rw-rw-r--     919 user  3 Oct xx:xx test.s_0.png
.rw-rw-r--   1,602 user  3 Oct xx:xx test.s_0.svg
...

I found some other bug and I changed a parameter trying to avoid timeouts.
I will make a new release today or tomorrow.
Try it again. But as I said, it works for me.

@8go 8go added invalid This doesn't seem right and removed bug Something isn't working labels Oct 5, 2022
@8go
Copy link
Owner

8go commented Oct 5, 2022

I did more testing today. It all works.

Maybe the files are written to s a sub-folder (depends on your config) like ./media?

Send yourself an image. Run in debug mode and see what it does and where it saves the image to and what the file name is.

Closing issue because I cannot reproduce it.

Please comment and re-open issue if you have a detailed logfile showing a problem.

@8go 8go closed this as completed Oct 5, 2022
@8go 8go changed the title Parameter --download-media does not work with --listen tail or --listen all Bug: Parameter --download-media does not work with --listen tail or --listen all Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants