mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-07-19 00:20:00 +00:00
Enhance command-line interface: add site specification and search terms support
This commit is contained in:
parent
b5a22aea47
commit
c08de1b1a9
@ -241,6 +241,8 @@ def main(script_id = 0):
|
|||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument("script_id", nargs="?", default="unknown", help="ID dello script")
|
parser.add_argument("script_id", nargs="?", default="unknown", help="ID dello script")
|
||||||
|
parser.add_argument('-s', '--search', default=None, help='Search terms')
|
||||||
|
parser.add_argument('--site', type=str, help='Specify site to search (e.g., streamingcommunity, eurostreaming)')
|
||||||
|
|
||||||
# Add arguments for the main configuration parameters
|
# Add arguments for the main configuration parameters
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -271,13 +273,11 @@ def main(script_id = 0):
|
|||||||
'--global', action='store_true', help='Perform a global search across multiple sites.'
|
'--global', action='store_true', help='Perform a global search across multiple sites.'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add arguments for search functions
|
|
||||||
parser.add_argument('-s', '--search', default=None, help='Search terms')
|
|
||||||
|
|
||||||
# Parse command-line arguments
|
# Parse command-line arguments
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
search_terms = args.search
|
search_terms = args.search
|
||||||
|
specified_site = args.site
|
||||||
|
|
||||||
# Map command-line arguments to the config values
|
# Map command-line arguments to the config values
|
||||||
config_updates = {}
|
config_updates = {}
|
||||||
|
|
||||||
@ -306,6 +306,25 @@ def main(script_id = 0):
|
|||||||
global_search(search_terms)
|
global_search(search_terms)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Modify the site selection logic:
|
||||||
|
if specified_site:
|
||||||
|
# Look for the specified site in the loaded functions
|
||||||
|
site_found = False
|
||||||
|
for alias, (func, use_for) in search_functions.items():
|
||||||
|
module_name = alias.split("_")[0]
|
||||||
|
if module_name.lower() == specified_site.lower():
|
||||||
|
run_function(func, search_terms=search_terms)
|
||||||
|
site_found = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if not site_found:
|
||||||
|
console.print(f"[red]Error: Site '{specified_site}' not found or not supported.")
|
||||||
|
if NOT_CLOSE_CONSOLE:
|
||||||
|
restart_script()
|
||||||
|
else:
|
||||||
|
force_exit()
|
||||||
|
return
|
||||||
|
|
||||||
# Create mappings using module indice
|
# Create mappings using module indice
|
||||||
input_to_function = {}
|
input_to_function = {}
|
||||||
choice_labels = {}
|
choice_labels = {}
|
||||||
|
@ -139,9 +139,9 @@ class RunTab(QTabWidget):
|
|||||||
|
|
||||||
site_index = self.site_combo.currentIndex()
|
site_index = self.site_combo.currentIndex()
|
||||||
if site_index >= 0:
|
if site_index >= 0:
|
||||||
site_text = sites[site_index]["flag"]
|
# Usa il nome completo del sito invece della flag abbreviata
|
||||||
site_name = site_text.split()[0].upper()
|
site_name = sites[site_index]["name"].lower()
|
||||||
args.append(f"-{site_name}")
|
args.extend(["--site", site_name])
|
||||||
|
|
||||||
self.output_text.clear()
|
self.output_text.clear()
|
||||||
print(f"Avvio script con argomenti: {' '.join(args)}")
|
print(f"Avvio script con argomenti: {' '.join(args)}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user