feat: handle abscence of webtorrent-cli

This commit is contained in:
Benex254
2024-09-24 15:55:24 +03:00
parent 3c9688b32c
commit 9f54fa4998
2 changed files with 16 additions and 1 deletions

View File

@@ -62,6 +62,12 @@ class YtDLPDownloader:
if url.endswith(".torrent"):
WEBTORRENT_CLI = shutil.which("webtorrent")
if not WEBTORRENT_CLI:
import time
print(
"webtorrent cli is not installed which is required for downloading and streaming from nyaa\nplease install it or use another provider"
)
time.sleep(120)
return
cmd = [
WEBTORRENT_CLI,

View File

@@ -64,7 +64,16 @@ def run_mpv(
youtube_regex = r"(https?://)?(www\.)?(youtube|youtu|youtube-nocookie)\.(com|be)/.+"
if link.endswith(".torrent"):
cmd = ["webtorrent", link, f"--{player}"]
WEBTORRENT_CLI = shutil.which("webtorrent")
if not WEBTORRENT_CLI:
import time
print(
"webtorrent cli is not installed which is required for downloading and streaming from nyaa\nplease install it or use another provider"
)
time.sleep(120)
return "0", "0"
cmd = [WEBTORRENT_CLI, link, f"--{player}"]
subprocess.run(cmd)
return "0", "0"
if player == "vlc":