Esempio n. 1
0
def tag_completion(ctx: Any, args: List[str],  # pylint: disable=unused-argument
                   incomplete: str) -> List[Union[str, Tuple[str, str]]]:
    try:
        _load_completion_conf(args)
    except BadConfigException:
        return []

    with core.Ytcc() as ytcc:
        return [tag for tag in ytcc.list_tags() if incomplete.lower() in tag.lower()]
Esempio n. 2
0
    def complete(ctx: Any, args: List[str],  # pylint: disable=unused-argument
                 incomplete: str) -> List[Union[str, Tuple[str, str]]]:
        try:
            _load_completion_conf(args)
        except BadConfigException:
            return []

        with core.Ytcc() as ytcc:
            ytcc.set_watched_filter(watched)
            return [
                (v_id, title)
                for v_id, title in map(lambda v: (str(v.id), v.title), ytcc.list_videos())
                if v_id.startswith(incomplete)
            ]
Esempio n. 3
0
File: cli.py Progetto: plct/ytcc
import itertools
import readline
import sys
from collections import OrderedDict

import shutil
import signal
import textwrap as wrap
from datetime import datetime
from gettext import gettext as _
from typing import List, Iterable, Optional, TextIO, NamedTuple, Callable, Any, Set

from ytcc import core, arguments
from ytcc.video import Video

ytcc_core = core.Ytcc()
interactive_enabled = True
description_enabled = True
no_video = False
download_path = ""

header_enabled = True
table_header = [
    _("ID"),
    _("Date"),
    _("Channel"),
    _("Title"),
    _("URL"),
    _("Watched")
]
column_filter = [
Esempio n. 4
0
File: cli.py Progetto: gruberma/ytcc
import inspect
import shutil
import signal
import textwrap as wrap
from datetime import datetime
from enum import Enum
from typing import List, Iterable, Optional, TextIO, Any, Set, Tuple, Callable, NamedTuple, Dict

from ytcc import core, arguments, getkey, _
from ytcc.database import Video
from ytcc.exceptions import BadConfigException, ChannelDoesNotExistException, \
    DuplicateChannelException, BadURLException
from ytcc.utils import unpack_optional

try:
    ytcc_core = core.Ytcc()  # pylint: disable=C0103
    COLUMN_FILTER = [ytcc_core.config.table_format.getboolean("ID"),
                     ytcc_core.config.table_format.getboolean("Date"),
                     ytcc_core.config.table_format.getboolean("Channel"),
                     ytcc_core.config.table_format.getboolean("Title"),
                     ytcc_core.config.table_format.getboolean("URL"),
                     ytcc_core.config.table_format.getboolean("Watched")]
except BadConfigException:
    print(_("The configuration file has errors!"))
    exit(1)

INTERACTIVE_ENABLED = True
DESCRIPTION_ENABLED = True
NO_VIDEO = False
DOWNLOAD_PATH = ""
HEADER_ENABLED = True