Ejemplo n.º 1
0
def prompt(matches: List[Metadata]) -> Optional[Metadata]:  # pragma: no cover
    """Prompts user to choose a match from a list of matches."""
    selector = SelectOne(matches + _abort_helpers(), **_chars())
    choice = selector.prompt()
    if choice in (MnamerAbortException, MnamerSkipException):
        raise choice
    else:
        return choice
Ejemplo n.º 2
0
Archivo: tty.py Proyecto: queeup/mnamer
def subtitle_prompt() -> Metadata:
    msg("select language")
    choices = [ChoiceHelper(language, language.name) for language in Language.all()]
    selector = SelectOne(choices + _abort_helpers(), **_chars())
    choice = selector.prompt()
    if choice in (MnamerAbortException, MnamerSkipException):
        raise choice
    else:
        return choice
Ejemplo n.º 3
0
def metadata_prompt(
        matches: List[Metadata]) -> Optional[Metadata]:  # pragma: no cover
    """Prompts user to choose a match from a list of matches."""
    msg("select match")
    options = matches + _abort_helpers()  # type: ignore
    selector = SelectOne(options, **_chars())
    choice = selector.prompt()
    if isinstance(choice, (MnamerAbortException, MnamerSkipException)):
        raise choice
    return choice
Ejemplo n.º 4
0
def metadata_guess(
    metadata: Metadata, ) -> Optional[Metadata]:  # pragma: no cover
    """Prompts user to confirm a single match."""
    label = str(metadata)
    if no_style:
        label += " (best guess)"
    else:
        label += style_format(" (best guess)", "blue")
    option = ChoiceHelper(metadata, label)
    selector = SelectOne([option] + _abort_helpers(), **_chars())
    choice = selector.prompt()
    if choice in (MnamerAbortException, MnamerSkipException):
        raise choice
    else:
        return choice
Ejemplo n.º 5
0
def search():
    ia = imdb.IMDb()
    ret = []
    i = 0

    keyword = input('Search for media: ')
    for m in ia.search_movie(keyword):
        i = i + 1
        id = m.getID()
        ret.insert(i, m['title'])
    text.print_good('Results Found (with duplicates): {}'.format(i))

    picker = SelectOne(choices=ret)
    choice = picker.prompt()
    id = get_movie_id(choice)
    print("")
    print_general_info(id)