mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-07-19 08:30:05 +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
|
executable: StreamingCommunity_linux_previous
|
||||||
separator: ':'
|
separator: ':'
|
||||||
|
|
||||||
# ARM64 build
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
artifact_name: StreamingCommunity_linux_arm64
|
artifact_name: StreamingCommunity_linux_arm64
|
||||||
executable: StreamingCommunity_linux_arm64
|
executable: StreamingCommunity_linux_arm64
|
||||||
@ -83,7 +82,6 @@ jobs:
|
|||||||
architecture: arm64
|
architecture: arm64
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
# For ARM64, set architecture if present
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
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
|
# Keep console open after download
|
||||||
python test_run.py --not_close true
|
python test_run.py --not_close true
|
||||||
|
|
||||||
# Use global search
|
# Use global searchAdd commentMore actions
|
||||||
python test_run.py --global -s "cars"
|
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
|
# Docker
|
||||||
|
@ -156,7 +156,7 @@ class M3U8Manager:
|
|||||||
If it's a master playlist, only selects video stream.
|
If it's a master playlist, only selects video stream.
|
||||||
"""
|
"""
|
||||||
if not self.is_master:
|
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.audio_streams = []
|
||||||
self.sub_streams = []
|
self.sub_streams = []
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ class M3U8Manager:
|
|||||||
self.video_url, self.video_res = self.parser._video.get_best_uri()
|
self.video_url, self.video_res = self.parser._video.get_best_uri()
|
||||||
elif str(FILTER_CUSTOM_REOLUTION) == "worst":
|
elif str(FILTER_CUSTOM_REOLUTION) == "worst":
|
||||||
self.video_url, self.video_res = self.parser._video.get_worst_uri()
|
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", "")))
|
self.video_url, self.video_res = self.parser._video.get_custom_uri(int(FILTER_CUSTOM_REOLUTION.replace("p", "")))
|
||||||
else:
|
else:
|
||||||
logging.error("Resolution not recognized.")
|
logging.error("Resolution not recognized.")
|
||||||
|
@ -35,7 +35,5 @@ def start_message():
|
|||||||
|
|
||||||
if SHOW:
|
if SHOW:
|
||||||
console.print(f"[purple]{msg}")
|
console.print(f"[purple]{msg}")
|
||||||
|
separator = "_" * (console.width - 2)
|
||||||
# Print a decorative separator line using asterisks
|
|
||||||
separator = "_" * (console.width - 2) # Ridotto di 2 per il padding
|
|
||||||
console.print(f"[cyan]{separator}[/cyan]\n")
|
console.print(f"[cyan]{separator}[/cyan]\n")
|
@ -207,6 +207,13 @@ def main(script_id = 0):
|
|||||||
"torrent": "white"
|
"torrent": "white"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
category_map = {
|
||||||
|
1: "anime",
|
||||||
|
2: "film_&_serie",
|
||||||
|
3: "serie",
|
||||||
|
4: "torrent"
|
||||||
|
}
|
||||||
|
|
||||||
if TELEGRAM_BOT:
|
if TELEGRAM_BOT:
|
||||||
bot = get_bot_instance()
|
bot = get_bot_instance()
|
||||||
bot.send_message(f"Avviato script {script_id}", None)
|
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.'
|
'--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
|
# Add arguments for search functions
|
||||||
parser.add_argument('-s', '--search', default=None, help='Search terms')
|
parser.add_argument('-s', '--search', default=None, help='Search terms')
|
||||||
|
|
||||||
@ -320,30 +332,55 @@ def main(script_id = 0):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
console.print(f"[red]Error mapping module {module_name}: {str(e)}")
|
console.print(f"[red]Error mapping module {module_name}: {str(e)}")
|
||||||
|
|
||||||
# Display the category legend
|
if args.category:
|
||||||
legend_text = " | ".join([f"[{color}]{category.capitalize()}[/{color}]" for category, color in color_map.items()])
|
selected_category = category_map.get(args.category)
|
||||||
console.print(f"\n[bold green]Category Legend:[/bold green] {legend_text}")
|
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
|
if len(category_sites) == 1:
|
||||||
prompt_message = "[green]Insert category [white](" + ", ".join(
|
category = category_sites[0][0]
|
||||||
[f"[{color_map.get(label[1], 'white')}]{key}: {label[0]}[/{color_map.get(label[1], 'white')}]"
|
console.print(f"[green]Selezionato automaticamente: {category_sites[0][1]}[/green]")
|
||||||
|
|
||||||
|
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:
|
||||||
|
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()]
|
for key, label in choice_labels.items()]
|
||||||
) + "[white])"
|
)
|
||||||
|
|
||||||
if TELEGRAM_BOT:
|
if TELEGRAM_BOT:
|
||||||
category_legend_str = "Categorie: \n" + " | ".join([
|
category_legend_str = "Categorie: \n" + " | ".join([
|
||||||
f"{category.capitalize()}" for category in color_map.keys()
|
f"{category.capitalize()}" for category in color_map.keys()
|
||||||
])
|
])
|
||||||
|
|
||||||
prompt_message = "Inserisci il sito:\n" + "\n".join(
|
prompt_message_telegram = "Inserisci il sito:\n" + "\n".join(
|
||||||
[f"{key}: {label[0]}" for key, label in choice_labels.items()]
|
[f"{key}: {label[0]}" for key, label in choice_labels.items()]
|
||||||
)
|
)
|
||||||
|
|
||||||
console.print(f"\n{prompt_message}")
|
console.print(f"\n{prompt_message_telegram}")
|
||||||
|
|
||||||
category = bot.ask(
|
category = bot.ask(
|
||||||
"select_provider",
|
"select_provider",
|
||||||
f"{category_legend_str}\n\n{prompt_message}",
|
f"{category_legend_str}\n\n{prompt_message_telegram}",
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user