From 981494cfa73ba3fafead788f5a81ab4ea711dae0 Mon Sep 17 00:00:00 2001 From: Ghost <62809003+Ghost6446@users.noreply.github.com> Date: Mon, 29 Jan 2024 16:43:52 +0100 Subject: [PATCH] fix no title --- Src/Api/page.py | 3 ++- Src/Upload/update.py | 1 + Src/Util/FFmpeg/installer.py | 2 ++ run.py | 23 +++++++++++++---------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Src/Api/page.py b/Src/Api/page.py index 02b0701..aa93a89 100644 --- a/Src/Api/page.py +++ b/Src/Api/page.py @@ -10,6 +10,7 @@ from bs4 import BeautifulSoup def domain_version(): + console.print("[green]Get rules ...") req_repo = requests.get("https://raw.githubusercontent.com/Ghost6446/Streaming_comunity_data/main/data.json", headers={'user-agent': get_headers()}) if req_repo.ok: @@ -17,7 +18,7 @@ def domain_version(): soup = BeautifulSoup(site_req, "lxml") version = json.loads(soup.find("div", {"id": "app"}).get("data-page"))['version'] - return version, req_repo.json()['version'] + return req_repo.json()['domain'], version else: console.log(f"[red]Error: {req_repo.status_code}") diff --git a/Src/Upload/update.py b/Src/Upload/update.py index eba191e..5e7afbb 100644 --- a/Src/Upload/update.py +++ b/Src/Upload/update.py @@ -19,6 +19,7 @@ def get_install_version(): return about['__version__'] def main_update(): + console.print("[green]Checking github version ...") json = requests.get(f"https://api.github.com/repos/{repo_user}/{repo_name}/releases").json()[0] stargazers_count = requests.get(f"https://api.github.com/repos/{repo_user}/{repo_name}").json()['stargazers_count'] diff --git a/Src/Util/FFmpeg/installer.py b/Src/Util/FFmpeg/installer.py index 3f95030..108ecdc 100644 --- a/Src/Util/FFmpeg/installer.py +++ b/Src/Util/FFmpeg/installer.py @@ -35,6 +35,8 @@ def download_ffmpeg(): def check_ffmpeg(): + console.print("[green]Checking ffmpeg ...") + try: subprocess.run(["ffmpeg", "-version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True) console.print("[blue]FFmpeg [white]=> [red]Add to system path") diff --git a/run.py b/run.py index ef38716..580f7ee 100644 --- a/run.py +++ b/run.py @@ -41,20 +41,23 @@ def main(): db_title = Page.search(film_search, domain) display_search_results(db_title) - index_select = int(msg.ask("\n[blue]Index to download: ")) + if len(db_title) != 0: + index_select = int(msg.ask("\n[blue]Index to download: ")) - if 0 <= index_select <= len(db_title) - 1: - selected_title = db_title[index_select] + if 0 <= index_select <= len(db_title) - 1: + selected_title = db_title[index_select] + + if selected_title['type'] == "movie": + console.print(f"[green]\nMovie select: {selected_title['name']}") + download_film(selected_title['id'], selected_title['slug'], domain) + else: + console.print(f"[green]\nTv select: {selected_title['name']}") + download_tv(selected_title['id'], selected_title['slug'], site_version, domain) - if selected_title['type'] == "movie": - console.print(f"[green]\nMovie select: {selected_title['name']}") - download_film(selected_title['id'], selected_title['slug'], domain) else: - console.print(f"[green]\nTv select: {selected_title['name']}") - download_tv(selected_title['id'], selected_title['slug'], site_version, domain) - + console.print("[red]Wrong index for selection") else: - console.print("[red]Wrong index for selection") + console.print("[red]Cant find a single element") console.print("\n[red]Done")