StreamingCommunity 2.6.1__py3-none-any.whl → 2.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of StreamingCommunity might be problematic. Click here for more details.
- StreamingCommunity/Api/Player/ddl.py +4 -4
- StreamingCommunity/Api/Player/maxstream.py +10 -16
- StreamingCommunity/Api/Player/supervideo.py +9 -35
- StreamingCommunity/Api/Player/vixcloud.py +18 -92
- StreamingCommunity/Api/Site/1337xx/__init__.py +8 -1
- StreamingCommunity/Api/Site/1337xx/site.py +16 -15
- StreamingCommunity/Api/Site/1337xx/title.py +7 -5
- StreamingCommunity/Api/Site/animeunity/__init__.py +9 -2
- StreamingCommunity/Api/Site/animeunity/film_serie.py +12 -5
- StreamingCommunity/Api/Site/animeunity/site.py +14 -10
- StreamingCommunity/Api/Site/animeunity/util/ScrapeSerie.py +9 -10
- StreamingCommunity/Api/Site/cb01new/__init__.py +8 -1
- StreamingCommunity/Api/Site/cb01new/film.py +7 -1
- StreamingCommunity/Api/Site/cb01new/site.py +24 -15
- StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +9 -2
- StreamingCommunity/Api/Site/ddlstreamitaly/series.py +7 -1
- StreamingCommunity/Api/Site/ddlstreamitaly/site.py +16 -15
- StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +3 -3
- StreamingCommunity/Api/Site/guardaserie/__init__.py +9 -2
- StreamingCommunity/Api/Site/guardaserie/series.py +9 -1
- StreamingCommunity/Api/Site/guardaserie/site.py +23 -22
- StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py +5 -4
- StreamingCommunity/Api/Site/mostraguarda/__init__.py +6 -2
- StreamingCommunity/Api/Site/mostraguarda/film.py +10 -6
- StreamingCommunity/Api/Site/streamingcommunity/__init__.py +9 -2
- StreamingCommunity/Api/Site/streamingcommunity/film.py +9 -2
- StreamingCommunity/Api/Site/streamingcommunity/series.py +15 -6
- StreamingCommunity/Api/Site/streamingcommunity/site.py +16 -14
- StreamingCommunity/Api/Site/streamingcommunity/util/ScrapeSerie.py +10 -11
- StreamingCommunity/Api/Template/Util/__init__.py +0 -1
- StreamingCommunity/Api/Template/Util/get_domain.py +31 -134
- StreamingCommunity/Api/Template/Util/manage_ep.py +10 -5
- StreamingCommunity/Api/Template/config_loader.py +14 -10
- StreamingCommunity/Api/Template/site.py +3 -6
- StreamingCommunity/Lib/Downloader/HLS/downloader.py +12 -15
- StreamingCommunity/Lib/Downloader/HLS/segments.py +14 -34
- StreamingCommunity/Lib/Downloader/MP4/downloader.py +14 -11
- StreamingCommunity/Lib/Downloader/TOR/downloader.py +109 -101
- StreamingCommunity/Lib/FFmpeg/__init__.py +1 -1
- StreamingCommunity/Lib/FFmpeg/capture.py +10 -12
- StreamingCommunity/Lib/FFmpeg/command.py +15 -14
- StreamingCommunity/Lib/FFmpeg/util.py +9 -38
- StreamingCommunity/Lib/M3U8/decryptor.py +72 -146
- StreamingCommunity/Lib/M3U8/estimator.py +8 -16
- StreamingCommunity/Lib/M3U8/parser.py +1 -17
- StreamingCommunity/Lib/M3U8/url_fixer.py +1 -4
- StreamingCommunity/Lib/TMBD/__init__.py +2 -0
- StreamingCommunity/Lib/TMBD/obj_tmbd.py +3 -17
- StreamingCommunity/Lib/TMBD/tmdb.py +4 -9
- StreamingCommunity/TelegramHelp/telegram_bot.py +50 -50
- StreamingCommunity/Upload/update.py +6 -5
- StreamingCommunity/Upload/version.py +1 -1
- StreamingCommunity/Util/color.py +1 -1
- StreamingCommunity/Util/config_json.py +435 -0
- StreamingCommunity/Util/headers.py +7 -36
- StreamingCommunity/Util/logger.py +72 -42
- StreamingCommunity/Util/message.py +8 -3
- StreamingCommunity/Util/os.py +41 -93
- StreamingCommunity/Util/table.py +8 -17
- StreamingCommunity/run.py +39 -43
- {StreamingCommunity-2.6.1.dist-info → StreamingCommunity-2.8.0.dist-info}/METADATA +203 -114
- StreamingCommunity-2.8.0.dist-info/RECORD +75 -0
- StreamingCommunity/Api/Site/ilcorsaronero/__init__.py +0 -53
- StreamingCommunity/Api/Site/ilcorsaronero/site.py +0 -64
- StreamingCommunity/Api/Site/ilcorsaronero/title.py +0 -42
- StreamingCommunity/Api/Site/ilcorsaronero/util/ilCorsarScraper.py +0 -149
- StreamingCommunity/Api/Template/Util/recall_search.py +0 -37
- StreamingCommunity/Lib/Downloader/HLS/proxyes.py +0 -110
- StreamingCommunity/Util/_jsonConfig.py +0 -241
- StreamingCommunity/Util/call_stack.py +0 -42
- StreamingCommunity/Util/console.py +0 -12
- StreamingCommunity-2.6.1.dist-info/RECORD +0 -83
- {StreamingCommunity-2.6.1.dist-info → StreamingCommunity-2.8.0.dist-info}/LICENSE +0 -0
- {StreamingCommunity-2.6.1.dist-info → StreamingCommunity-2.8.0.dist-info}/WHEEL +0 -0
- {StreamingCommunity-2.6.1.dist-info → StreamingCommunity-2.8.0.dist-info}/entry_points.txt +0 -0
- {StreamingCommunity-2.6.1.dist-info → StreamingCommunity-2.8.0.dist-info}/top_level.txt +0 -0
StreamingCommunity/Util/os.py
CHANGED
|
@@ -9,9 +9,9 @@ import shutil
|
|
|
9
9
|
import hashlib
|
|
10
10
|
import logging
|
|
11
11
|
import platform
|
|
12
|
+
import inspect
|
|
12
13
|
import subprocess
|
|
13
14
|
import contextlib
|
|
14
|
-
import urllib.request
|
|
15
15
|
import importlib.metadata
|
|
16
16
|
from pathlib import Path
|
|
17
17
|
|
|
@@ -19,14 +19,19 @@ from pathlib import Path
|
|
|
19
19
|
# External library
|
|
20
20
|
import httpx
|
|
21
21
|
from unidecode import unidecode
|
|
22
|
+
from rich.console import Console
|
|
23
|
+
from rich.prompt import Prompt
|
|
22
24
|
from pathvalidate import sanitize_filename, sanitize_filepath
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
# Internal utilities
|
|
26
28
|
from .ffmpeg_installer import check_ffmpeg
|
|
27
|
-
from StreamingCommunity.Util.console import console, msg
|
|
28
29
|
|
|
29
30
|
|
|
31
|
+
# Variable
|
|
32
|
+
msg = Prompt()
|
|
33
|
+
console = Console()
|
|
34
|
+
|
|
30
35
|
|
|
31
36
|
class OsManager:
|
|
32
37
|
def __init__(self):
|
|
@@ -243,7 +248,6 @@ class OsManager:
|
|
|
243
248
|
|
|
244
249
|
|
|
245
250
|
class InternManager():
|
|
246
|
-
|
|
247
251
|
def format_file_size(self, size_bytes: float) -> str:
|
|
248
252
|
"""
|
|
249
253
|
Formats a file size from bytes into a human-readable string representation.
|
|
@@ -283,20 +287,8 @@ class InternManager():
|
|
|
283
287
|
else:
|
|
284
288
|
return f"{bytes / (1024 * 1024):.2f} MB/s"
|
|
285
289
|
|
|
286
|
-
@staticmethod
|
|
287
|
-
def check_internet():
|
|
288
|
-
while True:
|
|
289
|
-
try:
|
|
290
|
-
httpx.get("https://www.google.com", timeout=5)
|
|
291
|
-
break
|
|
292
|
-
|
|
293
|
-
except Exception as e:
|
|
294
|
-
console.log("[bold red]Internet is not available. Waiting...[/bold red]")
|
|
295
|
-
time.sleep(2)
|
|
296
|
-
|
|
297
290
|
|
|
298
291
|
class OsSummary:
|
|
299
|
-
|
|
300
292
|
def __init__(self):
|
|
301
293
|
self.ffmpeg_path = None
|
|
302
294
|
self.ffprobe_path = None
|
|
@@ -343,32 +335,6 @@ class OsSummary:
|
|
|
343
335
|
except importlib.metadata.PackageNotFoundError:
|
|
344
336
|
return f"{lib_name}-not installed"
|
|
345
337
|
|
|
346
|
-
def download_requirements(self, url: str, filename: str):
|
|
347
|
-
"""
|
|
348
|
-
Download the requirements.txt file from the specified URL if not found locally using requests.
|
|
349
|
-
|
|
350
|
-
Args:
|
|
351
|
-
url (str): The URL to download the requirements file from.
|
|
352
|
-
filename (str): The local filename to save the requirements file as.
|
|
353
|
-
"""
|
|
354
|
-
try:
|
|
355
|
-
import requests
|
|
356
|
-
|
|
357
|
-
logging.info(f"{filename} not found locally. Downloading from {url}...")
|
|
358
|
-
response = requests.get(url)
|
|
359
|
-
|
|
360
|
-
if response.status_code == 200:
|
|
361
|
-
with open(filename, 'wb') as f:
|
|
362
|
-
f.write(response.content)
|
|
363
|
-
|
|
364
|
-
else:
|
|
365
|
-
logging.error(f"Failed to download {filename}. HTTP Status code: {response.status_code}")
|
|
366
|
-
sys.exit(0)
|
|
367
|
-
|
|
368
|
-
except Exception as e:
|
|
369
|
-
logging.error(f"Failed to download {filename}: {e}")
|
|
370
|
-
sys.exit(0)
|
|
371
|
-
|
|
372
338
|
def install_library(self, lib_name: str):
|
|
373
339
|
"""
|
|
374
340
|
Install a Python library using pip.
|
|
@@ -399,17 +365,6 @@ class OsSummary:
|
|
|
399
365
|
|
|
400
366
|
def get_system_summary(self):
|
|
401
367
|
self.check_python_version()
|
|
402
|
-
InternManager().check_internet()
|
|
403
|
-
|
|
404
|
-
# Python info
|
|
405
|
-
python_version = sys.version.split()[0]
|
|
406
|
-
python_implementation = platform.python_implementation()
|
|
407
|
-
arch = platform.machine()
|
|
408
|
-
os_info = platform.platform()
|
|
409
|
-
glibc_version = 'glibc ' + '.'.join(map(str, platform.libc_ver()[1]))
|
|
410
|
-
|
|
411
|
-
console.print(f"[cyan]Python[white]: [bold red]{python_version} ({python_implementation} {arch}) - {os_info} ({glibc_version})[/bold red]")
|
|
412
|
-
logging.info(f"Python: {python_version} ({python_implementation} {arch}) - {os_info} ({glibc_version})")
|
|
413
368
|
|
|
414
369
|
# FFmpeg detection
|
|
415
370
|
binary_dir = self.get_binary_directory()
|
|
@@ -453,33 +408,7 @@ class OsSummary:
|
|
|
453
408
|
console.log("[red]Can't locate ffmpeg or ffprobe")
|
|
454
409
|
sys.exit(0)
|
|
455
410
|
|
|
456
|
-
console.print(f"[cyan]Path
|
|
457
|
-
|
|
458
|
-
# Handle requirements.txt
|
|
459
|
-
if not getattr(sys, 'frozen', False):
|
|
460
|
-
requirements_file = 'requirements.txt'
|
|
461
|
-
|
|
462
|
-
requirements_file = Path(__file__).parent.parent.parent / requirements_file
|
|
463
|
-
|
|
464
|
-
if not os.path.exists(requirements_file):
|
|
465
|
-
self.download_requirements(
|
|
466
|
-
'https://raw.githubusercontent.com/Arrowar/StreamingCommunity/refs/heads/main/requirements.txt',
|
|
467
|
-
requirements_file
|
|
468
|
-
)
|
|
469
|
-
|
|
470
|
-
optional_libraries = [line.strip().split("=")[0] for line in open(requirements_file, 'r', encoding='utf-8-sig')]
|
|
471
|
-
|
|
472
|
-
for lib in optional_libraries:
|
|
473
|
-
installed_version = self.get_library_version(lib.split("<")[0])
|
|
474
|
-
if 'not installed' in installed_version:
|
|
475
|
-
user_response = msg.ask(f"{lib} is not installed. Do you want to install it? (yes/no)", default="y")
|
|
476
|
-
if user_response.lower().strip() in ["yes", "y"]:
|
|
477
|
-
self.install_library(lib)
|
|
478
|
-
else:
|
|
479
|
-
logging.info(f"Library: {installed_version}")
|
|
480
|
-
|
|
481
|
-
#console.print(f"[cyan]Libraries[white]: [bold red]{', '.join([self.get_library_version(lib) for lib in optional_libraries])}[/bold red]\n")
|
|
482
|
-
logging.info(f"Libraries: {', '.join([self.get_library_version(lib) for lib in optional_libraries])}")
|
|
411
|
+
console.print(f"[cyan]Path: [red]ffmpeg [bold yellow]'{self.ffmpeg_path}'[/bold yellow][white], [red]ffprobe '[bold yellow]{self.ffprobe_path}'[/bold yellow]")
|
|
483
412
|
|
|
484
413
|
|
|
485
414
|
os_manager = OsManager()
|
|
@@ -493,17 +422,36 @@ def suppress_output():
|
|
|
493
422
|
yield
|
|
494
423
|
|
|
495
424
|
def compute_sha1_hash(input_string: str) -> str:
|
|
496
|
-
"""
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
425
|
+
"""Computes the SHA-1 hash of the input string."""
|
|
426
|
+
return hashlib.sha1(input_string.encode()).hexdigest()
|
|
427
|
+
|
|
428
|
+
def get_call_stack():
|
|
429
|
+
"""Retrieves the current call stack with details about each call."""
|
|
430
|
+
stack = inspect.stack()
|
|
431
|
+
call_stack = []
|
|
432
|
+
|
|
433
|
+
for frame_info in stack:
|
|
434
|
+
function_name = frame_info.function
|
|
435
|
+
filename = frame_info.filename
|
|
436
|
+
lineno = frame_info.lineno
|
|
437
|
+
folder_name = os.path.dirname(filename)
|
|
438
|
+
folder_base = os.path.basename(folder_name)
|
|
439
|
+
script_name = os.path.basename(filename)
|
|
440
|
+
|
|
441
|
+
call_stack.append({
|
|
442
|
+
"function": function_name,
|
|
443
|
+
"folder": folder_name,
|
|
444
|
+
"folder_base": folder_base,
|
|
445
|
+
"script": script_name,
|
|
446
|
+
"line": lineno
|
|
447
|
+
})
|
|
448
|
+
|
|
449
|
+
return call_stack
|
|
450
|
+
|
|
451
|
+
def get_ffmpeg_path():
|
|
452
|
+
"""Returns the path of FFmpeg."""
|
|
453
|
+
return os_summary.ffmpeg_path
|
|
454
|
+
|
|
455
|
+
def get_ffprobe_path():
|
|
456
|
+
"""Returns the path of FFprobe."""
|
|
457
|
+
return os_summary.ffprobe_path
|
StreamingCommunity/Util/table.py
CHANGED
|
@@ -16,12 +16,13 @@ from rich.style import Style
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
# Internal utilities
|
|
19
|
+
from .os import get_call_stack
|
|
19
20
|
from .message import start_message
|
|
20
|
-
|
|
21
|
+
|
|
21
22
|
|
|
22
23
|
# Telegram bot instance
|
|
23
24
|
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance
|
|
24
|
-
from StreamingCommunity.Util.
|
|
25
|
+
from StreamingCommunity.Util.config_json import config_manager
|
|
25
26
|
TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot')
|
|
26
27
|
|
|
27
28
|
|
|
@@ -31,21 +32,11 @@ class TVShowManager:
|
|
|
31
32
|
"""Initialize TVShowManager with default values."""
|
|
32
33
|
self.console = Console()
|
|
33
34
|
self.tv_shows: List[Dict[str, Any]] = []
|
|
34
|
-
self.slice_start
|
|
35
|
-
self.slice_end
|
|
36
|
-
self.step
|
|
35
|
+
self.slice_start = 0
|
|
36
|
+
self.slice_end = 10
|
|
37
|
+
self.step = self.slice_end
|
|
37
38
|
self.column_info = []
|
|
38
39
|
|
|
39
|
-
def set_slice_end(self, new_slice: int) -> None:
|
|
40
|
-
"""
|
|
41
|
-
Set the end of the slice for displaying TV shows.
|
|
42
|
-
|
|
43
|
-
Parameters:
|
|
44
|
-
- new_slice (int): The new value for the slice end.
|
|
45
|
-
"""
|
|
46
|
-
self.slice_end = new_slice
|
|
47
|
-
self.step = new_slice
|
|
48
|
-
|
|
49
40
|
def add_column(self, column_info: Dict[str, Dict[str, str]]) -> None:
|
|
50
41
|
"""
|
|
51
42
|
Add column information.
|
|
@@ -164,7 +155,7 @@ class TVShowManager:
|
|
|
164
155
|
else:
|
|
165
156
|
choices = [str(i) for i in range(max_int_input + 1)] + ["q", "quit", "b", "back"]
|
|
166
157
|
prompt_msg = "[cyan]Insert media [red]index"
|
|
167
|
-
telegram_msg = "Scegli il contenuto da scaricare:\n
|
|
158
|
+
telegram_msg = "Scegli il contenuto da scaricare:\n Serie TV - Film - Anime\noppure `back` per tornare indietro"
|
|
168
159
|
|
|
169
160
|
if is_telegram:
|
|
170
161
|
key = bot.ask("select_title", telegram_msg, None)
|
|
@@ -200,7 +191,7 @@ class TVShowManager:
|
|
|
200
191
|
else:
|
|
201
192
|
choices = [str(i) for i in range(max_int_input + 1)] + ["q", "quit", "b", "back"]
|
|
202
193
|
prompt_msg = "[cyan]Insert media [red]index"
|
|
203
|
-
telegram_msg = "Scegli il contenuto da scaricare:\n
|
|
194
|
+
telegram_msg = "Scegli il contenuto da scaricare:\n Serie TV - Film - Anime\noppure `back` per tornare indietro"
|
|
204
195
|
|
|
205
196
|
if is_telegram:
|
|
206
197
|
key = bot.ask("select_title", telegram_msg, None)
|
StreamingCommunity/run.py
CHANGED
|
@@ -12,39 +12,46 @@ import threading, asyncio
|
|
|
12
12
|
from typing import Callable
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
# External library
|
|
16
|
+
from rich.console import Console
|
|
17
|
+
from rich.prompt import Prompt
|
|
18
|
+
|
|
19
|
+
|
|
15
20
|
# Internal utilities
|
|
16
21
|
from StreamingCommunity.Util.message import start_message
|
|
17
|
-
from StreamingCommunity.Util.
|
|
18
|
-
from StreamingCommunity.Util._jsonConfig import config_manager
|
|
22
|
+
from StreamingCommunity.Util.config_json import config_manager
|
|
19
23
|
from StreamingCommunity.Util.os import os_summary
|
|
20
24
|
from StreamingCommunity.Util.logger import Logger
|
|
21
25
|
from StreamingCommunity.Upload.update import update as git_update
|
|
22
26
|
from StreamingCommunity.Lib.TMBD import tmdb
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# Telegram util
|
|
26
27
|
from StreamingCommunity.TelegramHelp.telegram_bot import get_bot_instance, TelegramSession
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
# Config
|
|
31
|
+
SHOW_TRENDING = config_manager.get_bool('DEFAULT', 'show_trending')
|
|
30
32
|
CLOSE_CONSOLE = config_manager.get_bool('DEFAULT', 'not_close')
|
|
31
33
|
TELEGRAM_BOT = config_manager.get_bool('DEFAULT', 'telegram_bot')
|
|
32
34
|
|
|
33
35
|
|
|
36
|
+
# Variable
|
|
37
|
+
console = Console()
|
|
38
|
+
msg = Prompt()
|
|
39
|
+
|
|
34
40
|
|
|
35
|
-
def run_function(func: Callable[..., None], close_console: bool = False) -> None:
|
|
41
|
+
def run_function(func: Callable[..., None], close_console: bool = False, search_terms: str = None) -> None:
|
|
36
42
|
"""
|
|
37
43
|
Run a given function indefinitely or once, depending on the value of close_console.
|
|
38
44
|
|
|
39
45
|
Parameters:
|
|
40
46
|
func (Callable[..., None]): The function to run.
|
|
41
47
|
close_console (bool, optional): Whether to close the console after running the function once. Defaults to False.
|
|
48
|
+
search_terms (str, optional): Search terms to use for the function. Defaults to None.
|
|
42
49
|
"""
|
|
43
50
|
if close_console:
|
|
44
51
|
while 1:
|
|
45
|
-
func()
|
|
52
|
+
func(search_terms)
|
|
46
53
|
else:
|
|
47
|
-
func()
|
|
54
|
+
func(search_terms)
|
|
48
55
|
|
|
49
56
|
|
|
50
57
|
def load_search_functions():
|
|
@@ -134,10 +141,10 @@ def initialize():
|
|
|
134
141
|
sys.exit(0)
|
|
135
142
|
|
|
136
143
|
# Trending tmbd
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
144
|
+
if SHOW_TRENDING:
|
|
145
|
+
print()
|
|
146
|
+
tmdb.display_trending_films()
|
|
147
|
+
tmdb.display_trending_tv_shows()
|
|
141
148
|
|
|
142
149
|
# Attempting GitHub update
|
|
143
150
|
try:
|
|
@@ -147,7 +154,7 @@ def initialize():
|
|
|
147
154
|
|
|
148
155
|
def restart_script():
|
|
149
156
|
"""Riavvia lo script con gli stessi argomenti della riga di comando."""
|
|
150
|
-
print("\
|
|
157
|
+
print("\nRiavvio dello script...\n")
|
|
151
158
|
python = sys.executable
|
|
152
159
|
os.execv(python, [python] + sys.argv)
|
|
153
160
|
|
|
@@ -155,31 +162,31 @@ def restart_script():
|
|
|
155
162
|
def force_exit():
|
|
156
163
|
"""Forza la chiusura dello script in qualsiasi contesto."""
|
|
157
164
|
|
|
158
|
-
print("\
|
|
165
|
+
print("\nChiusura dello script in corso...")
|
|
159
166
|
|
|
160
|
-
# 1
|
|
167
|
+
# 1 Chiudi tutti i thread tranne il principale
|
|
161
168
|
for t in threading.enumerate():
|
|
162
169
|
if t is not threading.main_thread():
|
|
163
|
-
print(f"
|
|
170
|
+
print(f"Chiusura thread: {t.name}")
|
|
164
171
|
t.join(timeout=1)
|
|
165
172
|
|
|
166
|
-
# 2
|
|
173
|
+
# 2 Ferma asyncio, se attivo
|
|
167
174
|
try:
|
|
168
175
|
loop = asyncio.get_event_loop()
|
|
169
176
|
if loop.is_running():
|
|
170
|
-
print("
|
|
177
|
+
print("Arresto del loop asyncio...")
|
|
171
178
|
loop.stop()
|
|
172
179
|
except RuntimeError:
|
|
173
180
|
pass
|
|
174
181
|
|
|
175
|
-
# 3
|
|
182
|
+
# 3 Esce con sys.exit(), se fallisce usa os._exit()
|
|
176
183
|
try:
|
|
177
|
-
print("
|
|
184
|
+
print("Uscita con sys.exit(0)")
|
|
178
185
|
sys.exit(0)
|
|
179
186
|
except SystemExit:
|
|
180
187
|
pass
|
|
181
188
|
|
|
182
|
-
print("
|
|
189
|
+
print("Uscita forzata con os._exit(0)")
|
|
183
190
|
os._exit(0)
|
|
184
191
|
|
|
185
192
|
|
|
@@ -187,7 +194,7 @@ def main(script_id = 0):
|
|
|
187
194
|
|
|
188
195
|
if TELEGRAM_BOT:
|
|
189
196
|
bot = get_bot_instance()
|
|
190
|
-
bot.send_message(f"
|
|
197
|
+
bot.send_message(f"Avviato script {script_id}", None)
|
|
191
198
|
|
|
192
199
|
start = time.time()
|
|
193
200
|
|
|
@@ -210,9 +217,6 @@ def main(script_id = 0):
|
|
|
210
217
|
parser.add_argument(
|
|
211
218
|
'--add_siteName', type=bool, help='Enable or disable adding the site name to the file name (e.g., true/false).'
|
|
212
219
|
)
|
|
213
|
-
parser.add_argument(
|
|
214
|
-
'--disable_searchDomain', type=bool, help='Enable or disable searching in configured domains (e.g., true/false).'
|
|
215
|
-
)
|
|
216
220
|
parser.add_argument(
|
|
217
221
|
'--not_close', type=bool, help='If set to true, the script will not close the console after execution (e.g., true/false).'
|
|
218
222
|
)
|
|
@@ -248,16 +252,16 @@ def main(script_id = 0):
|
|
|
248
252
|
long_option = alias
|
|
249
253
|
parser.add_argument(f'-{short_option}', f'--{long_option}', action='store_true', help=f'Search for {alias.split("_")[0]} on streaming platforms.')
|
|
250
254
|
|
|
255
|
+
parser.add_argument('-s', '--search', default=None, help='Search terms')
|
|
251
256
|
# Parse command-line arguments
|
|
252
257
|
args = parser.parse_args()
|
|
253
258
|
|
|
259
|
+
search_terms = args.search
|
|
254
260
|
# Map command-line arguments to the config values
|
|
255
261
|
config_updates = {}
|
|
256
262
|
|
|
257
263
|
if args.add_siteName is not None:
|
|
258
264
|
config_updates['DEFAULT.add_siteName'] = args.add_siteName
|
|
259
|
-
if args.disable_searchDomain is not None:
|
|
260
|
-
config_updates['DEFAULT.disable_searchDomain'] = args.disable_searchDomain
|
|
261
265
|
if args.not_close is not None:
|
|
262
266
|
config_updates['DEFAULT.not_close'] = args.not_close
|
|
263
267
|
if args.default_video_worker is not None:
|
|
@@ -282,7 +286,7 @@ def main(script_id = 0):
|
|
|
282
286
|
# Check which argument is provided and run the corresponding function
|
|
283
287
|
for arg, func in arg_to_function.items():
|
|
284
288
|
if getattr(args, arg):
|
|
285
|
-
run_function(func)
|
|
289
|
+
run_function(func, search_terms=search_terms)
|
|
286
290
|
return
|
|
287
291
|
|
|
288
292
|
# Mapping user input to functions
|
|
@@ -301,24 +305,15 @@ def main(script_id = 0):
|
|
|
301
305
|
) + "[white])"
|
|
302
306
|
|
|
303
307
|
if TELEGRAM_BOT:
|
|
304
|
-
|
|
305
|
-
# Mappa delle emoji per i colori
|
|
306
|
-
emoji_map = {
|
|
307
|
-
"yellow": "🟡", # Giallo
|
|
308
|
-
"red": "🔴", # Rosso
|
|
309
|
-
"blue": "🔵", # Blu
|
|
310
|
-
"green": "🟢" # Verde
|
|
311
|
-
}
|
|
312
|
-
|
|
308
|
+
|
|
313
309
|
# Display the category legend in a single line
|
|
314
310
|
category_legend_str = "Categorie: \n" + " | ".join([
|
|
315
|
-
f"{
|
|
316
|
-
for category, color in color_map.items()
|
|
311
|
+
f"{category.capitalize()}" for category in color_map.keys()
|
|
317
312
|
])
|
|
318
313
|
|
|
319
|
-
# Costruisci il messaggio
|
|
314
|
+
# Costruisci il messaggio senza emoji
|
|
320
315
|
prompt_message = "Inserisci il sito:\n" + "\n".join(
|
|
321
|
-
[f"{key}: {
|
|
316
|
+
[f"{key}: {label[0]}" for key, label in choice_labels.items()]
|
|
322
317
|
)
|
|
323
318
|
|
|
324
319
|
console.print(f"\n{prompt_message}")
|
|
@@ -335,7 +330,8 @@ def main(script_id = 0):
|
|
|
335
330
|
|
|
336
331
|
# Run the corresponding function based on user input
|
|
337
332
|
if category in input_to_function:
|
|
338
|
-
run_function(input_to_function[category])
|
|
333
|
+
run_function(input_to_function[category], search_terms = args.search)
|
|
334
|
+
|
|
339
335
|
else:
|
|
340
336
|
|
|
341
337
|
if TELEGRAM_BOT:
|
|
@@ -354,4 +350,4 @@ def main(script_id = 0):
|
|
|
354
350
|
# Delete script_id
|
|
355
351
|
script_id = TelegramSession.get_session()
|
|
356
352
|
if script_id != "unknown":
|
|
357
|
-
TelegramSession.deleteScriptId(script_id)
|
|
353
|
+
TelegramSession.deleteScriptId(script_id)
|