mirror of
https://github.com/karl0ss/GoGoDownloader.git
synced 2025-04-26 11:39:22 +01:00
Update backend.py
Added print locks so threads aren't printing over each other
This commit is contained in:
parent
c24be4c4e9
commit
196c192479
@ -9,11 +9,14 @@ from colorama import Fore
|
|||||||
from random import choice
|
from random import choice
|
||||||
from requests.exceptions import Timeout
|
from requests.exceptions import Timeout
|
||||||
import time
|
import time
|
||||||
|
from threading import Semaphore
|
||||||
|
|
||||||
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}] "
|
||||||
|
|
||||||
|
screenlock = Semaphore(value=1)
|
||||||
|
|
||||||
|
|
||||||
def random_headers():
|
def random_headers():
|
||||||
desktop_agents = [
|
desktop_agents = [
|
||||||
@ -178,12 +181,18 @@ class CustomMessage(Exception):
|
|||||||
workingepisode: str = None
|
workingepisode: str = None
|
||||||
|
|
||||||
def print_error(self):
|
def print_error(self):
|
||||||
|
screenlock.acquire()
|
||||||
print(ERR, self.message, end=' ')
|
print(ERR, self.message, end=' ')
|
||||||
|
screenlock.release()
|
||||||
|
|
||||||
def qual_not_found(self):
|
def qual_not_found(self):
|
||||||
|
screenlock.acquire()
|
||||||
print(
|
print(
|
||||||
f"{ERR}Episode {self.workingepisode} {Fore.LIGHTCYAN_EX}{self.episode_quality}{Fore.RESET} quality not found.")
|
f"{ERR}Episode {self.workingepisode} {Fore.LIGHTCYAN_EX}{self.episode_quality}{Fore.RESET} quality not found.")
|
||||||
|
screenlock.release()
|
||||||
|
|
||||||
def use_default_qual(self):
|
def use_default_qual(self):
|
||||||
|
screenlock.acquire()
|
||||||
print(
|
print(
|
||||||
f"{OK}Trying {Fore.LIGHTCYAN_EX}{self.episode_quality}{Fore.RESET} quality for Episode {self.workingepisode}.")
|
f"{OK}Trying {Fore.LIGHTCYAN_EX}{self.episode_quality}{Fore.RESET} quality for Episode {self.workingepisode}.")
|
||||||
|
screenlock.release()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user