예제 #1
0
파일: cli.py 프로젝트: JoshuaFern/ytcc
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()]
예제 #2
0
파일: cli.py 프로젝트: JoshuaFern/ytcc
    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)
            ]
예제 #3
0
파일: cli.py 프로젝트: 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 = [
예제 #4
0
파일: cli.py 프로젝트: 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