Skip to content

Commit

Permalink
added feature "time" to --download-media-name
Browse files Browse the repository at this point in the history
- refactored --download-media-name
- see also Issue #138
  • Loading branch information
8go committed Oct 12, 2023
1 parent c98f240 commit 586a047
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 90 deletions.
42 changes: 27 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,8 @@ $ matrix-commander --ssl-certificate mycert.crt -m "using my own cert"
$ # download and decrypt media files like images, audio, PDF, etc.
$ # and store downloaded files in directory "mymedia"
$ matrix-commander --listen forever --listen-self --download-media mymedia
$ # download media files using event-id as file names
$ matrix-commander -l --download-media --download-media-name eventid
$ # create rooms without name and topic, just with alias, use a simple alias
$ matrix-commander --room-create roomAlias1
$ # don't use a well formed alias like '#roomAlias1:example.com' as it will
Expand Down Expand Up @@ -798,7 +800,7 @@ usage: matrix-commander [--usage] [-h] [--manual] [--readme] [-d]
[-l [NEVER|ONCE|FOREVER|TAIL|ALL]] [-t [NUMBER]] [-y]
[--print-event-id]
[--download-media [DOWNLOAD_DIRECTORY]]
[--download-media-name SOURCE|CLEAN|EVENTID]
[--download-media-name SOURCE|CLEAN|EVENTID|TIME]
[--os-notify] [--set-device-name DEVICE_NAME]
[--set-display-name DISPLAY_NAME] [--get-display-name]
[--set-presence ONLINE|OFFLINE|UNAVAILABLE]
Expand Down Expand Up @@ -1353,20 +1355,30 @@ options:
/tmp. /tmp/foo will be /tmp/foo. If media is encrypted
it will be decrypted and stored decrypted. By default
media files will not be downloaded.
--download-media-name SOURCE|CLEAN|EVENTID
--download-media-name SOURCE|CLEAN|EVENTID|TIME
Specify the method to derive the media filename.
Details:: This argument is optional. Currently three
choices are offered: 'source', 'clean' and 'eventid'.
'source' means the value specified by the source
(sender) will be used. If the sender, i.e. source,
specifies a value that is not a valid filename, then a
failure will occur and the media file will not be
saved. 'clean' means that all dangerous characters in
the name provided by the source will be replaced by an
underscore to create a valid file name. 'eventid'
means that the name provided by the source will be
ignored and the event-id will be used instead. If not
specified it defaults to 'clean'.
Details:: This argument is optional. Currently four
choices are offered: 'source', 'clean', 'eventid', and
'time'. 'source' means the value specified by the
source (sender) will be used. If the sender, i.e.
source, specifies a value that is not a valid
filename, then a failure will occur and the media file
will not be saved. 'clean' means that all unusual
characters in the name provided by the source will be
replaced by an underscore to create a valid file name.
'eventid' means that the name provided by the source
will be ignored and the event-id will be used instead.
'time' means that the name provided by the source will
be ignored and the current time at the receiver will
be used instead. As an example, if the source/sender
provided 'image(1)!.jpg' as name for a given media
file then 'source' will store the media using filename
'image(1)!.jpg', 'clean' will store it as
'image_1__.jpg', 'eventid' as something like
'$rsad57dafs57asfag45gsFjdTXW1dsfroBiO2IsidKk', and
'time' as something like '20231012_152234_266600'
(YYYYMMDD_HHMMSS_MICROSECONDS). If not specified this
value defaults to 'clean'.
--os-notify Notify me of arriving messages. Details:: If set and
listening, then program will attempt to visually
notify of arriving messages through the operating
Expand Down Expand Up @@ -1889,7 +1901,7 @@ options:
the program will continue to run. This is useful for
having version number in the log files.
You are running version 7.3.1 2023-10-10. Enjoy, star on Github and contribute
You are running version 7.4.0 2023-10-12. Enjoy, star on Github and contribute
by submitting a Pull Request. Also have a look at matrix-commander-tui.
```

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.1
7.4.0
Binary file removed dist/matrix-commander-7.3.1.tar.gz
Binary file not shown.
Binary file added dist/matrix-commander-7.4.0.tar.gz
Binary file not shown.
Binary file removed dist/matrix_commander-7.3.1-py3-none-any.whl
Binary file not shown.
Binary file added dist/matrix_commander-7.4.0-py3-none-any.whl
Binary file not shown.
4 changes: 2 additions & 2 deletions help.help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ matrix-commander supports these arguments:
Print event ids of received messages.
--download-media [DOWNLOAD_DIRECTORY]
Download media files while listening.
--download-media-name SOURCE|CLEAN|EVENTID
--download-media-name SOURCE|CLEAN|EVENTID|TIME
Specify the method to derive the media filename.
--os-notify
Notify me of arriving messages.
Expand Down Expand Up @@ -202,5 +202,5 @@ delete-content ROOM_ID EVENT_ID REASON [ROOM_ID EVENT_ID REASON ...]
-v [PRINT|CHECK], -V [PRINT|CHECK], --version [PRINT|CHECK]
Print version information or check for updates.

You are running version 7.3.1 2023-10-10. Enjoy, star on Github and contribute
You are running version 7.4.0 2023-10-12. Enjoy, star on Github and contribute
by submitting a Pull Request. Also have a look at matrix-commander-tui.
40 changes: 25 additions & 15 deletions help.manual.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ usage: matrix-commander [--usage] [-h] [--manual] [--readme] [-d]
[-l [NEVER|ONCE|FOREVER|TAIL|ALL]] [-t [NUMBER]] [-y]
[--print-event-id]
[--download-media [DOWNLOAD_DIRECTORY]]
[--download-media-name SOURCE|CLEAN|EVENTID]
[--download-media-name SOURCE|CLEAN|EVENTID|TIME]
[--os-notify] [--set-device-name DEVICE_NAME]
[--set-display-name DISPLAY_NAME] [--get-display-name]
[--set-presence ONLINE|OFFLINE|UNAVAILABLE]
Expand Down Expand Up @@ -599,20 +599,30 @@ options:
/tmp. /tmp/foo will be /tmp/foo. If media is encrypted
it will be decrypted and stored decrypted. By default
media files will not be downloaded.
--download-media-name SOURCE|CLEAN|EVENTID
--download-media-name SOURCE|CLEAN|EVENTID|TIME
Specify the method to derive the media filename.
Details:: This argument is optional. Currently three
choices are offered: 'source', 'clean' and 'eventid'.
'source' means the value specified by the source
(sender) will be used. If the sender, i.e. source,
specifies a value that is not a valid filename, then a
failure will occur and the media file will not be
saved. 'clean' means that all dangerous characters in
the name provided by the source will be replaced by an
underscore to create a valid file name. 'eventid'
means that the name provided by the source will be
ignored and the event-id will be used instead. If not
specified it defaults to 'clean'.
Details:: This argument is optional. Currently four
choices are offered: 'source', 'clean', 'eventid', and
'time'. 'source' means the value specified by the
source (sender) will be used. If the sender, i.e.
source, specifies a value that is not a valid
filename, then a failure will occur and the media file
will not be saved. 'clean' means that all unusual
characters in the name provided by the source will be
replaced by an underscore to create a valid file name.
'eventid' means that the name provided by the source
will be ignored and the event-id will be used instead.
'time' means that the name provided by the source will
be ignored and the current time at the receiver will
be used instead. As an example, if the source/sender
provided 'image(1)!.jpg' as name for a given media
file then 'source' will store the media using filename
'image(1)!.jpg', 'clean' will store it as
'image_1__.jpg', 'eventid' as something like
'$rsad57dafs57asfag45gsFjdTXW1dsfroBiO2IsidKk', and
'time' as something like '20231012_152234_266600'
(YYYYMMDD_HHMMSS_MICROSECONDS). If not specified this
value defaults to 'clean'.
--os-notify Notify me of arriving messages. Details:: If set and
listening, then program will attempt to visually
notify of arriving messages through the operating
Expand Down Expand Up @@ -1135,5 +1145,5 @@ options:
the program will continue to run. This is useful for
having version number in the log files.

You are running version 7.3.1 2023-10-10. Enjoy, star on Github and contribute
You are running version 7.4.0 2023-10-12. Enjoy, star on Github and contribute
by submitting a Pull Request. Also have a look at matrix-commander-tui.
4 changes: 2 additions & 2 deletions help.usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ usage: matrix-commander [--usage] [-h] [--manual] [--readme] [-d]
[-l [NEVER|ONCE|FOREVER|TAIL|ALL]] [-t [NUMBER]] [-y]
[--print-event-id]
[--download-media [DOWNLOAD_DIRECTORY]]
[--download-media-name SOURCE|CLEAN|EVENTID]
[--download-media-name SOURCE|CLEAN|EVENTID|TIME]
[--os-notify] [--set-device-name DEVICE_NAME]
[--set-display-name DISPLAY_NAME] [--get-display-name]
[--set-presence ONLINE|OFFLINE|UNAVAILABLE]
Expand Down Expand Up @@ -64,5 +64,5 @@ usage: matrix-commander [--usage] [-h] [--manual] [--readme] [-d]
[--room-invites [LIST|JOIN|LIST+JOIN]]
[-v [PRINT|CHECK]]

You are running version 7.3.1 2023-10-10. Enjoy, star on Github and contribute
You are running version 7.4.0 2023-10-12. Enjoy, star on Github and contribute
by submitting a Pull Request. Also have a look at matrix-commander-tui.
Loading

0 comments on commit 586a047

Please sign in to comment.