How to use the ytcc.terminal.printtln function in ytcc

To help you get started, we’ve selected a few ytcc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github woefe / ytcc / ytcc / cli.py View on Github external
columns = shutil.get_terminal_size().columns
        sep = "━" if fat else "─"
        if not text:
            print(sep * columns)
        else:
            sep_len = (columns - len(text) - 2)
            padding = sep_len // 2
            printt(sep * padding)
            printt(" ", text, " ", bold=fat)
            printtln(sep * (padding + (sep_len % 2)))

    print_separator("Playing now", fat=True)
    printt(_("Title:   "))
    printtln(video.title, bold=True)
    printt(_("Channel: "))
    printtln(video.channel.displayname, bold=True)

    description = video.description
    if DESCRIPTION_ENABLED and description is not None:
        columns = shutil.get_terminal_size().columns
        lines = description.splitlines()
        print_separator(_("Video description"))

        for line in lines:
            print(wrap.fill(line, width=columns))

    print_separator(fat=True)
    print()
github woefe / ytcc / ytcc / cli.py View on Github external
def print_meta(video: Video) -> None:
    def print_separator(text: Optional[str] = None, fat: bool = False) -> None:
        columns = shutil.get_terminal_size().columns
        sep = "━" if fat else "─"
        if not text:
            print(sep * columns)
        else:
            sep_len = (columns - len(text) - 2)
            padding = sep_len // 2
            printt(sep * padding)
            printt(" ", text, " ", bold=fat)
            printtln(sep * (padding + (sep_len % 2)))

    print_separator("Playing now", fat=True)
    printt(_("Title:   "))
    printtln(video.title, bold=True)
    printt(_("Channel: "))
    printtln(video.channel.displayname, bold=True)

    description = video.description
    if DESCRIPTION_ENABLED and description is not None:
        columns = shutil.get_terminal_size().columns
        lines = description.splitlines()
        print_separator(_("Video description"))

        for line in lines:
            print(wrap.fill(line, width=columns))

    print_separator(fat=True)
    print()
github woefe / ytcc / ytcc / cli.py View on Github external
def print_separator(text: Optional[str] = None, fat: bool = False) -> None:
        columns = shutil.get_terminal_size().columns
        sep = "━" if fat else "─"
        if not text:
            print(sep * columns)
        else:
            sep_len = (columns - len(text) - 2)
            padding = sep_len // 2
            printt(sep * padding)
            printt(" ", text, " ", bold=fat)
            printtln(sep * (padding + (sep_len % 2)))
github woefe / ytcc / ytcc / cli.py View on Github external
def table_print(header: List[str], table: List[List[str]]) -> None:
    transposed = zip(header, *table)
    col_widths = [max(map(len, column)) for column in transposed]
    table_format = "│".join(itertools.repeat(" {{:<{}}} ", len(header))).format(*col_widths)

    if HEADER_ENABLED:
        header_line = "┼".join("─" * (width + 2) for width in col_widths)
        printtln(table_format.format(*header), bold=True)
        print(header_line)

    for i, row in enumerate(table):
        background = None if i % 2 == 0 else COLORS.table_alternate_background
        printtln(table_format.format(*row), background=background)
github woefe / ytcc / ytcc / cli.py View on Github external
def table_print(header: List[str], table: List[List[str]]) -> None:
    transposed = zip(header, *table)
    col_widths = [max(map(len, column)) for column in transposed]
    table_format = "│".join(itertools.repeat(" {{:<{}}} ", len(header))).format(*col_widths)

    if HEADER_ENABLED:
        header_line = "┼".join("─" * (width + 2) for width in col_widths)
        printtln(table_format.format(*header), bold=True)
        print(header_line)

    for i, row in enumerate(table):
        background = None if i % 2 == 0 else COLORS.table_alternate_background
        printtln(table_format.format(*row), background=background)