Enable attaching multiple media files

fixes #67
pull/113/head
Ivan Habunek 2019-08-01 12:56:21 +02:00
rodzic 42247f94ba
commit a771ca3aa7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: CDBD63C43A30BB95
3 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -7,6 +7,7 @@ Changelog
* Add `toot notifications` to show notifications (thanks @dlax)
* Add posting and replying to curses interface (thanks @Skehmatics)
* Add `--language` option to `toot post`
* Enable attaching upto 4 files via `--media` option on `toot post`
**0.21.0 (2019-02-15)**

Wyświetl plik

@ -76,15 +76,18 @@ def curses(app, user, args):
def post(app, user, args):
if args.media and len(args.media) > 4:
raise ConsoleError("Cannot attach more than 4 files.")
if args.media:
media = _do_upload(app, user, args.media)
media_ids = [media['id']]
media = [_do_upload(app, user, file) for file in args.media]
media_ids = [m["id"] for m in media]
else:
media = None
media_ids = None
if media and not args.text:
args.text = media['text_url']
args.text = "\n".join(m['text_url'] for m in media)
if not args.text:
print_out("Write or paste your toot. Press <yellow>{}</yellow> to post it.".format(EOF_KEY))

Wyświetl plik

@ -271,8 +271,10 @@ POST_COMMANDS = [
"nargs": "?",
}),
(["-m", "--media"], {
"type": FileType('rb'),
"help": "path to the media file to attach"
"action": "append",
"type": FileType("rb"),
"help": "path to the media file to attach (specify multiple "
"times to attach up to 4 files)"
}),
(["-v", "--visibility"], {
"type": visibility,