StreamingCommunity 2.9.4__py3-none-any.whl → 2.9.6__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 (48) hide show
  1. StreamingCommunity/Api/Player/sweetpixel.py +49 -0
  2. StreamingCommunity/Api/Site/1337xx/__init__.py +26 -12
  3. StreamingCommunity/Api/Site/1337xx/site.py +5 -4
  4. StreamingCommunity/Api/Site/1337xx/title.py +4 -6
  5. StreamingCommunity/Api/Site/altadefinizione/__init__.py +64 -17
  6. StreamingCommunity/Api/Site/altadefinizione/film.py +32 -2
  7. StreamingCommunity/Api/Site/altadefinizione/series.py +54 -10
  8. StreamingCommunity/Api/Site/altadefinizione/site.py +25 -7
  9. StreamingCommunity/Api/Site/altadefinizione/util/ScrapeSerie.py +2 -2
  10. StreamingCommunity/Api/Site/animeunity/__init__.py +53 -32
  11. StreamingCommunity/Api/Site/animeunity/film_serie.py +8 -5
  12. StreamingCommunity/Api/Site/animeunity/site.py +4 -6
  13. StreamingCommunity/Api/Site/animeworld/__init__.py +71 -0
  14. StreamingCommunity/Api/Site/animeworld/serie.py +107 -0
  15. StreamingCommunity/Api/Site/animeworld/site.py +111 -0
  16. StreamingCommunity/Api/Site/animeworld/util/ScrapeSerie.py +79 -0
  17. StreamingCommunity/Api/Site/cb01new/__init__.py +26 -14
  18. StreamingCommunity/Api/Site/cb01new/film.py +1 -1
  19. StreamingCommunity/Api/Site/cb01new/site.py +9 -7
  20. StreamingCommunity/Api/Site/ddlstreamitaly/__init__.py +26 -15
  21. StreamingCommunity/Api/Site/ddlstreamitaly/series.py +2 -2
  22. StreamingCommunity/Api/Site/ddlstreamitaly/site.py +3 -3
  23. StreamingCommunity/Api/Site/guardaserie/__init__.py +23 -11
  24. StreamingCommunity/Api/Site/guardaserie/series.py +1 -1
  25. StreamingCommunity/Api/Site/guardaserie/site.py +5 -4
  26. StreamingCommunity/Api/Site/mostraguarda/__init__.py +27 -7
  27. StreamingCommunity/Api/Site/mostraguarda/film.py +1 -1
  28. StreamingCommunity/Api/Site/streamingcommunity/__init__.py +50 -27
  29. StreamingCommunity/Api/Site/streamingcommunity/film.py +1 -1
  30. StreamingCommunity/Api/Site/streamingcommunity/series.py +6 -3
  31. StreamingCommunity/Api/Site/streamingcommunity/site.py +7 -3
  32. StreamingCommunity/Lib/Downloader/HLS/segments.py +2 -4
  33. StreamingCommunity/Lib/Downloader/MP4/downloader.py +7 -6
  34. StreamingCommunity/Lib/Downloader/TOR/downloader.py +397 -227
  35. StreamingCommunity/Lib/FFmpeg/util.py +12 -0
  36. StreamingCommunity/Lib/M3U8/estimator.py +5 -8
  37. StreamingCommunity/Upload/version.py +1 -1
  38. StreamingCommunity/Util/config_json.py +2 -8
  39. StreamingCommunity/Util/table.py +12 -2
  40. StreamingCommunity/global_search.py +315 -0
  41. StreamingCommunity/run.py +39 -5
  42. {streamingcommunity-2.9.4.dist-info → streamingcommunity-2.9.6.dist-info}/METADATA +42 -15
  43. streamingcommunity-2.9.6.dist-info/RECORD +85 -0
  44. {streamingcommunity-2.9.4.dist-info → streamingcommunity-2.9.6.dist-info}/WHEEL +1 -1
  45. streamingcommunity-2.9.4.dist-info/RECORD +0 -79
  46. {streamingcommunity-2.9.4.dist-info → streamingcommunity-2.9.6.dist-info}/entry_points.txt +0 -0
  47. {streamingcommunity-2.9.4.dist-info → streamingcommunity-2.9.6.dist-info/licenses}/LICENSE +0 -0
  48. {streamingcommunity-2.9.4.dist-info → streamingcommunity-2.9.6.dist-info}/top_level.txt +0 -0
@@ -207,6 +207,18 @@ def check_duration_v_a(video_path, audio_path, tolerance=1.0):
207
207
  video_duration = get_video_duration(video_path)
208
208
  audio_duration = get_video_duration(audio_path)
209
209
 
210
+ # Check if either duration is None and specify which one is None
211
+ if video_duration is None and audio_duration is None:
212
+ console.print("[yellow]Warning: Both video and audio durations are None. Returning 0 as duration difference.[/yellow]")
213
+ return False, 0.0
214
+ elif video_duration is None:
215
+ console.print("[yellow]Warning: Video duration is None. Returning 0 as duration difference.[/yellow]")
216
+ return False, 0.0
217
+ elif audio_duration is None:
218
+ console.print("[yellow]Warning: Audio duration is None. Returning 0 as duration difference.[/yellow]")
219
+ return False, 0.0
220
+
221
+ # Calculate the duration difference
210
222
  duration_difference = abs(video_duration - audio_duration)
211
223
 
212
224
  # Check if the duration difference is within the tolerance
@@ -27,7 +27,6 @@ class M3U8_Ts_Estimator:
27
27
  - total_segments (int): Length of total segments to download.
28
28
  """
29
29
  self.ts_file_sizes = []
30
- self.now_downloaded_size = 0
31
30
  self.total_segments = total_segments
32
31
  self.segments_instance = segments_instance
33
32
  self.lock = threading.Lock()
@@ -42,15 +41,13 @@ class M3U8_Ts_Estimator:
42
41
  else:
43
42
  logging.debug("USE_LARGE_BAR is False, speed capture thread not started")
44
43
 
45
- def add_ts_file(self, size: int, size_download: int, duration: float):
44
+ def add_ts_file(self, size: int):
46
45
  """Add a file size to the list of file sizes."""
47
- if size <= 0 or size_download <= 0 or duration <= 0:
48
- logging.error(f"Invalid input values: size={size}, size_download={size_download}, duration={duration}")
46
+ if size <= 0:
47
+ logging.error(f"Invalid input values: size={size}")
49
48
  return
50
49
 
51
50
  self.ts_file_sizes.append(size)
52
- self.now_downloaded_size += size_download
53
- logging.debug(f"Current total downloaded size: {self.now_downloaded_size}")
54
51
 
55
52
  def capture_speed(self, interval: float = 1.5):
56
53
  """Capture the internet speed periodically."""
@@ -99,9 +96,9 @@ class M3U8_Ts_Estimator:
99
96
  logging.error("An unexpected error occurred: %s", e)
100
97
  return "Error"
101
98
 
102
- def update_progress_bar(self, total_downloaded: int, duration: float, progress_counter: tqdm) -> None:
99
+ def update_progress_bar(self, total_downloaded: int, progress_counter: tqdm) -> None:
103
100
  try:
104
- self.add_ts_file(total_downloaded * self.total_segments, total_downloaded, duration)
101
+ self.add_ts_file(total_downloaded * self.total_segments)
105
102
 
106
103
  file_total_size = self.calculate_total_size()
107
104
  number_file_total_size = file_total_size.split(' ')[0]
@@ -1,5 +1,5 @@
1
1
  __title__ = 'StreamingCommunity'
2
- __version__ = '2.9.4'
2
+ __version__ = '2.9.6'
3
3
  __author__ = 'Arrowar'
4
4
  __description__ = 'A command-line program to download film'
5
5
  __copyright__ = 'Copyright 2024'
@@ -196,6 +196,7 @@ class ConfigManager:
196
196
  except Exception as e:
197
197
  logging.error(f"Error reading configuration file: {e}")
198
198
  console.print(f"[bold red]Failed to read configuration:[/bold red] {str(e)}")
199
+ sys.exit(0)
199
200
 
200
201
  def download_requirements(self, url: str, filename: str) -> None:
201
202
  """
@@ -255,14 +256,7 @@ class ConfigManager:
255
256
  sites_info = []
256
257
  for site, info in examples:
257
258
  sites_info.append(f"[cyan]{site}[/cyan]: {info.get('full_url', 'N/A')}")
258
-
259
- console.print("[bold cyan]Sample sites:[/bold cyan]")
260
- for info in sites_info:
261
- console.print(f" {info}")
262
-
263
- if site_count > 3:
264
- console.print(f" ... and {site_count - 3} more")
265
-
259
+
266
260
  else:
267
261
  console.print("[bold yellow]API returned empty data set[/bold yellow]")
268
262
  else:
@@ -147,9 +147,14 @@ class TVShowManager:
147
147
  if not force_int_input:
148
148
  prompt_msg = ("\n[cyan]Insert media index [yellow](e.g., 1), [red]* [cyan]to download all media, "
149
149
  "[yellow](e.g., 1-2) [cyan]for a range of media, or [yellow](e.g., 3-*) [cyan]to download from a specific index to the end")
150
+ telegram_msg = "Menu di selezione degli episodi: \n\n" \
151
+ "- Inserisci il numero dell'episodio (ad esempio, 1)\n" \
152
+ "- Inserisci * per scaricare tutti gli episodi\n" \
153
+ "- Inserisci un intervallo di episodi (ad esempio, 1-2) per scaricare da un episodio all'altro\n" \
154
+ "- Inserisci (ad esempio, 3-*) per scaricare dall'episodio specificato fino alla fine della serie"
150
155
 
151
156
  if is_telegram:
152
- key = bot.ask("select_title_episode", prompt_msg, None)
157
+ key = bot.ask("select_title_episode", telegram_msg, None)
153
158
  else:
154
159
  key = Prompt.ask(prompt_msg)
155
160
  else:
@@ -183,9 +188,14 @@ class TVShowManager:
183
188
  if not force_int_input:
184
189
  prompt_msg = ("\n[cyan]Insert media index [yellow](e.g., 1), [red]* [cyan]to download all media, "
185
190
  "[yellow](e.g., 1-2) [cyan]for a range of media, or [yellow](e.g., 3-*) [cyan]to download from a specific index to the end")
191
+ telegram_msg = "Menu di selezione degli episodi: \n\n" \
192
+ "- Inserisci il numero dell'episodio (ad esempio, 1)\n" \
193
+ "- Inserisci * per scaricare tutti gli episodi\n" \
194
+ "- Inserisci un intervallo di episodi (ad esempio, 1-2) per scaricare da un episodio all'altro\n" \
195
+ "- Inserisci (ad esempio, 3-*) per scaricare dall'episodio specificato fino alla fine della serie"
186
196
 
187
197
  if is_telegram:
188
- key = bot.ask("select_title_episode", prompt_msg, None)
198
+ key = bot.ask("select_title_episode", telegram_msg, None)
189
199
  else:
190
200
  key = Prompt.ask(prompt_msg)
191
201
  else:
@@ -0,0 +1,315 @@
1
+ # 17.03.25
2
+
3
+ import os
4
+ import sys
5
+ import time
6
+ import glob
7
+ import logging
8
+ import importlib
9
+
10
+
11
+ # External library
12
+ from rich.console import Console
13
+ from rich.prompt import Prompt
14
+ from rich.table import Table
15
+ from rich.progress import Progress
16
+
17
+
18
+ # Internal utilities
19
+ from StreamingCommunity.Util.message import start_message
20
+
21
+
22
+ # Variable
23
+ console = Console()
24
+ msg = Prompt()
25
+
26
+
27
+ # !!! DA METTERE IN COMUNE CON QUELLA DI RUN
28
+ def load_search_functions():
29
+ modules = []
30
+ loaded_functions = {}
31
+ excluded_sites = set()
32
+
33
+ # Find api home directory
34
+ if getattr(sys, 'frozen', False): # Modalità PyInstaller
35
+ base_path = os.path.join(sys._MEIPASS, "StreamingCommunity")
36
+ else:
37
+ base_path = os.path.dirname(__file__)
38
+
39
+ api_dir = os.path.join(base_path, 'Api', 'Site')
40
+ init_files = glob.glob(os.path.join(api_dir, '*', '__init__.py'))
41
+
42
+ # Retrieve modules and their indices
43
+ for init_file in init_files:
44
+
45
+ # Get folder name as module name
46
+ module_name = os.path.basename(os.path.dirname(init_file))
47
+
48
+ # Se il modulo è nella lista da escludere, saltalo
49
+ if module_name in excluded_sites:
50
+ continue
51
+
52
+ logging.info(f"Load module name: {module_name}")
53
+
54
+ try:
55
+ # Dynamically import the module
56
+ mod = importlib.import_module(f'StreamingCommunity.Api.Site.{module_name}')
57
+
58
+ # Get 'indice' from the module
59
+ indice = getattr(mod, 'indice', 0)
60
+ is_deprecate = bool(getattr(mod, '_deprecate', True))
61
+ use_for = getattr(mod, '_useFor', 'other')
62
+
63
+ if not is_deprecate:
64
+ modules.append((module_name, indice, use_for))
65
+
66
+ except Exception as e:
67
+ console.print(f"[red]Failed to import module {module_name}: {str(e)}")
68
+
69
+ # Sort modules by 'indice'
70
+ modules.sort(key=lambda x: x[1])
71
+
72
+ # Load search functions in the sorted order
73
+ for module_name, _, use_for in modules:
74
+
75
+ # Construct a unique alias for the module
76
+ module_alias = f'{module_name}_search'
77
+
78
+ try:
79
+
80
+ # Dynamically import the module
81
+ mod = importlib.import_module(f'StreamingCommunity.Api.Site.{module_name}')
82
+
83
+ # Get the search function from the module (assuming the function is named 'search' and defined in __init__.py)
84
+ search_function = getattr(mod, 'search')
85
+
86
+ # Add the function to the loaded functions dictionary
87
+ loaded_functions[module_alias] = (search_function, use_for)
88
+
89
+ except Exception as e:
90
+ console.print(f"[red]Failed to load search function from module {module_name}: {str(e)}")
91
+
92
+ return loaded_functions
93
+
94
+ def global_search(search_terms: str = None, selected_sites: list = None):
95
+ """
96
+ Perform a search across multiple sites based on selection.
97
+
98
+ Parameters:
99
+ search_terms (str, optional): The terms to search for. If None, will prompt the user.
100
+ selected_sites (list, optional): List of site aliases to search. If None, will search all sites.
101
+
102
+ Returns:
103
+ dict: Consolidated search results from all searched sites.
104
+ """
105
+ search_functions = load_search_functions()
106
+ all_results = {}
107
+
108
+ if search_terms is None:
109
+ search_terms = msg.ask("\n[purple]Enter search terms for global search: ").strip()
110
+
111
+ # Organize sites by category for better display
112
+ sites_by_category = {}
113
+ for alias, (func, category) in search_functions.items():
114
+ if category not in sites_by_category:
115
+ sites_by_category[category] = []
116
+ sites_by_category[category].append((alias, func))
117
+
118
+ # If no sites are specifically selected, prompt the user
119
+ if selected_sites is None:
120
+ console.print("\n[bold green]Select sites to search:[/bold green]")
121
+ console.print("[bold cyan]1.[/bold cyan] Search all sites")
122
+ console.print("[bold cyan]2.[/bold cyan] Search by category")
123
+ console.print("[bold cyan]3.[/bold cyan] Select specific sites")
124
+
125
+ choice = msg.ask("[green]Enter your choice (1-3)", choices=["1", "2", "3"], default="1")
126
+
127
+ if choice == "1":
128
+ # Search all sites
129
+ selected_sites = list(search_functions.keys())
130
+
131
+ elif choice == "2":
132
+ # Search by category
133
+ console.print("\n[bold green]Select categories to search:[/bold green]")
134
+ for i, category in enumerate(sites_by_category.keys(), 1):
135
+ console.print(f"[bold cyan]{i}.[/bold cyan] {category.capitalize()}")
136
+
137
+ category_choices = msg.ask("[green]Enter category numbers separated by commas", default="1")
138
+ selected_categories = [list(sites_by_category.keys())[int(c.strip())-1] for c in category_choices.split(",")]
139
+
140
+ selected_sites = []
141
+ for category in selected_categories:
142
+ for alias, _ in sites_by_category.get(category, []):
143
+ selected_sites.append(alias)
144
+
145
+ else:
146
+ # Select specific sites
147
+ console.print("\n[bold green]Select specific sites to search:[/bold green]")
148
+
149
+ for i, (alias, _) in enumerate(search_functions.items(), 1):
150
+ site_name = alias.split("_")[0].capitalize()
151
+ console.print(f"[bold cyan]{i}.[/bold cyan] {site_name}")
152
+
153
+ site_choices = msg.ask("[green]Enter site numbers separated by commas", default="1")
154
+ selected_indices = [int(c.strip())-1 for c in site_choices.split(",")]
155
+ selected_sites = [list(search_functions.keys())[i] for i in selected_indices if i < len(search_functions)]
156
+
157
+ # Display progress information
158
+ console.print(f"\n[bold green]Searching for:[/bold green] [yellow]{search_terms}[/yellow]")
159
+ console.print(f"[bold green]Searching across:[/bold green] {len(selected_sites)} sites")
160
+
161
+ with Progress() as progress:
162
+ search_task = progress.add_task("[cyan]Searching...", total=len(selected_sites))
163
+
164
+ # Search each selected site
165
+ for alias in selected_sites:
166
+ site_name = alias.split("_")[0].capitalize()
167
+ progress.update(search_task, description=f"[cyan]Searching {site_name}...")
168
+
169
+ func, _ = search_functions[alias]
170
+ try:
171
+ # Call the search function with get_onlyDatabase=True to get database object
172
+ database = func(search_terms, get_onlyDatabase=True)
173
+
174
+ # Check if database has media_list attribute and it's not empty
175
+ if database and hasattr(database, 'media_list') and len(database.media_list) > 0:
176
+ # Store media_list items with additional source information
177
+ all_results[alias] = []
178
+ for element in database.media_list:
179
+ # Convert element to dictionary if it's an object
180
+ if hasattr(element, '__dict__'):
181
+ item_dict = element.__dict__.copy()
182
+ else:
183
+ item_dict = {} # Fallback for non-object items
184
+
185
+ # Add source information
186
+ item_dict['source'] = site_name
187
+ item_dict['source_alias'] = alias
188
+ all_results[alias].append(item_dict)
189
+
190
+ console.print(f"[green]Found {len(database.media_list)} results from {site_name}")
191
+
192
+ except Exception as e:
193
+ console.print(f"[bold red]Error searching {site_name}:[/bold red] {str(e)}")
194
+
195
+ progress.update(search_task, advance=1)
196
+
197
+ # Display the consolidated results
198
+ if all_results:
199
+ all_media_items = []
200
+ for alias, results in all_results.items():
201
+ for item in results:
202
+ all_media_items.append(item)
203
+
204
+ # Display consolidated results
205
+ display_consolidated_results(all_media_items, search_terms)
206
+
207
+ # Allow user to select an item
208
+ selected_item = select_from_consolidated_results(all_media_items)
209
+ if selected_item:
210
+ # Process the selected item - download or further actions
211
+ process_selected_item(selected_item, search_functions)
212
+
213
+ else:
214
+ console.print(f"\n[bold red]No results found for:[/bold red] [yellow]{search_terms}[/yellow]")
215
+
216
+ # Optionally offer to search again or return to main menu
217
+ if msg.ask("[green]Search again? (y/n)", choices=["y", "n"], default="y") == "y":
218
+ global_search()
219
+
220
+ return all_results
221
+
222
+ def display_consolidated_results(all_media_items, search_terms):
223
+ """
224
+ Display consolidated search results from multiple sites.
225
+
226
+ Parameters:
227
+ all_media_items (list): List of media items from all searched sites.
228
+ search_terms (str): The search terms used.
229
+ """
230
+ time.sleep(1)
231
+ start_message()
232
+
233
+ console.print(f"\n[bold green]Search results for:[/bold green] [yellow]{search_terms}[/yellow] \n")
234
+
235
+ table = Table(show_header=True, header_style="bold cyan")
236
+ table.add_column("#", style="dim", width=4)
237
+ table.add_column("Title", min_width=20)
238
+ table.add_column("Type", width=15)
239
+ table.add_column("Source", width=25)
240
+
241
+ for i, item in enumerate(all_media_items, 1):
242
+
243
+ # Extract values from item dict, with fallbacks if keys don't exist
244
+ title = item.get('title', item.get('name', 'Unknown'))
245
+ media_type = item.get('type', item.get('media_type', 'Unknown'))
246
+ source = item.get('source', 'Unknown')
247
+
248
+ table.add_row(
249
+ str(i),
250
+ str(title),
251
+ str(media_type),
252
+ str(source),
253
+ )
254
+
255
+ console.print(table)
256
+
257
+ def select_from_consolidated_results(all_media_items):
258
+ """
259
+ Allow user to select an item from consolidated results.
260
+
261
+ Parameters:
262
+ all_media_items (list): List of media items from all searched sites.
263
+
264
+ Returns:
265
+ dict: The selected media item or None if no selection was made.
266
+ """
267
+ if not all_media_items:
268
+ return None
269
+
270
+ max_index = len(all_media_items)
271
+ choice = msg.ask(
272
+ f"[green]Select item # (1-{max_index}) or 0 to cancel",
273
+ choices=[str(i) for i in range(max_index + 1)],
274
+ default="1",
275
+ show_choices=False
276
+ )
277
+
278
+ if choice == "0":
279
+ return None
280
+
281
+ return all_media_items[int(choice) - 1]
282
+
283
+ def process_selected_item(selected_item, search_functions):
284
+ """
285
+ Process the selected item - download the media using the appropriate site API.
286
+
287
+ Parameters:
288
+ selected_item (dict): The selected media item.
289
+ search_functions (dict): Dictionary of search functions by alias.
290
+ """
291
+ source_alias = selected_item.get('source_alias')
292
+ if not source_alias or source_alias not in search_functions:
293
+ console.print("[bold red]Error: Cannot process this item - source information missing.[/bold red]")
294
+ return
295
+
296
+ # Get the appropriate search function for this source
297
+ func, _ = search_functions[source_alias]
298
+
299
+ console.print(f"\n[bold green]Processing selection from:[/bold green] {selected_item.get('source')}")
300
+
301
+ # Extract necessary information to pass to the site's search function
302
+ item_id = selected_item.get('id', selected_item.get('media_id'))
303
+ item_type = selected_item.get('type', selected_item.get('media_type', 'unknown'))
304
+ item_title = selected_item.get('title', selected_item.get('name', 'Unknown'))
305
+
306
+ if item_id:
307
+ console.print(f"[bold green]Selected item:[/bold green] {item_title} (ID: {item_id}, Type: {item_type})")
308
+
309
+ # Call the site's search function with direct_item parameter to process download
310
+ try:
311
+ func(direct_item=selected_item)
312
+ except Exception as e:
313
+ console.print(f"[bold red]Error processing download:[/bold red] {str(e)}")
314
+ else:
315
+ console.print("[bold red]Error: Item ID not found.[/bold red]")
StreamingCommunity/run.py CHANGED
@@ -18,6 +18,7 @@ from rich.prompt import Prompt
18
18
 
19
19
 
20
20
  # Internal utilities
21
+ from .global_search import global_search
21
22
  from StreamingCommunity.Util.message import start_message
22
23
  from StreamingCommunity.Util.config_json import config_manager
23
24
  from StreamingCommunity.Util.os import os_summary
@@ -54,6 +55,7 @@ def run_function(func: Callable[..., None], close_console: bool = False, search_
54
55
  func(search_terms)
55
56
 
56
57
 
58
+ # !!! DA METTERE IN COMUNE CON QUELLA DI GLOBAL
57
59
  def load_search_functions():
58
60
  modules = []
59
61
  loaded_functions = {}
@@ -141,7 +143,7 @@ def initialize():
141
143
  sys.exit(0)
142
144
 
143
145
  # Trending tmbd
144
- if SHOW_TRENDING:
146
+ """if SHOW_TRENDING:
145
147
  print()
146
148
  tmdb.display_trending_films()
147
149
  tmdb.display_trending_tv_shows()
@@ -150,7 +152,7 @@ def initialize():
150
152
  try:
151
153
  git_update()
152
154
  except:
153
- console.log("[red]Error with loading github.")
155
+ console.log("[red]Error with loading github.")"""
154
156
 
155
157
  def restart_script():
156
158
  """Riavvia lo script con gli stessi argomenti della riga di comando."""
@@ -237,6 +239,11 @@ def main(script_id = 0):
237
239
  '--specific_list_subtitles', type=str, help='Comma-separated list of specific subtitle languages to download (e.g., eng,spa).'
238
240
  )
239
241
 
242
+ # Add global search option
243
+ parser.add_argument(
244
+ '--global', action='store_true', help='Perform a global search across multiple sites.'
245
+ )
246
+
240
247
  # Add arguments for search functions
241
248
  color_map = {
242
249
  "anime": "red",
@@ -247,12 +254,23 @@ def main(script_id = 0):
247
254
  }
248
255
 
249
256
  # Add dynamic arguments based on loaded search modules
257
+ used_short_options = set()
258
+
250
259
  for alias, (_, use_for) in search_functions.items():
251
260
  short_option = alias[:3].upper()
261
+
262
+ original_short_option = short_option
263
+ count = 1
264
+ while short_option in used_short_options:
265
+ short_option = f"{original_short_option}{count}"
266
+ count += 1
267
+
268
+ used_short_options.add(short_option)
252
269
  long_option = alias
253
270
  parser.add_argument(f'-{short_option}', f'--{long_option}', action='store_true', help=f'Search for {alias.split("_")[0]} on streaming platforms.')
254
271
 
255
272
  parser.add_argument('-s', '--search', default=None, help='Search terms')
273
+
256
274
  # Parse command-line arguments
257
275
  args = parser.parse_args()
258
276
 
@@ -280,6 +298,11 @@ def main(script_id = 0):
280
298
 
281
299
  config_manager.write_config()
282
300
 
301
+ # Check if global search is requested
302
+ if getattr(args, 'global'):
303
+ global_search(search_terms)
304
+ return
305
+
283
306
  # Map command-line arguments to functions
284
307
  arg_to_function = {alias: func for alias, (func, _) in search_functions.items()}
285
308
 
@@ -295,13 +318,18 @@ def main(script_id = 0):
295
318
  # Create dynamic prompt message and choices
296
319
  choice_labels = {str(i): (alias.split("_")[0].capitalize(), use_for) for i, (alias, (_, use_for)) in enumerate(search_functions.items())}
297
320
 
321
+ # Add global search option to the menu
322
+ #global_search_key = str(len(choice_labels))
323
+ #choice_labels[global_search_key] = ("Global Search", "all")
324
+ #input_to_function[global_search_key] = global_search
325
+
298
326
  # Display the category legend in a single line
299
327
  legend_text = " | ".join([f"[{color}]{category.capitalize()}[/{color}]" for category, color in color_map.items()])
300
328
  console.print(f"\n[bold green]Category Legend:[/bold green] {legend_text}")
301
329
 
302
330
  # Construct the prompt message with color-coded site names
303
331
  prompt_message = "[green]Insert category [white](" + ", ".join(
304
- [f"{key}: [{color_map[label[1]]}]{label[0]}[/{color_map[label[1]]}]" for key, label in choice_labels.items()]
332
+ [f"{key}: [{color_map.get(label[1], 'white')}]{label[0]}[/{color_map.get(label[1], 'white')}]" for key, label in choice_labels.items()]
305
333
  ) + "[white])"
306
334
 
307
335
  if TELEGRAM_BOT:
@@ -330,10 +358,16 @@ def main(script_id = 0):
330
358
 
331
359
  # Run the corresponding function based on user input
332
360
  if category in input_to_function:
333
- run_function(input_to_function[category], search_terms = args.search)
361
+ """if category == global_search_key:
362
+ # Run global search
363
+ run_function(input_to_function[category], search_terms=search_terms)
364
+
365
+ else:"""
366
+
367
+ # Run normal site-specific search
368
+ run_function(input_to_function[category], search_terms=search_terms)
334
369
 
335
370
  else:
336
-
337
371
  if TELEGRAM_BOT:
338
372
  bot.send_message(f"Categoria non valida", None)
339
373
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: StreamingCommunity
3
- Version: 2.9.4
3
+ Version: 2.9.6
4
4
  Home-page: https://github.com/Lovi-0/StreamingCommunity
5
5
  Author: Lovi-0
6
6
  Project-URL: Bug Reports, https://github.com/Lovi-0/StreamingCommunity/issues
@@ -28,6 +28,7 @@ Dynamic: description
28
28
  Dynamic: description-content-type
29
29
  Dynamic: home-page
30
30
  Dynamic: keywords
31
+ Dynamic: license-file
31
32
  Dynamic: project-url
32
33
  Dynamic: requires-dist
33
34
  Dynamic: requires-python
@@ -79,6 +80,7 @@ Dynamic: requires-python
79
80
  - 📥 [Download](#m3u8_download-settings)
80
81
  - 🔍 [Parser](#m3u8_parser-settings)
81
82
  - 📝 [Command](#command)
83
+ - 🔍 [Global search](#global-search)
82
84
  - 💻 [Examples of terminal](#examples-of-terminal-usage)
83
85
  - 🔧 [Manual domain configuration](#update-domains)
84
86
  - 🐳 [Docker](#docker)
@@ -198,13 +200,10 @@ from StreamingCommunity.Download import TOR_downloader
198
200
  client = TOR_downloader()
199
201
 
200
202
  # Add magnet link
201
- client.add_magnet_link("magnet:?xt=urn:btih:example_hash&dn=example_name")
203
+ client.add_magnet_link("magnet:?xt=urn:btih:example_hash&dn=example_name", save_path=".")
202
204
 
203
205
  # Start download
204
206
  client.start_download()
205
-
206
- # Move downloaded files to specific location
207
- client.move_downloaded_files("/downloads/torrents/")
208
207
  ```
209
208
 
210
209
  See [Torrent example](./Test/Download/TOR.py) for complete usage.
@@ -668,19 +667,44 @@ The API-based domain updates are currently deprecated. To use it anyway, set `us
668
667
 
669
668
  Note: If `use_api` is set to `false` and no `domains.json` file is found, the script will raise an error.
670
669
 
671
- # COMMAND
670
+ #### 💡 Adding a New Site to the Legacy API
671
+ If you want to add a new site to the legacy API, just message me on the Discord server, and I'll add it!
672
+
673
+ # Global Search
674
+
675
+ You can now search across multiple streaming sites at once using the Global Search feature. This allows you to find content more efficiently without having to search each site individually.
676
+
677
+ ## Using Global Search
678
+
679
+ The Global Search feature provides a unified interface to search across all supported sites:
680
+
681
+ ## Search Options
682
+
683
+ When using Global Search, you have three ways to select which sites to search:
672
684
 
673
- - Download a specific season by entering its number.
674
- * **Example:** `1` will download *Season 1* only.
685
+ 1. **Search all sites** - Searches across all available streaming sites
686
+ 2. **Search by category** - Group sites by their categories (movies, series, anime, etc.)
687
+ 3. **Select specific sites** - Choose individual sites to include in your search
675
688
 
676
- - Use the wildcard `*` to download every available season.
677
- * **Example:** `*` will download all seasons in the series.
689
+ ## Navigation and Selection
678
690
 
679
- - Specify a range of seasons using a hyphen `-`.
680
- * **Example:** `1-2` will download *Seasons 1 and 2*.
691
+ After performing a search:
681
692
 
682
- - Enter a season number followed by `-*` to download from that season to the end.
683
- * **Example:** `3-*` will download from *Season 3* to the final season.
693
+ 1. Results are displayed in a consolidated table showing:
694
+ - Title
695
+ - Media type (movie, TV series, etc.)
696
+ - Source site
697
+
698
+ 2. Select an item by number to view details or download
699
+
700
+ 3. The system will automatically use the appropriate site's API to handle the download
701
+
702
+ ## Command Line Arguments
703
+
704
+ The Global Search can be configured from the command line:
705
+
706
+ - `--global` - Perform a global search across multiple sites.
707
+ - `-s`, `--search` - Specify the search terms.
684
708
 
685
709
  # Examples of terminal usage
686
710
 
@@ -693,6 +717,9 @@ python test_run.py --specific_list_audio ita,eng --specific_list_subtitles eng,s
693
717
 
694
718
  # Keep console open after download
695
719
  python test_run.py --not_close true
720
+
721
+ # Use global search
722
+ python test_run.py --global -s "cars"
696
723
  ```
697
724
 
698
725
  # Docker