StreamingCommunity 1.9.5__py3-none-any.whl → 1.9.90__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.

Files changed (93) hide show
  1. StreamingCommunity/Api/Player/Helper/Vixcloud/js_parser.py +143 -0
  2. StreamingCommunity/Api/Player/Helper/Vixcloud/util.py +145 -0
  3. StreamingCommunity/Api/Player/ddl.py +89 -0
  4. StreamingCommunity/Api/Player/maxstream.py +151 -0
  5. StreamingCommunity/Api/Player/supervideo.py +194 -0
  6. StreamingCommunity/Api/Player/vixcloud.py +273 -0
  7. StreamingCommunity/Api/Site/1337xx/__init__.py +51 -0
  8. StreamingCommunity/Api/Site/1337xx/costant.py +15 -0
  9. StreamingCommunity/Api/Site/1337xx/site.py +86 -0
  10. StreamingCommunity/Api/Site/1337xx/title.py +66 -0
  11. StreamingCommunity/Api/Site/altadefinizione/__init__.py +51 -0
  12. StreamingCommunity/Api/Site/altadefinizione/costant.py +15 -0
  13. StreamingCommunity/Api/Site/altadefinizione/film.py +74 -0
  14. StreamingCommunity/Api/Site/altadefinizione/site.py +89 -0
  15. StreamingCommunity/Api/Site/animeunity/__init__.py +51 -0
  16. StreamingCommunity/Api/Site/animeunity/costant.py +15 -0
  17. StreamingCommunity/Api/Site/animeunity/film_serie.py +135 -0
  18. StreamingCommunity/Api/Site/animeunity/site.py +167 -0
  19. StreamingCommunity/Api/Site/animeunity/util/ScrapeSerie.py +97 -0
  20. StreamingCommunity/Api/Site/cb01new/__init__.py +52 -0
  21. StreamingCommunity/Api/Site/cb01new/costant.py +15 -0
  22. StreamingCommunity/Api/Site/cb01new/film.py +73 -0
  23. StreamingCommunity/Api/Site/cb01new/site.py +76 -0
  24. StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +58 -0
  25. StreamingCommunity/Api/Site/ddlstreamitaly/costant.py +16 -0
  26. StreamingCommunity/Api/Site/ddlstreamitaly/series.py +146 -0
  27. StreamingCommunity/Api/Site/ddlstreamitaly/site.py +95 -0
  28. StreamingCommunity/Api/Site/ddlstreamitaly/util/ScrapeSerie.py +85 -0
  29. StreamingCommunity/Api/Site/guardaserie/__init__.py +53 -0
  30. StreamingCommunity/Api/Site/guardaserie/costant.py +15 -0
  31. StreamingCommunity/Api/Site/guardaserie/series.py +199 -0
  32. StreamingCommunity/Api/Site/guardaserie/site.py +86 -0
  33. StreamingCommunity/Api/Site/guardaserie/util/ScrapeSerie.py +110 -0
  34. StreamingCommunity/Api/Site/ilcorsaronero/__init__.py +52 -0
  35. StreamingCommunity/Api/Site/ilcorsaronero/costant.py +15 -0
  36. StreamingCommunity/Api/Site/ilcorsaronero/site.py +63 -0
  37. StreamingCommunity/Api/Site/ilcorsaronero/title.py +46 -0
  38. StreamingCommunity/Api/Site/ilcorsaronero/util/ilCorsarScraper.py +141 -0
  39. StreamingCommunity/Api/Site/mostraguarda/__init__.py +49 -0
  40. StreamingCommunity/Api/Site/mostraguarda/costant.py +15 -0
  41. StreamingCommunity/Api/Site/mostraguarda/film.py +99 -0
  42. StreamingCommunity/Api/Site/streamingcommunity/__init__.py +56 -0
  43. StreamingCommunity/Api/Site/streamingcommunity/costant.py +15 -0
  44. StreamingCommunity/Api/Site/streamingcommunity/film.py +75 -0
  45. StreamingCommunity/Api/Site/streamingcommunity/series.py +206 -0
  46. StreamingCommunity/Api/Site/streamingcommunity/site.py +137 -0
  47. StreamingCommunity/Api/Site/streamingcommunity/util/ScrapeSerie.py +123 -0
  48. StreamingCommunity/Api/Template/Class/SearchType.py +101 -0
  49. StreamingCommunity/Api/Template/Util/__init__.py +5 -0
  50. StreamingCommunity/Api/Template/Util/get_domain.py +173 -0
  51. StreamingCommunity/Api/Template/Util/manage_ep.py +179 -0
  52. StreamingCommunity/Api/Template/Util/recall_search.py +37 -0
  53. StreamingCommunity/Api/Template/__init__.py +3 -0
  54. StreamingCommunity/Api/Template/site.py +87 -0
  55. StreamingCommunity/Lib/Downloader/HLS/downloader.py +946 -0
  56. StreamingCommunity/Lib/Downloader/HLS/proxyes.py +110 -0
  57. StreamingCommunity/Lib/Downloader/HLS/segments.py +561 -0
  58. StreamingCommunity/Lib/Downloader/MP4/downloader.py +155 -0
  59. StreamingCommunity/Lib/Downloader/TOR/downloader.py +296 -0
  60. StreamingCommunity/Lib/Downloader/__init__.py +5 -0
  61. StreamingCommunity/Lib/FFmpeg/__init__.py +4 -0
  62. StreamingCommunity/Lib/FFmpeg/capture.py +170 -0
  63. StreamingCommunity/Lib/FFmpeg/command.py +296 -0
  64. StreamingCommunity/Lib/FFmpeg/util.py +249 -0
  65. StreamingCommunity/Lib/M3U8/__init__.py +6 -0
  66. StreamingCommunity/Lib/M3U8/decryptor.py +164 -0
  67. StreamingCommunity/Lib/M3U8/estimator.py +176 -0
  68. StreamingCommunity/Lib/M3U8/parser.py +666 -0
  69. StreamingCommunity/Lib/M3U8/url_fixer.py +52 -0
  70. StreamingCommunity/Lib/TMBD/__init__.py +2 -0
  71. StreamingCommunity/Lib/TMBD/obj_tmbd.py +39 -0
  72. StreamingCommunity/Lib/TMBD/tmdb.py +346 -0
  73. StreamingCommunity/Upload/update.py +68 -0
  74. StreamingCommunity/Upload/version.py +5 -0
  75. StreamingCommunity/Util/_jsonConfig.py +204 -0
  76. StreamingCommunity/Util/call_stack.py +42 -0
  77. StreamingCommunity/Util/color.py +20 -0
  78. StreamingCommunity/Util/console.py +12 -0
  79. StreamingCommunity/Util/ffmpeg_installer.py +311 -0
  80. StreamingCommunity/Util/headers.py +147 -0
  81. StreamingCommunity/Util/logger.py +53 -0
  82. StreamingCommunity/Util/message.py +64 -0
  83. StreamingCommunity/Util/os.py +554 -0
  84. StreamingCommunity/Util/table.py +229 -0
  85. StreamingCommunity/__init__.py +0 -0
  86. StreamingCommunity/run.py +2 -11
  87. {StreamingCommunity-1.9.5.dist-info → StreamingCommunity-1.9.90.dist-info}/METADATA +10 -27
  88. StreamingCommunity-1.9.90.dist-info/RECORD +92 -0
  89. {StreamingCommunity-1.9.5.dist-info → StreamingCommunity-1.9.90.dist-info}/WHEEL +1 -1
  90. {StreamingCommunity-1.9.5.dist-info → StreamingCommunity-1.9.90.dist-info}/entry_points.txt +0 -1
  91. StreamingCommunity-1.9.5.dist-info/RECORD +0 -7
  92. {StreamingCommunity-1.9.5.dist-info → StreamingCommunity-1.9.90.dist-info}/LICENSE +0 -0
  93. {StreamingCommunity-1.9.5.dist-info → StreamingCommunity-1.9.90.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,554 @@
1
+ # 24.01.24
2
+
3
+ import io
4
+ import os
5
+ import sys
6
+ import time
7
+ import shutil
8
+ import hashlib
9
+ import logging
10
+ import platform
11
+ import unidecode
12
+ import subprocess
13
+ import contextlib
14
+ import pathvalidate
15
+ import urllib.request
16
+ import importlib.metadata
17
+
18
+
19
+ # External library
20
+ import httpx
21
+
22
+
23
+ # Internal utilities
24
+ from .ffmpeg_installer import check_ffmpeg
25
+ from StreamingCommunity.Util.console import console, msg
26
+
27
+
28
+ # Variable
29
+ OS_CONFIGURATIONS = {
30
+ 'windows': {
31
+ 'max_length': 255,
32
+ 'invalid_chars': '<>:"/\\|?*',
33
+ 'reserved_names': [
34
+ "CON", "PRN", "AUX", "NUL",
35
+ "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9",
36
+ "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"
37
+ ],
38
+ 'max_path': 255
39
+ },
40
+ 'darwin': {
41
+ 'max_length': 4096,
42
+ 'invalid_chars': '/:',
43
+ 'reserved_names': [],
44
+ 'hidden_file_restriction': True
45
+ },
46
+ 'linux': {
47
+ 'max_length': 4096,
48
+ 'invalid_chars': '/\0',
49
+ 'reserved_names': []
50
+ }
51
+ }
52
+
53
+
54
+
55
+ class OsManager:
56
+ def __init__(self):
57
+ self.system = self._detect_system()
58
+ self.config = OS_CONFIGURATIONS.get(self.system, {})
59
+
60
+ def _detect_system(self) -> str:
61
+ """Detect and normalize operating system name."""
62
+ system = platform.system().lower()
63
+
64
+ if system in OS_CONFIGURATIONS:
65
+ return system
66
+
67
+ raise ValueError(f"Unsupported operating system: {system}")
68
+
69
+ def _normalize_windows_path(self, path: str) -> str:
70
+ """
71
+ Normalize Windows paths to handle drive letters correctly.
72
+
73
+ Args:
74
+ path (str): Original path that might contain a drive letter.
75
+
76
+ Returns:
77
+ str: Properly normalized absolute path.
78
+ """
79
+ if self.system != 'windows':
80
+ return path
81
+
82
+ # Check if path starts with a drive letter
83
+ if len(path) >= 2 and path[1] == ':':
84
+ drive = path[0:2]
85
+ rest = path[2:].lstrip(os.sep)
86
+ # Ensure proper absolute path format
87
+ return os.path.join(drive + os.sep, rest)
88
+ return path
89
+
90
+ def _process_filename(self, filename: str) -> str:
91
+ """
92
+ Comprehensively process filename with cross-platform considerations.
93
+
94
+ Args:
95
+ filename (str): Original filename.
96
+
97
+ Returns:
98
+ str: Processed filename.
99
+ """
100
+ name, ext = os.path.splitext(filename)
101
+
102
+ # Handle length restrictions
103
+ if len(name) > self.config['max_length']:
104
+ name = self._truncate_filename(name)
105
+
106
+ # Reconstruct filename
107
+ processed_filename = name + ext
108
+
109
+ return processed_filename
110
+
111
+ def _truncate_filename(self, name: str) -> str:
112
+ """
113
+ Truncate filename based on OS-specific rules.
114
+
115
+ Args:
116
+ name (str): Original filename.
117
+
118
+ Returns:
119
+ str: Truncated filename.
120
+ """
121
+ logging.info("_truncate_filename: ", name)
122
+
123
+ if self.system == 'windows':
124
+ return name[:self.config['max_length'] - 3] + '___'
125
+ elif self.system == 'darwin':
126
+ return name[:self.config['max_length']]
127
+ elif self.system == 'linux':
128
+ return name[:self.config['max_length'] - 2] + '___'
129
+
130
+ def get_sanitize_file(self, filename: str) -> str:
131
+ """
132
+ Sanitize filename using pathvalidate with unidecode.
133
+
134
+ Args:
135
+ filename (str): Original filename.
136
+
137
+ Returns:
138
+ str: Sanitized filename.
139
+ """
140
+
141
+ # Decode unicode characters and sanitize
142
+ decoded_filename = unidecode.unidecode(filename)
143
+ sanitized_filename = pathvalidate.sanitize_filename(decoded_filename)
144
+
145
+ # Truncate if necessary based on OS configuration
146
+ name, ext = os.path.splitext(sanitized_filename)
147
+ if len(name) > self.config['max_length']:
148
+ name = self._truncate_filename(name)
149
+
150
+ result = name + ext
151
+ return result
152
+
153
+ def get_sanitize_path(self, path: str) -> str:
154
+ """
155
+ Sanitize folder path using pathvalidate with unidecode.
156
+
157
+ Args:
158
+ path (str): Original folder path.
159
+
160
+ Returns:
161
+ str: Sanitized folder path.
162
+ """
163
+
164
+ # Normalize path for Windows drive letters first
165
+ path = self._normalize_windows_path(path)
166
+
167
+ # Decode unicode characters and sanitize
168
+ decoded_path = unidecode.unidecode(path)
169
+ sanitized_path = pathvalidate.sanitize_filepath(decoded_path)
170
+
171
+ # Split path and process each component
172
+ path_components = os.path.normpath(sanitized_path).split(os.sep)
173
+
174
+ # Handle Windows drive letter specially
175
+ if self.system == 'windows' and len(path_components[0]) == 2 and path_components[0][1] == ':':
176
+ drive = path_components.pop(0)
177
+ processed_components = [drive + os.sep]
178
+
179
+ else:
180
+ processed_components = []
181
+
182
+ # Process remaining components
183
+ for component in path_components:
184
+ if component: # Skip empty components
185
+ if len(component) > self.config['max_length']:
186
+ component = self._truncate_filename(component)
187
+
188
+ processed_components.append(component)
189
+
190
+ # Join with proper separator and normalize
191
+ result = os.path.normpath(os.path.join(*processed_components))
192
+ return result
193
+
194
+ def create_path(self, path: str, mode: int = 0o755) -> bool:
195
+ """
196
+ Create directory path with specified permissions.
197
+
198
+ Args:
199
+ path (str): Path to create.
200
+ mode (int, optional): Directory permissions. Defaults to 0o755.
201
+
202
+ Returns:
203
+ bool: True if path created successfully, False otherwise.
204
+ """
205
+ try:
206
+ sanitized_path = self.get_sanitize_path(path)
207
+ os.makedirs(sanitized_path, mode=mode, exist_ok=True)
208
+ return True
209
+
210
+ except Exception as e:
211
+ logging.error(f"Path creation error: {e}")
212
+ return False
213
+
214
+ def remove_folder(self, folder_path: str) -> bool:
215
+ """
216
+ Safely remove a folder.
217
+
218
+ Args:
219
+ folder_path (str): Path of directory to remove.
220
+
221
+ Returns:
222
+ bool: Removal status.
223
+ """
224
+ try:
225
+ shutil.rmtree(folder_path)
226
+ return True
227
+
228
+ except OSError as e:
229
+ logging.error(f"Folder removal error: {e}")
230
+ return False
231
+
232
+ def remove_files_except_one(self, folder_path: str, keep_file: str) -> None:
233
+ """
234
+ Delete all files in a folder except for one specified file.
235
+
236
+ Parameters:
237
+ - folder_path (str): The path to the folder containing the files.
238
+ - keep_file (str): The filename to keep in the folder.
239
+ """
240
+
241
+ try:
242
+ # List all files in the folder
243
+ files_in_folder = os.listdir(folder_path)
244
+
245
+ # Iterate over each file in the folder
246
+ for file_name in files_in_folder:
247
+ file_path = os.path.join(folder_path, file_name)
248
+
249
+ # Check if the file is not the one to keep and is a regular file
250
+ if file_name != keep_file and os.path.isfile(file_path):
251
+ os.remove(file_path) # Delete the file
252
+
253
+ except Exception as e:
254
+ logging.error(f"An error occurred: {e}")
255
+ raise
256
+
257
+ def check_file(self, file_path: str) -> bool:
258
+ """
259
+ Check if a file exists at the given file path.
260
+
261
+ Parameters:
262
+ file_path (str): The path to the file.
263
+
264
+ Returns:
265
+ bool: True if the file exists, False otherwise.
266
+ """
267
+ try:
268
+ logging.info(f"Check if file exists: {file_path}")
269
+ return os.path.exists(file_path)
270
+
271
+ except Exception as e:
272
+ logging.error(f"An error occurred while checking file existence: {e}")
273
+ return False
274
+
275
+ class InternManager():
276
+
277
+ def format_file_size(self, size_bytes: float) -> str:
278
+ """
279
+ Formats a file size from bytes into a human-readable string representation.
280
+
281
+ Parameters:
282
+ size_bytes (float): Size in bytes to be formatted.
283
+
284
+ Returns:
285
+ str: Formatted string representing the file size with appropriate unit (B, KB, MB, GB, TB).
286
+ """
287
+ if size_bytes <= 0:
288
+ return "0B"
289
+
290
+ units = ['B', 'KB', 'MB', 'GB', 'TB']
291
+ unit_index = 0
292
+
293
+ while size_bytes >= 1024 and unit_index < len(units) - 1:
294
+ size_bytes /= 1024
295
+ unit_index += 1
296
+
297
+ return f"{size_bytes:.2f} {units[unit_index]}"
298
+
299
+ def format_transfer_speed(self, bytes: float) -> str:
300
+ """
301
+ Formats a transfer speed from bytes per second into a human-readable string representation.
302
+
303
+ Parameters:
304
+ bytes (float): Speed in bytes per second to be formatted.
305
+
306
+ Returns:
307
+ str: Formatted string representing the transfer speed with appropriate unit (Bytes/s, KB/s, MB/s).
308
+ """
309
+ if bytes < 1024:
310
+ return f"{bytes:.2f} Bytes/s"
311
+ elif bytes < 1024 * 1024:
312
+ return f"{bytes / 1024:.2f} KB/s"
313
+ else:
314
+ return f"{bytes / (1024 * 1024):.2f} MB/s"
315
+
316
+ @staticmethod
317
+ def check_internet():
318
+ while True:
319
+ try:
320
+ httpx.get("https://www.google.com")
321
+ #console.log("[bold green]Internet is available![/bold green]")
322
+ break
323
+
324
+ except urllib.error.URLError:
325
+ console.log("[bold red]Internet is not available. Waiting...[/bold red]")
326
+ time.sleep(5)
327
+
328
+ print()
329
+
330
+
331
+ class OsSummary:
332
+
333
+ def __init__(self):
334
+ self.ffmpeg_path = None
335
+ self.ffprobe_path = None
336
+ self.ffplay_path = None
337
+
338
+ def get_executable_version(self, command: list):
339
+ """
340
+ Get the version of a given command-line executable.
341
+
342
+ Args:
343
+ command (list): The command to run, e.g., `['ffmpeg', '-version']`.
344
+
345
+ Returns:
346
+ str: The version string of the executable.
347
+ """
348
+ try:
349
+ version_output = subprocess.check_output(command, stderr=subprocess.STDOUT).decode().split('\n')[0]
350
+ return version_output.split(" ")[2]
351
+
352
+ except (FileNotFoundError, subprocess.CalledProcessError):
353
+ console.print(f"{command[0]} not found", style="bold red")
354
+ sys.exit(0)
355
+
356
+ def check_ffmpeg_location(self, command: list):
357
+ """
358
+ Run 'where ffmpeg' command to check FFmpeg's location.
359
+
360
+ Returns:
361
+ str: Location of FFmpeg executable or None if not found
362
+ """
363
+ try:
364
+ result = subprocess.check_output(command, stderr=subprocess.STDOUT, text=True).strip()
365
+ return result
366
+
367
+ except subprocess.CalledProcessError:
368
+ console.print("FFmpeg not found in system PATH", style="bold red")
369
+ sys.exit(0)
370
+
371
+ def get_library_version(self, lib_name: str):
372
+ """
373
+ Retrieve the version of a Python library.
374
+
375
+ Args:
376
+ lib_name (str): The name of the Python library.
377
+
378
+ Returns:
379
+ str: The library name followed by its version, or `-not installed` if not found.
380
+ """
381
+ try:
382
+ version = importlib.metadata.version(lib_name)
383
+ return f"{lib_name}-{version}"
384
+
385
+ except importlib.metadata.PackageNotFoundError:
386
+ return f"{lib_name}-not installed"
387
+
388
+ def download_requirements(self, url: str, filename: str):
389
+ """
390
+ Download the requirements.txt file from the specified URL if not found locally using requests.
391
+
392
+ Args:
393
+ url (str): The URL to download the requirements file from.
394
+ filename (str): The local filename to save the requirements file as.
395
+ """
396
+ try:
397
+ import requests
398
+
399
+ logging.info(f"{filename} not found locally. Downloading from {url}...")
400
+ response = requests.get(url)
401
+
402
+ if response.status_code == 200:
403
+ with open(filename, 'wb') as f:
404
+ f.write(response.content)
405
+
406
+ else:
407
+ logging.error(f"Failed to download {filename}. HTTP Status code: {response.status_code}")
408
+ sys.exit(0)
409
+
410
+ except Exception as e:
411
+ logging.error(f"Failed to download {filename}: {e}")
412
+ sys.exit(0)
413
+
414
+ def install_library(self, lib_name: str):
415
+ """
416
+ Install a Python library using pip.
417
+
418
+ Args:
419
+ lib_name (str): The name of the library to install.
420
+ """
421
+ try:
422
+ console.print(f"Installing {lib_name}...", style="bold yellow")
423
+ subprocess.check_call([sys.executable, "-m", "pip", "install", lib_name])
424
+ console.print(f"{lib_name} installed successfully!", style="bold green")
425
+
426
+ except subprocess.CalledProcessError as e:
427
+ console.print(f"Failed to install {lib_name}: {e}", style="bold red")
428
+ sys.exit(1)
429
+
430
+ def check_python_version(self):
431
+ """
432
+ Check if the installed Python is the official CPython distribution.
433
+ Exits with a message if not the official version.
434
+ """
435
+ python_implementation = platform.python_implementation()
436
+
437
+ if python_implementation != "CPython":
438
+ console.print(f"[bold red]Warning: You are using a non-official Python distribution: {python_implementation}.[/bold red]")
439
+ console.print("Please install the official Python from [bold blue]https://www.python.org[/bold blue] and try again.", style="bold yellow")
440
+ sys.exit(0)
441
+
442
+ def get_system_summary(self):
443
+ """
444
+ Generate a summary of the system environment.
445
+
446
+ Includes:
447
+ - Python version and implementation details.
448
+ - Operating system and architecture.
449
+ - Versions of `ffmpeg` and `ffprobe` executables.
450
+ - Installed Python libraries as listed in `requirements.txt`.
451
+ """
452
+
453
+ # Check if Python is the official CPython
454
+ self.check_python_version()
455
+
456
+ # Check internet connectivity
457
+ InternManager().check_internet()
458
+ console.print("[bold blue]System Summary[/bold blue][white]:")
459
+
460
+ # Python version and platform
461
+ python_version = sys.version.split()[0]
462
+ python_implementation = platform.python_implementation()
463
+ arch = platform.machine()
464
+ os_info = platform.platform()
465
+ glibc_version = 'glibc ' + '.'.join(map(str, platform.libc_ver()[1]))
466
+
467
+ console.print(f"[cyan]Python[white]: [bold red]{python_version} ({python_implementation} {arch}) - {os_info} ({glibc_version})[/bold red]")
468
+ logging.info(f"Python: {python_version} ({python_implementation} {arch}) - {os_info} ({glibc_version})")
469
+
470
+ # Usa il comando 'where' su Windows
471
+ if platform.system() == "Windows":
472
+ command = 'where'
473
+
474
+ # Usa il comando 'which' su Unix/Linux
475
+ else:
476
+ command = 'which'
477
+
478
+ # Locate ffmpeg and ffprobe from path enviroment
479
+ if self.ffmpeg_path != None and "binary" not in self.ffmpeg_path:
480
+ self.ffmpeg_path = self.check_ffmpeg_location([command, 'ffmpeg'])
481
+
482
+ if self.ffprobe_path != None and "binary" not in self.ffprobe_path:
483
+ self.ffprobe_path = self.check_ffmpeg_location([command, 'ffprobe'])
484
+
485
+ # Locate ffmpeg from bin installation
486
+ if self.ffmpeg_path is None or self.ffprobe_path is None:
487
+ self.ffmpeg_path, self.ffprobe_path, self.ffplay_path = check_ffmpeg()
488
+
489
+ if self.ffmpeg_path is None or self.ffprobe_path is None:
490
+ console.log("[red]Cant locate ffmpeg or ffprobe")
491
+ sys.exit(0)
492
+
493
+ ffmpeg_version = self.get_executable_version([self.ffprobe_path, '-version'])
494
+ ffprobe_version = self.get_executable_version([self.ffprobe_path, '-version'])
495
+
496
+ console.print(f"[cyan]Path[white]: [red]ffmpeg [bold yellow]'{self.ffmpeg_path}'[/bold yellow][white], [red]ffprobe '[bold yellow]{self.ffprobe_path}'[/bold yellow]")
497
+ console.print(f"[cyan]Exe versions[white]: [bold red]ffmpeg {ffmpeg_version}, ffprobe {ffprobe_version}[/bold red]")
498
+
499
+ # Check if requirements.txt exists, if not on pyinstaller
500
+ if not getattr(sys, 'frozen', False):
501
+ requirements_file = 'requirements.txt'
502
+
503
+ if not os.path.exists(requirements_file):
504
+ self.download_requirements(
505
+ 'https://raw.githubusercontent.com/Lovi-0/StreamingCommunity/refs/heads/main/requirements.txt',
506
+ requirements_file
507
+ )
508
+
509
+ # Read the optional libraries from the requirements file, get only name without version if "library==1.0.0"
510
+ optional_libraries = [line.strip().split("=")[0] for line in open(requirements_file, 'r', encoding='utf-8-sig')]
511
+
512
+ # Check if libraries are installed and prompt to install missing ones
513
+ for lib in optional_libraries:
514
+ installed_version = self.get_library_version(lib)
515
+
516
+ if 'not installed' in installed_version:
517
+ user_response = msg.ask(f"{lib} is not installed. Do you want to install it? (yes/no)", default="y")
518
+
519
+ if user_response.lower().strip() in ["yes", "y"]:
520
+ self.install_library(lib)
521
+
522
+ else:
523
+ logging.info(f"Library: {installed_version}")
524
+
525
+ console.print(f"[cyan]Libraries[white]: [bold red]{', '.join([self.get_library_version(lib) for lib in optional_libraries])}[/bold red]\n")
526
+ logging.info(f"Libraries: {', '.join([self.get_library_version(lib) for lib in optional_libraries])}")
527
+
528
+
529
+ # OTHER
530
+ os_manager = OsManager()
531
+ internet_manager = InternManager()
532
+ os_summary = OsSummary()
533
+
534
+
535
+ @contextlib.contextmanager
536
+ def suppress_output():
537
+ with contextlib.redirect_stdout(io.StringIO()):
538
+ yield
539
+
540
+ def compute_sha1_hash(input_string: str) -> str:
541
+ """
542
+ Computes the SHA-1 hash of the input string.
543
+
544
+ Parameters:
545
+ - input_string (str): The string to be hashed.
546
+
547
+ Returns:
548
+ str: The SHA-1 hash of the input string.
549
+ """
550
+ # Compute the SHA-1 hash
551
+ hashed_string = hashlib.sha1(input_string.encode()).hexdigest()
552
+
553
+ # Return the hashed string
554
+ return hashed_string