From 2d7d65441497e9e33d4b7b8bb348e6b4c7c2abe7 Mon Sep 17 00:00:00 2001 From: Lovi <62809003+Lovi-0@users.noreply.github.com> Date: Tue, 25 Feb 2025 18:49:45 +0100 Subject: [PATCH] [CORE] Remove all cp1252 characters --- StreamingCommunity/Api/Site/1337xx/site.py | 2 +- .../Api/Site/animeunity/__init__.py | 2 +- .../Api/Site/animeunity/site.py | 2 +- StreamingCommunity/Api/Site/cb01new/site.py | 2 +- .../Api/Site/ddlstreamitaly/site.py | 2 +- .../Api/Site/guardaserie/site.py | 2 +- .../Api/Site/streamingcommunity/__init__.py | 2 +- .../Api/Site/streamingcommunity/site.py | 2 +- .../Lib/Downloader/TOR/downloader.py | 4 +- .../TelegramHelp/telegram_bot.py | 100 +++++++++--------- StreamingCommunity/Util/_jsonConfig.py | 52 ++++----- StreamingCommunity/Util/table.py | 4 +- StreamingCommunity/run.py | 40 +++---- 13 files changed, 104 insertions(+), 112 deletions(-) diff --git a/StreamingCommunity/Api/Site/1337xx/site.py b/StreamingCommunity/Api/Site/1337xx/site.py index b230488..49c7fe5 100644 --- a/StreamingCommunity/Api/Site/1337xx/site.py +++ b/StreamingCommunity/Api/Site/1337xx/site.py @@ -47,7 +47,7 @@ def title_search(word_to_search: str) -> int: domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) if domain_to_use is None or base_url is None: - console.print("[bold red]❌ Error: Unable to determine valid domain or base URL.[/bold red]") + console.log("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") console.print("[yellow]The service might be temporarily unavailable or the domain may have changed.[/yellow]") sys.exit(1) diff --git a/StreamingCommunity/Api/Site/animeunity/__init__.py b/StreamingCommunity/Api/Site/animeunity/__init__.py index a2f0b2e..bc2113b 100644 --- a/StreamingCommunity/Api/Site/animeunity/__init__.py +++ b/StreamingCommunity/Api/Site/animeunity/__init__.py @@ -34,7 +34,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False): # Chiedi la scelta all'utente con il bot Telegram string_to_search = bot.ask( "key_search", - f"Inserisci la parola da cercare\noppure πŸ”™ back per tornare alla scelta: ", + f"Inserisci la parola da cercare\noppure back per tornare alla scelta: ", None ) diff --git a/StreamingCommunity/Api/Site/animeunity/site.py b/StreamingCommunity/Api/Site/animeunity/site.py index b6d45b3..c4c1b2b 100644 --- a/StreamingCommunity/Api/Site/animeunity/site.py +++ b/StreamingCommunity/Api/Site/animeunity/site.py @@ -117,7 +117,7 @@ def title_search(title: str) -> int: domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) if domain_to_use is None or base_url is None: - console.print("[bold red]❌ Error: Unable to determine valid domain or base URL.[/bold red]") + console.print("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") console.print("[yellow]The service might be temporarily unavailable or the domain may have changed.[/yellow]") sys.exit(1) diff --git a/StreamingCommunity/Api/Site/cb01new/site.py b/StreamingCommunity/Api/Site/cb01new/site.py index 66202b9..d11e61b 100644 --- a/StreamingCommunity/Api/Site/cb01new/site.py +++ b/StreamingCommunity/Api/Site/cb01new/site.py @@ -47,7 +47,7 @@ def title_search(word_to_search: str) -> int: domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) if domain_to_use is None or base_url is None: - console.print("[bold red]❌ Error: Unable to determine valid domain or base URL.[/bold red]") + console.print("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") console.print("[yellow]The service might be temporarily unavailable or the domain may have changed.[/yellow]") sys.exit(1) diff --git a/StreamingCommunity/Api/Site/ddlstreamitaly/site.py b/StreamingCommunity/Api/Site/ddlstreamitaly/site.py index 3288861..7bbdbeb 100644 --- a/StreamingCommunity/Api/Site/ddlstreamitaly/site.py +++ b/StreamingCommunity/Api/Site/ddlstreamitaly/site.py @@ -49,7 +49,7 @@ def title_search(word_to_search: str) -> int: domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) if domain_to_use is None or base_url is None: - console.print("[bold red]❌ Error: Unable to determine valid domain or base URL.[/bold red]") + console.print("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") console.print("[yellow]The service might be temporarily unavailable or the domain may have changed.[/yellow]") sys.exit(1) diff --git a/StreamingCommunity/Api/Site/guardaserie/site.py b/StreamingCommunity/Api/Site/guardaserie/site.py index 80fcd35..238edf7 100644 --- a/StreamingCommunity/Api/Site/guardaserie/site.py +++ b/StreamingCommunity/Api/Site/guardaserie/site.py @@ -47,7 +47,7 @@ def title_search(word_to_search: str) -> int: domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) if domain_to_use is None or base_url is None: - console.print("[bold red]❌ Error: Unable to determine valid domain or base URL.[/bold red]") + console.print("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") console.print("[yellow]The service might be temporarily unavailable or the domain may have changed.[/yellow]") sys.exit(1) diff --git a/StreamingCommunity/Api/Site/streamingcommunity/__init__.py b/StreamingCommunity/Api/Site/streamingcommunity/__init__.py index c6e59b9..4492c2f 100644 --- a/StreamingCommunity/Api/Site/streamingcommunity/__init__.py +++ b/StreamingCommunity/Api/Site/streamingcommunity/__init__.py @@ -38,7 +38,7 @@ def search(string_to_search: str = None, get_onylDatabase: bool = False): # Chiedi la scelta all'utente con il bot Telegram string_to_search = bot.ask( "key_search", - f"Inserisci la parola da cercare\noppure πŸ”™ back per tornare alla scelta: ", + f"Inserisci la parola da cercare\noppure back per tornare alla scelta: ", None ) diff --git a/StreamingCommunity/Api/Site/streamingcommunity/site.py b/StreamingCommunity/Api/Site/streamingcommunity/site.py index a97a741..96ffb2c 100644 --- a/StreamingCommunity/Api/Site/streamingcommunity/site.py +++ b/StreamingCommunity/Api/Site/streamingcommunity/site.py @@ -45,7 +45,7 @@ def title_search(title_search: str) -> int: domain_to_use, base_url = search_domain(site_constant.SITE_NAME, site_constant.FULL_URL) if domain_to_use is None or base_url is None: - console.print("[bold red]❌ Error: Unable to determine valid domain or base URL.[/bold red]") + console.print("[bold red]Error: Unable to determine valid domain or base URL.[/bold red]") console.print("[yellow]The service might be temporarily unavailable or the domain may have changed.[/yellow]") sys.exit(1) diff --git a/StreamingCommunity/Lib/Downloader/TOR/downloader.py b/StreamingCommunity/Lib/Downloader/TOR/downloader.py index fea8280..1d7e290 100644 --- a/StreamingCommunity/Lib/Downloader/TOR/downloader.py +++ b/StreamingCommunity/Lib/Downloader/TOR/downloader.py @@ -90,7 +90,7 @@ class TOR_downloader: int(torrent_info.num_leechs) == 0 and int(torrent_info.num_seeds) == 0): - console.print(f"[bold red]⚠️ Torrent not downloadable. Removing...[/bold red]") + console.print(f"[bold red]Torrent not downloadable. Removing...[/bold red]") try: self.qb.torrents_delete(delete_files=True, torrent_hashes=torrent_info.hash) except Exception as delete_error: @@ -137,7 +137,7 @@ class TOR_downloader: torrent_info = matching_torrents[0] - console.print("\n[bold green]πŸ”— Added Torrent Details:[/bold green]") + console.print("\n[bold green]Added Torrent Details:[/bold green]") console.print(f"[yellow]Name:[/yellow] {torrent_info.name or torrent_name}") console.print(f"[yellow]Hash:[/yellow] {torrent_info.hash}") print() diff --git a/StreamingCommunity/TelegramHelp/telegram_bot.py b/StreamingCommunity/TelegramHelp/telegram_bot.py index c3b89ee..d24b68d 100644 --- a/StreamingCommunity/TelegramHelp/telegram_bot.py +++ b/StreamingCommunity/TelegramHelp/telegram_bot.py @@ -113,7 +113,7 @@ class TelegramRequestManager: return False except (FileNotFoundError, json.JSONDecodeError) as e: - print(f"⚠️ save_response - errore: {e}") + print(f" save_response - errore: {e}") return False def get_response(self) -> Optional[str]: @@ -142,7 +142,7 @@ class TelegramRequestManager: return True except Exception as e: - print(f"⚠️ clear_file - errore: {e}") + print(f" clear_file - errore: {e}") return False # Funzione per caricare variabili da un file .env @@ -230,20 +230,20 @@ class TelegramBot: ["screen", "-S", script["screen_id"], "-X", "quit"] ) print( - f"βœ… La sessione screen con ID {script['screen_id']} Γ¨ stata fermata automaticamente." + f" La sessione screen con ID {script['screen_id']} Γ¨ stata fermata automaticamente." ) except subprocess.CalledProcessError: print( - f"⚠️ Impossibile fermare la sessione screen con ID {script['screen_id']}." + f" Impossibile fermare la sessione screen con ID {script['screen_id']}." ) print( - f"⚠️ Lo script con ID {script['screen_id']} ha superato i 10 minuti e verrΓ  rimosso." + f" Lo script con ID {script['screen_id']} ha superato i 10 minuti e verrΓ  rimosso." ) else: scripts_data_to_save.append(script) else: print( - f"⚠️ La sessione screen con ID {script['screen_id']} non esiste piΓΉ e verrΓ  rimossa." + f" La sessione screen con ID {script['screen_id']} non esiste piΓΉ e verrΓ  rimossa." ) # Salva la lista aggiornata, senza gli script scaduti o le screen non esistenti @@ -305,8 +305,8 @@ class TelegramBot: def handle_get_id(self, message): if not self.is_authorized(message.from_user.id): - print(f"❌ Non sei autorizzato.") - self.bot.send_message(message.chat.id, "❌ Non sei autorizzato.") + print(f" Non sei autorizzato.") + self.bot.send_message(message.chat.id, " Non sei autorizzato.") return print(f"Il tuo ID utente Γ¨: `{message.from_user.id}`") @@ -318,8 +318,8 @@ class TelegramBot: def handle_start_script(self, message): if not self.is_authorized(message.from_user.id): - print(f"❌ Non sei autorizzato. {message.from_user.id}") - self.bot.send_message(message.chat.id, "❌ Non sei autorizzato.") + print(f" Non sei autorizzato. {message.from_user.id}") + self.bot.send_message(message.chat.id, " Non sei autorizzato.") return screen_id = str(uuid.uuid4())[:8] @@ -335,10 +335,10 @@ class TelegramBot: "utf-8" ) if screen_id in existing_screens: - print(f"⚠️ Lo script con ID {screen_id} Γ¨ giΓ  in esecuzione.") + print(f" Lo script con ID {screen_id} Γ¨ giΓ  in esecuzione.") self.bot.send_message( message.chat.id, - f"⚠️ Lo script con ID {screen_id} Γ¨ giΓ  in esecuzione.", + f" Lo script con ID {screen_id} Γ¨ giΓ  in esecuzione.", ) return except subprocess.CalledProcessError: @@ -384,8 +384,8 @@ class TelegramBot: def handle_list_scripts(self, message): if not self.is_authorized(message.from_user.id): - print(f"❌ Non sei autorizzato.") - self.bot.send_message(message.chat.id, "❌ Non sei autorizzato.") + print(f" Non sei autorizzato.") + self.bot.send_message(message.chat.id, " Non sei autorizzato.") return try: @@ -395,12 +395,12 @@ class TelegramBot: scripts_data = [] if not scripts_data: - print(f"⚠️ Nessuno script registrato.") - self.bot.send_message(message.chat.id, "⚠️ Nessuno script registrato.") + print(f" Nessuno script registrato.") + self.bot.send_message(message.chat.id, " Nessuno script registrato.") return current_time = time.time() - msg = ["πŸ–₯️ **Script Registrati:**\n"] + msg = [" **Script Registrati:**\n"] for script in scripts_data: # Calcola la durata @@ -414,12 +414,12 @@ class TelegramBot: duration_str = f"{int(hours)}h {int(minutes)}m {int(seconds)}s" # Icona stato - status_icons = {"running": "🟒", "stopped": "πŸ”΄", "completed": "βšͺ"} + status_icons = {"running": "", "stopped": "", "completed": ""} # Costruisci riga line = ( f"β€’ ID: `{script['screen_id']}`\n" - f"β€’ Stato: {status_icons.get(script['status'], '⚫')}\n" + f"β€’ Stato: {status_icons.get(script['status'], '')}\n" f"β€’ Stop: `/stop {script['screen_id']}`\n" f"β€’ Screen: `/screen {script['screen_id']}`\n" f"β€’ Durata: {duration_str}\n" @@ -437,8 +437,8 @@ class TelegramBot: def handle_stop_script(self, message): if not self.is_authorized(message.from_user.id): - print(f"❌ Non sei autorizzato.") - self.bot.send_message(message.chat.id, "❌ Non sei autorizzato.") + print(f" Non sei autorizzato.") + self.bot.send_message(message.chat.id, " Non sei autorizzato.") return parts = message.text.split() @@ -452,15 +452,15 @@ class TelegramBot: running_scripts = [s for s in scripts_data if s["status"] == "running"] if not running_scripts: - print(f"⚠️ Nessuno script attivo da fermare.") + print(f" Nessuno script attivo da fermare.") self.bot.send_message( - message.chat.id, "⚠️ Nessuno script attivo da fermare." + message.chat.id, " Nessuno script attivo da fermare." ) return - msg = "πŸ–₯️ **Script Attivi:**\n" + msg = " **Script Attivi:**\n" for script in running_scripts: - msg += f"πŸ”Ή `/stop {script['screen_id']}` per fermarlo\n" + msg += f" `/stop {script['screen_id']}` per fermarlo\n" print(f"{msg}") self.bot.send_message(message.chat.id, msg, parse_mode="Markdown") @@ -481,10 +481,10 @@ class TelegramBot: if len(new_scripts_data) == len(scripts_data): # Nessun elemento rimosso, quindi ID non trovato - print(f"⚠️ Nessuno script attivo con ID `{screen_id}`.") + print(f" Nessuno script attivo con ID `{screen_id}`.") self.bot.send_message( message.chat.id, - f"⚠️ Nessuno script attivo con ID `{screen_id}`.", + f" Nessuno script attivo con ID `{screen_id}`.", parse_mode="Markdown", ) return @@ -492,14 +492,14 @@ class TelegramBot: # Terminare la sessione screen try: subprocess.check_output(["screen", "-S", screen_id, "-X", "quit"]) - print(f"βœ… La sessione screen con ID {screen_id} Γ¨ stata fermata.") + print(f" La sessione screen con ID {screen_id} Γ¨ stata fermata.") except subprocess.CalledProcessError: print( - f"⚠️ Impossibile fermare la sessione screen con ID `{screen_id}`." + f" Impossibile fermare la sessione screen con ID `{screen_id}`." ) self.bot.send_message( message.chat.id, - f"⚠️ Impossibile fermare la sessione screen con ID `{screen_id}`.", + f" Impossibile fermare la sessione screen con ID `{screen_id}`.", parse_mode="Markdown", ) return @@ -508,27 +508,27 @@ class TelegramBot: with open("../../scripts.json", "w") as f: json.dump(new_scripts_data, f, indent=4) - print(f"βœ… Script `{screen_id}` terminato con successo!") + print(f" Script `{screen_id}` terminato con successo!") self.bot.send_message( message.chat.id, - f"βœ… Script `{screen_id}` terminato con successo!", + f" Script `{screen_id}` terminato con successo!", parse_mode="Markdown", ) def handle_response(self, message): text = message.text if self.request_manager.save_response(text): - print(f"πŸ“₯ Risposta salvata correttamente per il tipo {text}") + print(f" Risposta salvata correttamente per il tipo {text}") else: - print("⚠️ Nessuna richiesta attiva.") - self.bot.reply_to(message, "❌ Nessuna richiesta attiva.") + print(" Nessuna richiesta attiva.") + self.bot.reply_to(message, " Nessuna richiesta attiva.") def handle_screen_status(self, message): command_parts = message.text.split() if len(command_parts) < 2: - print(f"⚠️ ID mancante nel comando. Usa: /screen ") + print(f" ID mancante nel comando. Usa: /screen ") self.bot.send_message( - message.chat.id, "⚠️ ID mancante nel comando. Usa: /screen " + message.chat.id, " ID mancante nel comando. Usa: /screen " ) return @@ -539,8 +539,8 @@ class TelegramBot: # Verifica se lo screen con l'ID specificato esiste existing_screens = subprocess.check_output(["screen", "-list"]).decode('utf-8') if screen_id not in existing_screens: - print(f"⚠️ La sessione screen con ID {screen_id} non esiste.") - self.bot.send_message(message.chat.id, f"⚠️ La sessione screen con ID {screen_id} non esiste.") + print(f" La sessione screen con ID {screen_id} non esiste.") + self.bot.send_message(message.chat.id, f" La sessione screen con ID {screen_id} non esiste.") return # Cattura l'output della screen @@ -549,17 +549,17 @@ class TelegramBot: check=True, ) except subprocess.CalledProcessError as e: - print(f"❌ Errore durante la cattura dell'output della screen: {e}") + print(f" Errore durante la cattura dell'output della screen: {e}") self.bot.send_message( message.chat.id, - f"❌ Errore durante la cattura dell'output della screen: {e}", + f" Errore durante la cattura dell'output della screen: {e}", ) return if not os.path.exists(temp_file): - print(f"❌ Impossibile catturare l'output della screen.") + print(f" Impossibile catturare l'output della screen.") self.bot.send_message( - message.chat.id, f"❌ Impossibile catturare l'output della screen." + message.chat.id, f" Impossibile catturare l'output della screen." ) return @@ -594,18 +594,18 @@ class TelegramBot: cleaned_output = re.sub(r'segments\.py:\d+', '', cleaned_output) # Invia l'output pulito - print(f"πŸ“„ Output della screen {screen_id}:\n{cleaned_output}") + print(f" Output della screen {screen_id}:\n{cleaned_output}") self._send_long_message( - message.chat.id, f"πŸ“„ Output della screen {screen_id}:\n{cleaned_output}" + message.chat.id, f" Output della screen {screen_id}:\n{cleaned_output}" ) except Exception as e: print( - f"❌ Errore durante la lettura o l'invio dell'output della screen: {e}" + f" Errore durante la lettura o l'invio dell'output della screen: {e}" ) self.bot.send_message( message.chat.id, - f"❌ Errore durante la lettura o l'invio dell'output della screen: {e}", + f" Errore durante la lettura o l'invio dell'output della screen: {e}", ) # Cancella il file temporaneo @@ -665,14 +665,14 @@ class TelegramBot: return response time.sleep(1) - print(f"⚠️ Timeout: nessuna risposta ricevuta.") + print(f" Timeout: nessuna risposta ricevuta.") for chat_id in self.authorized_users: # Manda a tutti gli ID autorizzati - self.bot.send_message(chat_id, "⚠️ Timeout: nessuna risposta ricevuta.") + self.bot.send_message(chat_id, " Timeout: nessuna risposta ricevuta.") self.request_manager.clear_file() return None def run(self): - print("πŸš€ Avvio del bot...") + print(" Avvio del bot...") with open("../../scripts.json", "w") as f: json.dump([], f) self.bot.infinity_polling() diff --git a/StreamingCommunity/Util/_jsonConfig.py b/StreamingCommunity/Util/_jsonConfig.py index e8cb06b..7d49111 100644 --- a/StreamingCommunity/Util/_jsonConfig.py +++ b/StreamingCommunity/Util/_jsonConfig.py @@ -39,7 +39,7 @@ class ConfigManager: self._validate_and_update_config() self._read_initial_config() - console.print(f"[bold cyan]πŸ“‚ Configuration file path:[/bold cyan] [green]{self.file_path}[/green]") + console.print(f"[bold cyan]Configuration file path:[/bold cyan] [green]{self.file_path}[/green]") def _validate_and_update_config(self) -> None: """Validate local config against reference config and update missing keys.""" @@ -49,10 +49,10 @@ class ConfigManager: if os.path.exists(self.file_path): with open(self.file_path, 'r') as f: local_config = json.load(f) - console.print("[bold cyan]πŸ“– Local configuration found.[/bold cyan]") + console.print("[bold cyan]Local configuration found.[/bold cyan]") # Download reference config - console.print("[bold cyan]🌍 Downloading reference configuration...[/bold cyan]") + console.print("[bold cyan]Downloading reference configuration...[/bold cyan]") response = requests.get(self.reference_config_url) if response.status_code != 200: raise Exception(f"Failed to download reference config. Status code: {response.status_code}") @@ -65,14 +65,14 @@ class ConfigManager: # Save the merged config with open(self.file_path, 'w') as f: json.dump(merged_config, f, indent=4) - console.print("[bold green]βœ… Configuration updated with missing keys.[/bold green]") + console.print("[bold green]Configuration updated with missing keys.[/bold green]") else: - console.print("[bold green]βœ… Configuration is up to date.[/bold green]") + console.print("[bold green]Configuration is up to date.[/bold green]") self.config = merged_config except Exception as e: - console.print(f"[bold red]❌ Error validating configuration: {e}[/bold red]") + console.print(f"[bold red]Error validating configuration: {e}[/bold red]") if not self.config: # If validation failed and we have no config, download the reference config self.download_requirements(self.reference_config_url, self.file_path) @@ -109,38 +109,38 @@ class ConfigManager: self.use_api = self.config.get('DEFAULT', {}).get('use_api', True) else: self.use_api = True # Default to True if config file doesn't exist - console.print("[bold yellow]⚠️ Configuration file not found. Using default settings.[/bold yellow]") + console.print("[bold yellow]Configuration file not found. Using default settings.[/bold yellow]") except Exception as e: self.use_api = True # Default to True in case of error - logging.error(f"❌ Error reading initial configuration: {e}") + logging.error(f"Error reading initial configuration: {e}") def read_config(self) -> None: """Read the configuration file.""" try: - logging.info(f"πŸ“– Reading file: {self.file_path}") + logging.info(f"Reading file: {self.file_path}") # Check if file exists if os.path.exists(self.file_path): with open(self.file_path, 'r') as f: self.config = json.load(f) - console.print("[bold green]βœ… Configuration file loaded successfully.[/bold green]") + console.print("[bold green]Configuration file loaded successfully.[/bold green]") else: - console.print("[bold yellow]⚠️ Configuration file not found. Downloading...[/bold yellow]") + console.print("[bold yellow]Configuration file not found. Downloading...[/bold yellow]") self.download_requirements(self.reference_config_url, self.file_path) # Load the downloaded config.json into the config attribute with open(self.file_path, 'r') as f: self.config = json.load(f) - console.print("[bold green]βœ… Configuration file downloaded and saved.[/bold green]") + console.print("[bold green]Configuration file downloaded and saved.[/bold green]") # Update site configuration separately self.update_site_config() - console.print("[bold cyan]πŸ”§ Configuration file processing complete.[/bold cyan]") + console.print("[bold cyan]Configuration file processing complete.[/bold cyan]") except Exception as e: - logging.error(f"❌ Error reading configuration file: {e}") + logging.error(f"Error reading configuration file: {e}") def download_requirements(self, url: str, filename: str) -> None: """ @@ -151,20 +151,20 @@ class ConfigManager: filename (str): The local filename to save the file as. """ try: - logging.info(f"🌍 Downloading {filename} from {url}...") + logging.info(f"Downloading {filename} from {url}...") response = requests.get(url) if response.status_code == 200: with open(filename, 'wb') as f: f.write(response.content) - console.print(f"[bold green]βœ… Successfully downloaded {filename}.[/bold green]") + console.print(f"[bold green]Successfully downloaded {filename}.[/bold green]") else: - logging.error(f"❌ Failed to download {filename}. HTTP Status code: {response.status_code}") + logging.error(f"Failed to download {filename}. HTTP Status code: {response.status_code}") sys.exit(0) except Exception as e: - logging.error(f"❌ Failed to download {filename}: {e}") + logging.error(f"Failed to download {filename}: {e}") sys.exit(0) def update_site_config(self) -> None: @@ -177,31 +177,31 @@ class ConfigManager: } try: - console.print("[bold cyan]🌍 Fetching SITE data from API...[/bold cyan]") + console.print("[bold cyan]Fetching SITE data from API...[/bold cyan]") response = requests.get("https://zvfngpoxwrgswnzytadh.supabase.co/rest/v1/public", headers=headers) if response.status_code == 200: self.configSite = response.json()[0]['data'] - console.print("[bold green]βœ… SITE data successfully fetched.[/bold green]") + console.print("[bold green]SITE data successfully fetched.[/bold green]") else: - console.print(f"[bold red]❌ Failed to fetch SITE data. HTTP Status code: {response.status_code}[/bold red]") + console.print(f"[bold red]Failed to fetch SITE data. HTTP Status code: {response.status_code}[/bold red]") except Exception as e: - console.print(f"[bold red]❌ Error fetching SITE data: {e}[/bold red]") + console.print(f"[bold red]Error fetching SITE data: {e}[/bold red]") else: try: if os.path.exists(self.domains_path): - console.print("[bold cyan]πŸ“– Reading domains from local file...[/bold cyan]") + console.print("[bold cyan]Reading domains from local file...[/bold cyan]") with open(self.domains_path, 'r') as f: self.configSite = json.load(f) - console.print("[bold green]βœ… Domains loaded successfully from local file.[/bold green]") + console.print("[bold green]Domains loaded successfully from local file.[/bold green]") else: - error_msg = "❌ domains.json not found and API usage is disabled" + error_msg = "domains.json not found and API usage is disabled" console.print(f"[bold red]{error_msg}[/bold red]") raise FileNotFoundError(error_msg) except Exception as e: - console.print(f"[bold red]❌ Error reading domains file: {e}[/bold red]") + console.print(f"[bold red]Error reading domains file: {e}[/bold red]") raise def read_key(self, section: str, key: str, data_type: type = str, from_site: bool = False) -> Any: diff --git a/StreamingCommunity/Util/table.py b/StreamingCommunity/Util/table.py index 07e2642..232e075 100644 --- a/StreamingCommunity/Util/table.py +++ b/StreamingCommunity/Util/table.py @@ -165,7 +165,7 @@ class TVShowManager: else: choices = [str(i) for i in range(max_int_input + 1)] + ["q", "quit", "b", "back"] prompt_msg = "[cyan]Insert media [red]index" - telegram_msg = "Scegli il contenuto da scaricare:\nπŸ“Ί Serie TV - 🎞️ Film - πŸŒ€ Anime\noppure `back` per tornare indietro" + telegram_msg = "Scegli il contenuto da scaricare:\n Serie TV - Film - Anime\noppure `back` per tornare indietro" if is_telegram: key = bot.ask("select_title", telegram_msg, None) @@ -201,7 +201,7 @@ class TVShowManager: else: choices = [str(i) for i in range(max_int_input + 1)] + ["q", "quit", "b", "back"] prompt_msg = "[cyan]Insert media [red]index" - telegram_msg = "Scegli il contenuto da scaricare:\nπŸ“Ί Serie TV - 🎞️ Film - πŸŒ€ Anime\noppure `back` per tornare indietro" + telegram_msg = "Scegli il contenuto da scaricare:\n Serie TV - Film - Anime\noppure `back` per tornare indietro" if is_telegram: key = bot.ask("select_title", telegram_msg, None) diff --git a/StreamingCommunity/run.py b/StreamingCommunity/run.py index d84c769..d5736e5 100644 --- a/StreamingCommunity/run.py +++ b/StreamingCommunity/run.py @@ -149,7 +149,7 @@ def initialize(): def restart_script(): """Riavvia lo script con gli stessi argomenti della riga di comando.""" - print("\nπŸ”„ Riavvio dello script...\n") + print("\nRiavvio dello script...\n") python = sys.executable os.execv(python, [python] + sys.argv) @@ -157,31 +157,31 @@ def restart_script(): def force_exit(): """Forza la chiusura dello script in qualsiasi contesto.""" - print("\nπŸ›‘ Chiusura dello script in corso...") + print("\nChiusura dello script in corso...") - # 1️⃣ Chiudi tutti i thread tranne il principale + # 1 Chiudi tutti i thread tranne il principale for t in threading.enumerate(): if t is not threading.main_thread(): - print(f"πŸ”„ Chiusura thread: {t.name}") + print(f"Chiusura thread: {t.name}") t.join(timeout=1) - # 2️⃣ Ferma asyncio, se attivo + # 2 Ferma asyncio, se attivo try: loop = asyncio.get_event_loop() if loop.is_running(): - print("⚑ Arresto del loop asyncio...") + print("Arresto del loop asyncio...") loop.stop() except RuntimeError: pass - # 3️⃣ Esce con sys.exit(), se fallisce usa os._exit() + # 3 Esce con sys.exit(), se fallisce usa os._exit() try: - print("βœ… Uscita con sys.exit(0)") + print("Uscita con sys.exit(0)") sys.exit(0) except SystemExit: pass - print("🚨 Uscita forzata con os._exit(0)") + print("Uscita forzata con os._exit(0)") os._exit(0) @@ -189,7 +189,7 @@ def main(script_id = 0): if TELEGRAM_BOT: bot = get_bot_instance() - bot.send_message(f"🏁 Avviato script {script_id}", None) + bot.send_message(f"Avviato script {script_id}", None) start = time.time() @@ -305,24 +305,15 @@ def main(script_id = 0): ) + "[white])" if TELEGRAM_BOT: - - # Mappa delle emoji per i colori - emoji_map = { - "yellow": "🟑", # Giallo - "red": "πŸ”΄", # Rosso - "blue": "πŸ”΅", # Blu - "green": "🟒" # Verde - } - + # Display the category legend in a single line category_legend_str = "Categorie: \n" + " | ".join([ - f"{emoji_map.get(color, 'βšͺ')} {category.capitalize()}" - for category, color in color_map.items() + f"{category.capitalize()}" for category in color_map.keys() ]) - # Costruisci il messaggio con le emoji al posto dei colori + # Costruisci il messaggio senza emoji prompt_message = "Inserisci il sito:\n" + "\n".join( - [f"{key}: {emoji_map[color_map[label[1]]]} {label[0]}" for key, label in choice_labels.items()] + [f"{key}: {label[0]}" for key, label in choice_labels.items()] ) console.print(f"\n{prompt_message}") @@ -340,6 +331,7 @@ def main(script_id = 0): # Run the corresponding function based on user input if category in input_to_function: run_function(input_to_function[category], search_terms = args.search) + else: if TELEGRAM_BOT: @@ -358,4 +350,4 @@ def main(script_id = 0): # Delete script_id script_id = TelegramSession.get_session() if script_id != "unknown": - TelegramSession.deleteScriptId(script_id) + TelegramSession.deleteScriptId(script_id) \ No newline at end of file