Skip to content

When I use the --album parameter, the video has no thumbnail, The --catption parameter cannot be used at the same time #256

Open

Description

@nbtu

When I use the --album parameter, the video has no thumbnail
I tried specifying thumb_file using --thumbnail-file, but it seems that when --album parameter is used, --thumbnail-file and --catption cannot be used

if album:
 client.send_files_as_album(to, files, delete_on_success, print_file_id, forward)

I think it's a bug not to generate thumbnails under --album

In addition, I hope to use the --catption parameter under the --album parameter.
Because by default, each file comes with a catption, and in album mode, only the first file with a catption will be displayed. If there are multiple catptions, none will be displayed.
I want to modify the way album mode is displayed:
Let the individual files not have the catption parameter, and only use the catption parameter in send_file.

media = [
video1_file,
video2_file
]
entity = await client.get_input_entity(entity)
await client.send_file(entity, media, caption=caption, parse_mode="HTML")

Activity

  1. kitkat-98 commented on Feb 9, 2025

    @kitkat-98

    @nbtu The caption works under album mode after making below changes at telegram_upload_client.py:
    from

    return types.InputSingleMedia(
        fm,
        message=file.short_name,
        entities=None,
        # random_id is autogenerated
    )
    

    to

    return types.InputSingleMedia(
        fm,
        message=file.file_caption,
        entities=None,
        # random_id is autogenerated
    )
    
  2. NglsMa commented on Oct 9, 2026

    @NglsMa

    @nbtu The caption works under album mode after making below changes at telegram_upload_client.py:
    from

    async def _send_album_media(self, entity, media):
        entity = await self.get_input_entity(entity)
        request = functions.messages.SendMultiMediaRequest(
            entity, multi_media=media, silent=None, schedule_date=None, clear_draft=None
        )
        result = await self(request)
    
        random_ids = [m.random_id for m in media]
        return self._get_response_message(random_ids, result, entity)
    

    to

    async def _send_album_media(self, entity, media):
        entity = await self.get_input_entity(entity)
        # 相册只让第一张媒体携带 caption
        for index, item in enumerate(media):
            if index > 0:
                item.message = ""
                item.entities = None
     
        request = functions.messages.SendMultiMediaRequest(
            entity, multi_media=media, silent=None, schedule_date=None, clear_draft=None
        )
        result = await self(request)
    
        random_ids = [m.random_id for m in media]
        return self._get_response_message(random_ids, result, entity)
    

    from

    async def _send_media(self, entity, file: File, progress):
        entity = await self.get_input_entity(entity)
        supports_streaming = False  # TODO
        fh, fm, _ = await self._file_to_media(
            file, supports_streaming=file, progress_callback=progress)
        if isinstance(fm, types.InputMediaUploadedPhoto):
            r = await self(functions.messages.UploadMediaRequest(
                entity, media=fm
            ))
    
            fm = utils.get_input_media(r.photo)
        elif isinstance(fm, types.InputMediaUploadedDocument):
            r = await self(functions.messages.UploadMediaRequest(
                entity, media=fm
            ))
    
            fm = utils.get_input_media(
                r.document, supports_streaming=supports_streaming)
        return types.InputSingleMedia(
            fm,
            message=file.file_caption,
            entities=None,
            # random_id is autogenerated
        )
    

    to

    async def _send_media(self, entity, file: File, progress):
        entity = await self.get_input_entity(entity)
        supports_streaming = False  # TODO
        fh, fm, _ = await self._file_to_media(
            file, supports_streaming=file, progress_callback=progress)
        if isinstance(fm, types.InputMediaUploadedPhoto):
            r = await self(functions.messages.UploadMediaRequest(
                entity, media=fm
            ))
    
            fm = utils.get_input_media(r.photo)
        elif isinstance(fm, types.InputMediaUploadedDocument):
            r = await self(functions.messages.UploadMediaRequest(
                entity, media=fm
            ))
    
            fm = utils.get_input_media(
                r.document, supports_streaming=supports_streaming)
    
        from telethon.extensions import markdown
        caption, entities = markdown.parse(file.file_caption or "")
    
        return types.InputSingleMedia(
            fm,
            message=caption,
            entities=entities or None,
            # random_id is autogenerated
        )
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions