2024-11-07 11:22:11 +01:00

48 lines
1.1 KiB
Python

# 21.05.24
# Internal utilities
from Src.Util.console import console, msg
# Logic class
from .site import title_search, run_get_select_title, media_search_manager
from .anime import download_film, download_series
# Variable
indice = 1
_useFor = "anime"
_deprecate = False
_priority = 2
_engineDownload = "mp4"
def search(string_to_search: str = None, get_onylDatabase:bool = False):
if string_to_search is None:
string_to_search = msg.ask("\n[purple]Insert word to search in all site").strip()
# Search on database
len_database = title_search(string_to_search)
# Return list of elements
if get_onylDatabase:
return media_search_manager
if len_database > 0:
# Select title from list
select_title = run_get_select_title()
if select_title.type == 'Movie':
download_film(select_title)
else:
download_series(select_title)
else:
console.print(f"\n[red]Nothing matching was found for[white]: [purple]{string_to_search}")
# Retry
search()