mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-07-18 16:10:01 +00:00
core: Enhance category selection.
This commit is contained in:
parent
aa6576699d
commit
5527c5d7ed
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -75,7 +75,6 @@ jobs:
|
||||
executable: StreamingCommunity_linux_previous
|
||||
separator: ':'
|
||||
|
||||
# ARM64 build
|
||||
- os: ubuntu-latest
|
||||
artifact_name: StreamingCommunity_linux_arm64
|
||||
executable: StreamingCommunity_linux_arm64
|
||||
@ -83,7 +82,6 @@ jobs:
|
||||
architecture: arm64
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
# For ARM64, set architecture if present
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
@ -697,8 +697,14 @@ python test_run.py --specific_list_audio ita,eng --specific_list_subtitles eng,s
|
||||
# Keep console open after download
|
||||
python test_run.py --not_close true
|
||||
|
||||
# Use global search
|
||||
# Use global searchAdd commentMore actions
|
||||
python test_run.py --global -s "cars"
|
||||
|
||||
# Select specific category
|
||||
python test_run.py --category 1 # Search in anime category
|
||||
python test_run.py --category 2 # Search in movies & series
|
||||
python test_run.py --category 3 # Search in series
|
||||
python test_run.py --category 4 # Search in torrent category
|
||||
```
|
||||
|
||||
# Docker
|
||||
|
@ -156,7 +156,7 @@ class M3U8Manager:
|
||||
If it's a master playlist, only selects video stream.
|
||||
"""
|
||||
if not self.is_master:
|
||||
self.video_url, self.video_res = self.m3u8_url, "0p"
|
||||
self.video_url, self.video_res = self.m3u8_url, "0px"
|
||||
self.audio_streams = []
|
||||
self.sub_streams = []
|
||||
|
||||
@ -165,7 +165,7 @@ class M3U8Manager:
|
||||
self.video_url, self.video_res = self.parser._video.get_best_uri()
|
||||
elif str(FILTER_CUSTOM_REOLUTION) == "worst":
|
||||
self.video_url, self.video_res = self.parser._video.get_worst_uri()
|
||||
elif "p" in str(FILTER_CUSTOM_REOLUTION):
|
||||
elif "px" in str(FILTER_CUSTOM_REOLUTION):
|
||||
self.video_url, self.video_res = self.parser._video.get_custom_uri(int(FILTER_CUSTOM_REOLUTION.replace("p", "")))
|
||||
else:
|
||||
logging.error("Resolution not recognized.")
|
||||
|
@ -35,7 +35,5 @@ def start_message():
|
||||
|
||||
if SHOW:
|
||||
console.print(f"[purple]{msg}")
|
||||
|
||||
# Print a decorative separator line using asterisks
|
||||
separator = "_" * (console.width - 2) # Ridotto di 2 per il padding
|
||||
separator = "_" * (console.width - 2)
|
||||
console.print(f"[cyan]{separator}[/cyan]\n")
|
@ -207,6 +207,13 @@ def main(script_id = 0):
|
||||
"torrent": "white"
|
||||
}
|
||||
|
||||
category_map = {
|
||||
1: "anime",
|
||||
2: "film_&_serie",
|
||||
3: "serie",
|
||||
4: "torrent"
|
||||
}
|
||||
|
||||
if TELEGRAM_BOT:
|
||||
bot = get_bot_instance()
|
||||
bot.send_message(f"Avviato script {script_id}", None)
|
||||
@ -271,6 +278,11 @@ def main(script_id = 0):
|
||||
'--global', action='store_true', help='Perform a global search across multiple sites.'
|
||||
)
|
||||
|
||||
# Add category selection argument
|
||||
parser.add_argument(
|
||||
'--category', type=int, help='Select category directly (1: anime, 2: film_&_serie, 3: serie, 4: torrent).'
|
||||
)
|
||||
|
||||
# Add arguments for search functions
|
||||
parser.add_argument('-s', '--search', default=None, help='Search terms')
|
||||
|
||||
@ -320,35 +332,60 @@ def main(script_id = 0):
|
||||
except Exception as e:
|
||||
console.print(f"[red]Error mapping module {module_name}: {str(e)}")
|
||||
|
||||
# Display the category legend
|
||||
legend_text = " | ".join([f"[{color}]{category.capitalize()}[/{color}]" for category, color in color_map.items()])
|
||||
console.print(f"\n[bold green]Category Legend:[/bold green] {legend_text}")
|
||||
if args.category:
|
||||
selected_category = category_map.get(args.category)
|
||||
category_sites = []
|
||||
for key, label in choice_labels.items():
|
||||
if label[1] == selected_category:
|
||||
category_sites.append((key, label[0]))
|
||||
|
||||
# Construct prompt with proper color mapping
|
||||
prompt_message = "[green]Insert category [white](" + ", ".join(
|
||||
[f"[{color_map.get(label[1], 'white')}]{key}: {label[0]}[/{color_map.get(label[1], 'white')}]"
|
||||
for key, label in choice_labels.items()]
|
||||
) + "[white])"
|
||||
if len(category_sites) == 1:
|
||||
category = category_sites[0][0]
|
||||
console.print(f"[green]Selezionato automaticamente: {category_sites[0][1]}[/green]")
|
||||
|
||||
if TELEGRAM_BOT:
|
||||
category_legend_str = "Categorie: \n" + " | ".join([
|
||||
f"{category.capitalize()}" for category in color_map.keys()
|
||||
])
|
||||
|
||||
prompt_message = "Inserisci il sito:\n" + "\n".join(
|
||||
[f"{key}: {label[0]}" for key, label in choice_labels.items()]
|
||||
)
|
||||
|
||||
console.print(f"\n{prompt_message}")
|
||||
|
||||
category = bot.ask(
|
||||
"select_provider",
|
||||
f"{category_legend_str}\n\n{prompt_message}",
|
||||
None
|
||||
)
|
||||
else:
|
||||
sito_prompt_items = [f"[{color_map.get(selected_category, 'white')}]({k}) {v}[/{color_map.get(selected_category, 'white')}]"
|
||||
for k, v in category_sites]
|
||||
sito_prompt_line = ", ".join(sito_prompt_items)
|
||||
|
||||
if TELEGRAM_BOT:
|
||||
console.print(f"\nInsert site: {sito_prompt_line}")
|
||||
category = bot.ask(
|
||||
"select_site",
|
||||
f"Insert site: {sito_prompt_line}",
|
||||
None
|
||||
)
|
||||
else:
|
||||
category = msg.ask(f"\n[cyan]Insert site: {sito_prompt_line}", choices=[k for k, _ in category_sites], show_choices=False)
|
||||
|
||||
else:
|
||||
category = msg.ask(prompt_message, choices=list(choice_labels.keys()), default="0", show_choices=False, show_default=False)
|
||||
legend_text = " | ".join([f"[{color}]{category.capitalize()}[/{color}]" for category, color in color_map.items()])
|
||||
console.print(f"\n[bold cyan]Category Legend:[/bold cyan] {legend_text}")
|
||||
|
||||
prompt_message = "[cyan]Insert site: " + ", ".join(
|
||||
[f"[{color_map.get(label[1], 'white')}]({key}) {label[0]}[/{color_map.get(label[1], 'white')}]"
|
||||
for key, label in choice_labels.items()]
|
||||
)
|
||||
|
||||
if TELEGRAM_BOT:
|
||||
category_legend_str = "Categorie: \n" + " | ".join([
|
||||
f"{category.capitalize()}" for category in color_map.keys()
|
||||
])
|
||||
|
||||
prompt_message_telegram = "Inserisci il sito:\n" + "\n".join(
|
||||
[f"{key}: {label[0]}" for key, label in choice_labels.items()]
|
||||
)
|
||||
|
||||
console.print(f"\n{prompt_message_telegram}")
|
||||
|
||||
category = bot.ask(
|
||||
"select_provider",
|
||||
f"{category_legend_str}\n\n{prompt_message_telegram}",
|
||||
None
|
||||
)
|
||||
|
||||
else:
|
||||
category = msg.ask(prompt_message, choices=list(choice_labels.keys()), default="0", show_choices=False, show_default=False)
|
||||
|
||||
# Run the corresponding function based on user input
|
||||
if category in input_to_function:
|
||||
@ -372,4 +409,4 @@ def main(script_id = 0):
|
||||
# Delete script_id
|
||||
script_id = TelegramSession.get_session()
|
||||
if script_id != "unknown":
|
||||
TelegramSession.deleteScriptId(script_id)
|
||||
TelegramSession.deleteScriptId(script_id)
|
Loading…
x
Reference in New Issue
Block a user