mirror of
https://github.com/karl0ss/GoGoDownloader.git
synced 2025-04-26 19:49:23 +01:00
Update bitanime.py
Cleaned up code, removed varibles in conflict with system variables
This commit is contained in:
parent
01562f595b
commit
f81a3699a3
@ -1,19 +1,20 @@
|
|||||||
import requests as req
|
import requests as req
|
||||||
import ctypes
|
import ctypes
|
||||||
import os
|
import os
|
||||||
import colorama
|
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
from backend import Download, CustomMessage
|
from backend import Download, CustomMessage
|
||||||
from tqdm.contrib.concurrent import thread_map
|
from tqdm.contrib.concurrent import thread_map
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from colorama import Fore
|
from colorama import Fore
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
OK = f"{Fore.RESET}[{Fore.GREEN}+{Fore.RESET}] "
|
OK = f"{Fore.RESET}[{Fore.GREEN}+{Fore.RESET}] "
|
||||||
ERR = f"{Fore.RESET}[{Fore.RED}-{Fore.RESET}] "
|
ERR = f"{Fore.RESET}[{Fore.RED}-{Fore.RESET}] "
|
||||||
IN = f"{Fore.RESET}[{Fore.LIGHTBLUE_EX}>{Fore.RESET}] "
|
IN = f"{Fore.RESET}[{Fore.LIGHTBLUE_EX}>{Fore.RESET}] "
|
||||||
try:
|
try:
|
||||||
ctypes.windll.kernel32.SetConsoleTitleW("BitAnime")
|
ctypes.windll.kernel32.SetConsoleTitleW("BitAnime")
|
||||||
except (AttributeError):
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -124,23 +125,16 @@ def bitanime():
|
|||||||
source = None
|
source = None
|
||||||
|
|
||||||
episode_links = download.get_links(source)
|
episode_links = download.get_links(source)
|
||||||
with concurrent.futures.ThreadPoolExecutor() as exec:
|
with concurrent.futures.ThreadPoolExecutor() as executing:
|
||||||
download_links = list(exec.map(download.get_download_links, episode_links))
|
download_links = list(executing.map(download.get_download_links, episode_links))
|
||||||
download_urls = list(exec.map(download.get_download_urls, download_links))
|
download_urls = list(executing.map(download.get_download_urls, download_links))
|
||||||
print(
|
|
||||||
f"{OK}Downloading {Fore.LIGHTCYAN_EX}{len(download_urls)}{Fore.RESET} episode/s"
|
print(f"{OK}Downloading {Fore.LIGHTCYAN_EX}{len(download_urls)}{Fore.RESET} episode/s")
|
||||||
)
|
|
||||||
thread_map(
|
thread_map(download.download_episodes, download_urls, ncols=75, total=len(download_urls))
|
||||||
download.download_episodes,
|
|
||||||
download_urls,
|
|
||||||
ncols=75,
|
|
||||||
total=len(download_urls),
|
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
os.startfile(folder)
|
os.startfile(folder)
|
||||||
except (AttributeError):
|
except AttributeError:
|
||||||
import sys, subprocess
|
|
||||||
|
|
||||||
opener = "open" if sys.platform == "darwin" else "xdg-open"
|
opener = "open" if sys.platform == "darwin" else "xdg-open"
|
||||||
subprocess.call([opener, folder])
|
subprocess.call([opener, folder])
|
||||||
use_again = input(f"{IN}Do you want to use the app again? (y|n) > ").lower()
|
use_again = input(f"{IN}Do you want to use the app again? (y|n) > ").lower()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user