Improve variable naming
This commit is contained in:
parent
2429d9f751
commit
84396fefc2
|
@ -24,13 +24,13 @@ from toot.utils.datetime import parse_datetime
|
||||||
multiple=True
|
multiple=True
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--description", "-d",
|
"--description", "-d", "descriptions",
|
||||||
help="""Plain-text description of the media for accessibility purposes, one
|
help="""Plain-text description of the media for accessibility purposes, one
|
||||||
per attached media""",
|
per attached media""",
|
||||||
multiple=True,
|
multiple=True,
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--thumbnail",
|
"--thumbnail", "thumbnails",
|
||||||
help="Path to an image file to serve as media thumbnail, one per attached media",
|
help="Path to an image file to serve as media thumbnail, one per attached media",
|
||||||
type=click.File(mode="rb"),
|
type=click.File(mode="rb"),
|
||||||
multiple=True
|
multiple=True
|
||||||
|
@ -111,8 +111,8 @@ def post(
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
text: Optional[str],
|
text: Optional[str],
|
||||||
media: Tuple[str],
|
media: Tuple[str],
|
||||||
description: Tuple[str],
|
descriptions: Tuple[str],
|
||||||
thumbnail: Tuple[str],
|
thumbnails: Tuple[str],
|
||||||
visibility: str,
|
visibility: str,
|
||||||
sensitive: bool,
|
sensitive: bool,
|
||||||
spoiler_text: Optional[str],
|
spoiler_text: Optional[str],
|
||||||
|
@ -135,7 +135,7 @@ def post(
|
||||||
if len(media) > 4:
|
if len(media) > 4:
|
||||||
raise click.ClickException("Cannot attach more than 4 files.")
|
raise click.ClickException("Cannot attach more than 4 files.")
|
||||||
|
|
||||||
media_ids = _upload_media(ctx.app, ctx.user, media, description, thumbnail)
|
media_ids = _upload_media(ctx.app, ctx.user, media, descriptions, thumbnails)
|
||||||
status_text = _get_status_text(text, editor, media)
|
status_text = _get_status_text(text, editor, media)
|
||||||
scheduled_at = _get_scheduled_at(scheduled_at, scheduled_in)
|
scheduled_at = _get_scheduled_at(scheduled_at, scheduled_in)
|
||||||
|
|
||||||
|
@ -201,11 +201,11 @@ def _get_scheduled_at(scheduled_at, scheduled_in):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _upload_media(app, user, media, description, thumbnail):
|
def _upload_media(app, user, media, descriptions, thumbnails):
|
||||||
# Match media to corresponding description and thumbnail
|
# Match media to corresponding descriptions and thumbnail
|
||||||
media = media or []
|
media = media or []
|
||||||
descriptions = description or []
|
descriptions = descriptions or []
|
||||||
thumbnails = thumbnail or []
|
thumbnails = thumbnails or []
|
||||||
uploaded_media = []
|
uploaded_media = []
|
||||||
|
|
||||||
for idx, file in enumerate(media):
|
for idx, file in enumerate(media):
|
||||||
|
|
Loading…
Reference in New Issue