mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 03:55:24 +00:00
Update global_search.py
This commit is contained in:
parent
fbfa63eede
commit
75ba0b1cc1
@ -58,6 +58,9 @@ def load_search_functions():
|
|||||||
# Get 'indice' from the module
|
# Get 'indice' from the module
|
||||||
indice = getattr(mod, 'indice', 0)
|
indice = getattr(mod, 'indice', 0)
|
||||||
use_for = getattr(mod, '_useFor', 'other')
|
use_for = getattr(mod, '_useFor', 'other')
|
||||||
|
priority = getattr(mod, '_priority', 0)
|
||||||
|
|
||||||
|
if priority == 0:
|
||||||
modules.append((module_name, indice, use_for))
|
modules.append((module_name, indice, use_for))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -296,17 +299,26 @@ def process_selected_item(selected_item, search_functions):
|
|||||||
console.print(f"\n[bold green]Processing selection from:[/bold green] {selected_item.get('source')}")
|
console.print(f"\n[bold green]Processing selection from:[/bold green] {selected_item.get('source')}")
|
||||||
|
|
||||||
# Extract necessary information to pass to the site's search function
|
# Extract necessary information to pass to the site's search function
|
||||||
item_id = selected_item.get('id', selected_item.get('media_id'))
|
item_id = None
|
||||||
|
for id_field in ['id', 'media_id', 'ID', 'item_id', 'url']:
|
||||||
|
item_id = selected_item.get(id_field)
|
||||||
|
if item_id:
|
||||||
|
break
|
||||||
|
|
||||||
item_type = selected_item.get('type', selected_item.get('media_type', 'unknown'))
|
item_type = selected_item.get('type', selected_item.get('media_type', 'unknown'))
|
||||||
item_title = selected_item.get('title', selected_item.get('name', 'Unknown'))
|
item_title = selected_item.get('title', selected_item.get('name', 'Unknown'))
|
||||||
|
|
||||||
if item_id:
|
if item_id:
|
||||||
console.print(f"[bold green]Selected item:[/bold green] {item_title} (ID: {item_id}, Type: {item_type})")
|
console.print(f"[bold green]Selected item:[/bold green] {item_title} (ID: {item_id}, Type: {item_type})")
|
||||||
|
|
||||||
# Call the site's search function with direct_item parameter to process download
|
|
||||||
try:
|
try:
|
||||||
func(direct_item=selected_item)
|
func(direct_item=selected_item)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
console.print(f"[bold red]Error processing download:[/bold red] {str(e)}")
|
console.print(f"[bold red]Error processing download:[/bold red] {str(e)}")
|
||||||
|
logging.exception("Download processing error")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
console.print("[bold red]Error: Item ID not found.[/bold red]")
|
console.print("[bold red]Error: Item ID not found. Available fields:[/bold red]")
|
||||||
|
for key in selected_item.keys():
|
||||||
|
console.print(f"[yellow]- {key}: {selected_item[key]}[/yellow]")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user