mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
[UTIL] Remove variable "USE_LARGE_BAR"
This commit is contained in:
parent
06a6865007
commit
dda0f483c9
@ -190,7 +190,7 @@ class M3U8Manager:
|
||||
list_available_resolution = [f"{r[0]}x{r[1]}" for r in tuple_available_resolution]
|
||||
|
||||
console.print(
|
||||
f"[cyan bold]Video →[/cyan bold] [green]Available:[/green] [purple]{', '.join(list_available_resolution)}[/purple] | "
|
||||
f"[cyan bold]Video [/cyan bold] [green]Available:[/green] [purple]{', '.join(list_available_resolution)}[/purple] | "
|
||||
f"[red]Set:[/red] [purple]{FILTER_CUSTOM_REOLUTION}[/purple] | "
|
||||
f"[yellow]Downloadable:[/yellow] [purple]{self.video_res[0]}x{self.video_res[1]}[/purple]"
|
||||
)
|
||||
@ -205,7 +205,7 @@ class M3U8Manager:
|
||||
set_codec_info = available_codec_info if config_manager.get_bool("M3U8_CONVERSION", "use_codec") else "[purple]copy[/purple]"
|
||||
|
||||
console.print(
|
||||
f"[bold cyan]Codec →[/bold cyan] [green]Available:[/green] {available_codec_info} | "
|
||||
f"[bold cyan]Codec [/bold cyan] [green]Available:[/green] {available_codec_info} | "
|
||||
f"[red]Set:[/red] {set_codec_info}"
|
||||
)
|
||||
|
||||
@ -214,7 +214,7 @@ class M3U8Manager:
|
||||
downloadable_sub_languages = list(set(available_sub_languages) & set(DOWNLOAD_SPECIFIC_SUBTITLE))
|
||||
if available_sub_languages:
|
||||
console.print(
|
||||
f"[cyan bold]Subtitle →[/cyan bold] [green]Available:[/green] [purple]{', '.join(available_sub_languages)}[/purple] | "
|
||||
f"[cyan bold]Subtitle [/cyan bold] [green]Available:[/green] [purple]{', '.join(available_sub_languages)}[/purple] | "
|
||||
f"[red]Set:[/red] [purple]{', '.join(DOWNLOAD_SPECIFIC_SUBTITLE)}[/purple] | "
|
||||
f"[yellow]Downloadable:[/yellow] [purple]{', '.join(downloadable_sub_languages)}[/purple]"
|
||||
)
|
||||
@ -224,7 +224,7 @@ class M3U8Manager:
|
||||
downloadable_audio_languages = list(set(available_audio_languages) & set(DOWNLOAD_SPECIFIC_AUDIO))
|
||||
if available_audio_languages:
|
||||
console.print(
|
||||
f"[cyan bold]Audio →[/cyan bold] [green]Available:[/green] [purple]{', '.join(available_audio_languages)}[/purple] | "
|
||||
f"[cyan bold]Audio [/cyan bold] [green]Available:[/green] [purple]{', '.join(available_audio_languages)}[/purple] | "
|
||||
f"[red]Set:[/red] [purple]{', '.join(DOWNLOAD_SPECIFIC_AUDIO)}[/purple] | "
|
||||
f"[yellow]Downloadable:[/yellow] [purple]{', '.join(downloadable_audio_languages)}[/purple]"
|
||||
)
|
||||
|
@ -23,8 +23,7 @@ from rich.console import Console
|
||||
# Internal utilities
|
||||
from StreamingCommunity.Util.color import Colors
|
||||
from StreamingCommunity.Util.headers import get_userAgent
|
||||
from StreamingCommunity.Util.config_json import config_manager
|
||||
from StreamingCommunity.Util.os import os_manager
|
||||
from StreamingCommunity.Util.config_json import config_manager, get_use_large_bar
|
||||
|
||||
|
||||
# Logic class
|
||||
@ -37,7 +36,6 @@ from ...M3U8 import (
|
||||
|
||||
# Config
|
||||
TQDM_DELAY_WORKER = config_manager.get_float('M3U8_DOWNLOAD', 'tqdm_delay')
|
||||
USE_LARGE_BAR = not ("android" in sys.platform or "ios" in sys.platform)
|
||||
REQUEST_MAX_RETRY = config_manager.get_int('REQUESTS', 'max_retry')
|
||||
REQUEST_VERIFY = config_manager.get_int('REQUESTS', 'verify')
|
||||
DEFAULT_VIDEO_WORKERS = config_manager.get_int('M3U8_DOWNLOAD', 'default_video_workser')
|
||||
@ -389,7 +387,7 @@ class M3U8_Segments:
|
||||
"""
|
||||
Generate platform-appropriate progress bar format.
|
||||
"""
|
||||
if not USE_LARGE_BAR:
|
||||
if not get_use_large_bar():
|
||||
return (
|
||||
f"{Colors.YELLOW}Proc{Colors.WHITE}: "
|
||||
f"{Colors.RED}{{percentage:.2f}}% "
|
||||
|
@ -16,7 +16,7 @@ from rich.console import Console
|
||||
# Internal utilities
|
||||
from StreamingCommunity.Util.color import Colors
|
||||
from StreamingCommunity.Util.os import internet_manager
|
||||
from StreamingCommunity.Util.config_json import config_manager
|
||||
from StreamingCommunity.Util.config_json import config_manager, get_use_large_bar
|
||||
|
||||
|
||||
# External libraries
|
||||
@ -32,7 +32,6 @@ PASSWORD = config_manager.get_dict('QBIT_CONFIG', 'pass')
|
||||
|
||||
|
||||
# Variable
|
||||
USE_LARGE_BAR = not ("android" in sys.platform or "ios" in sys.platform)
|
||||
REQUEST_TIMEOUT = config_manager.get_float('REQUESTS', 'timeout')
|
||||
console = Console()
|
||||
|
||||
@ -163,7 +162,7 @@ class TOR_downloader:
|
||||
try:
|
||||
|
||||
# Custom progress bar for mobile and PC
|
||||
if USE_LARGE_BAR:
|
||||
if get_use_large_bar():
|
||||
bar_format = (
|
||||
f"{Colors.YELLOW}[TOR] {Colors.WHITE}({Colors.CYAN}video{Colors.WHITE}): "
|
||||
f"{Colors.RED}{{percentage:.2f}}% {Colors.MAGENTA}{{bar}} {Colors.WHITE}[ "
|
||||
@ -224,7 +223,7 @@ class TOR_downloader:
|
||||
average_internet = average_internet_str
|
||||
average_internet_unit = ""
|
||||
|
||||
if USE_LARGE_BAR:
|
||||
if get_use_large_bar():
|
||||
pbar.set_postfix_str(
|
||||
f"{Colors.WHITE}[ {Colors.GREEN}{downloaded_size} {Colors.WHITE}< {Colors.GREEN}{total_size} {Colors.RED}{total_size_unit} "
|
||||
f"{Colors.WHITE}| {Colors.CYAN}{average_internet} {Colors.RED}{average_internet_unit}"
|
||||
|
@ -61,7 +61,7 @@ def capture_output(process: subprocess.Popen, description: str) -> None:
|
||||
|
||||
|
||||
# Construct the progress string with formatted output information
|
||||
progress_string = (f"→ {description}[white]: "
|
||||
progress_string = (f" {description}[white]: "
|
||||
f"([green]'speed': [yellow]{data.get('speed', 'N/A')}[white], "
|
||||
f"[green]'size': [yellow]{internet_manager.format_file_size(byte_size)}[white])")
|
||||
max_length = max(max_length, len(progress_string))
|
||||
|
@ -11,7 +11,7 @@ from rich.console import Console
|
||||
|
||||
|
||||
# Internal utilities
|
||||
from StreamingCommunity.Util.config_json import config_manager
|
||||
from StreamingCommunity.Util.config_json import config_manager, get_use_large_bar
|
||||
from StreamingCommunity.Util.os import os_manager, suppress_output, get_ffmpeg_path
|
||||
|
||||
|
||||
@ -33,7 +33,6 @@ FFMPEG_DEFAULT_PRESET = config_manager.get("M3U8_CONVERSION", "default_preset")
|
||||
|
||||
|
||||
# Variable
|
||||
USE_LARGE_BAR = not ("android" in sys.platform or "ios" in sys.platform)
|
||||
console = Console()
|
||||
|
||||
|
||||
@ -158,7 +157,7 @@ def join_video(video_path: str, out_path: str, codec: M3U8_Codec = None):
|
||||
subprocess.run(ffmpeg_cmd, check=True)
|
||||
else:
|
||||
|
||||
if USE_LARGE_BAR:
|
||||
if get_use_large_bar():
|
||||
capture_ffmpeg_real_time(ffmpeg_cmd, "[cyan]Join video")
|
||||
print()
|
||||
|
||||
@ -254,7 +253,7 @@ def join_audios(video_path: str, audio_tracks: List[Dict[str, str]], out_path: s
|
||||
subprocess.run(ffmpeg_cmd, check=True)
|
||||
else:
|
||||
|
||||
if USE_LARGE_BAR:
|
||||
if get_use_large_bar():
|
||||
capture_ffmpeg_real_time(ffmpeg_cmd, "[cyan]Join audio")
|
||||
print()
|
||||
|
||||
@ -307,9 +306,9 @@ def join_subtitle(video_path: str, subtitles_list: List[Dict[str, str]], out_pat
|
||||
# Run join
|
||||
if DEBUG_MODE:
|
||||
subprocess.run(ffmpeg_cmd, check=True)
|
||||
else:
|
||||
|
||||
if USE_LARGE_BAR:
|
||||
else:
|
||||
if get_use_large_bar():
|
||||
capture_ffmpeg_real_time(ffmpeg_cmd, "[cyan]Join subtitle")
|
||||
print()
|
||||
|
||||
|
@ -14,13 +14,10 @@ from tqdm import tqdm
|
||||
|
||||
# Internal utilities
|
||||
from StreamingCommunity.Util.color import Colors
|
||||
from StreamingCommunity.Util.config_json import get_use_large_bar
|
||||
from StreamingCommunity.Util.os import internet_manager
|
||||
|
||||
|
||||
# Variable
|
||||
USE_LARGE_BAR = not ("android" in sys.platform or "ios" in sys.platform)
|
||||
|
||||
|
||||
class M3U8_Ts_Estimator:
|
||||
def __init__(self, total_segments: int, segments_instance=None):
|
||||
"""
|
||||
@ -36,7 +33,7 @@ class M3U8_Ts_Estimator:
|
||||
self.lock = threading.Lock()
|
||||
self.speed = {"upload": "N/A", "download": "N/A"}
|
||||
|
||||
if USE_LARGE_BAR:
|
||||
if get_use_large_bar():
|
||||
logging.debug("USE_LARGE_BAR is True, starting speed capture thread")
|
||||
self.speed_thread = threading.Thread(target=self.capture_speed)
|
||||
self.speed_thread.daemon = True
|
||||
@ -110,7 +107,7 @@ class M3U8_Ts_Estimator:
|
||||
number_file_total_size = file_total_size.split(' ')[0]
|
||||
units_file_total_size = file_total_size.split(' ')[1]
|
||||
|
||||
if USE_LARGE_BAR:
|
||||
if get_use_large_bar():
|
||||
speed_data = self.speed['download'].split(" ")
|
||||
|
||||
if len(speed_data) >= 2:
|
||||
@ -122,16 +119,16 @@ class M3U8_Ts_Estimator:
|
||||
|
||||
retry_count = self.segments_instance.active_retries if self.segments_instance else 0
|
||||
progress_str = (
|
||||
f"{Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size}"
|
||||
f"{Colors.GREEN}{number_file_total_size} {Colors.WHITE}< {Colors.RED}{units_file_total_size}"
|
||||
f"{Colors.WHITE} {Colors.CYAN}{average_internet_speed} {Colors.RED}{average_internet_unit}"
|
||||
f"{Colors.WHITE} {Colors.GREEN}CRR {Colors.RED}{retry_count} "
|
||||
f"{Colors.WHITE}, {Colors.GREEN}CRR {Colors.RED}{retry_count} "
|
||||
)
|
||||
|
||||
else:
|
||||
retry_count = self.segments_instance.active_retries if self.segments_instance else 0
|
||||
progress_str = (
|
||||
f"{Colors.GREEN}{number_file_total_size} {Colors.RED}{units_file_total_size}"
|
||||
f"{Colors.WHITE} {Colors.GREEN}CRR {Colors.RED}{retry_count} "
|
||||
f"{Colors.GREEN}{number_file_total_size} {Colors.WHITE}< {Colors.RED}{units_file_total_size}"
|
||||
f"{Colors.WHITE}, {Colors.GREEN}CRR {Colors.RED}{retry_count} "
|
||||
)
|
||||
|
||||
progress_counter.set_postfix_str(progress_str)
|
||||
|
@ -153,7 +153,7 @@ class TheMovieDB:
|
||||
|
||||
# Join with colored arrows and print with proper category label
|
||||
console.print(
|
||||
f"[bold purple]{category}:[/] {' [red]→[/] '.join(colored_items)}"
|
||||
f"[bold purple]{category}:[/] {' [red][/] '.join(colored_items)}"
|
||||
)
|
||||
|
||||
def display_trending_tv_shows(self):
|
||||
|
@ -405,4 +405,17 @@ class ConfigManager:
|
||||
|
||||
|
||||
config_manager = ConfigManager()
|
||||
config_manager.read_config()
|
||||
config_manager.read_config()
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
def get_use_large_bar():
|
||||
"""
|
||||
Determines whether the large bar feature should be enabled.
|
||||
|
||||
Returns:
|
||||
bool: True if running on a PC (Windows, macOS, Linux),
|
||||
False if running on Android or iOS.
|
||||
"""
|
||||
return not any(platform in sys.platform for platform in ("android", "ios"))
|
Loading…
x
Reference in New Issue
Block a user