diff --git a/StreamingCommunity/Lib/Downloader/HLS/downloader.py b/StreamingCommunity/Lib/Downloader/HLS/downloader.py index d83abe2..174981e 100644 --- a/StreamingCommunity/Lib/Downloader/HLS/downloader.py +++ b/StreamingCommunity/Lib/Downloader/HLS/downloader.py @@ -176,7 +176,7 @@ class ContentExtractor: set_language = DOWNLOAD_SPECIFIC_AUDIO downloadable_languages = list(set(available_languages) & set(set_language)) - console.print(f"[cyan bold]Audio:[/cyan bold] [green]Available:[/green] [purple]{', '.join(available_languages)}[/purple] | " + console.print(f"[cyan bold]Audio →[/cyan bold] [green]Available:[/green] [purple]{', '.join(available_languages)}[/purple] | " f"[red]Set:[/red] [purple]{', '.join(set_language)}[/purple] | " f"[yellow]Downloadable:[/yellow] [purple]{', '.join(downloadable_languages)}[/purple]") @@ -200,7 +200,7 @@ class ContentExtractor: set_language = DOWNLOAD_SPECIFIC_SUBTITLE downloadable_languages = list(set(available_languages) & set(set_language)) - console.print(f"[cyan bold]Subtitle:[/cyan bold] [green]Available:[/green] [purple]{', '.join(available_languages)}[/purple] | " + console.print(f"[cyan bold]Subtitle →[/cyan bold] [green]Available:[/green] [purple]{', '.join(available_languages)}[/purple] | " f"[red]Set:[/red] [purple]{', '.join(set_language)}[/purple] | " f"[yellow]Downloadable:[/yellow] [purple]{', '.join(downloadable_languages)}[/purple]") @@ -227,7 +227,7 @@ class ContentExtractor: logging.info(f"M3U8 index selected: {self.m3u8_index}, with resolution: {video_res}") # Create a formatted table to display video info - console.print(f"[cyan bold]Video:[/cyan bold] [green]Available resolutions:[/green] [purple]{', '.join(list_available_resolution)}[/purple] | " + console.print(f"[cyan bold]Video →[/cyan bold] [green]Available resolutions:[/green] [purple]{', '.join(list_available_resolution)}[/purple] | " f"[yellow]Downloadable:[/yellow] [purple]{video_res[0]}x{video_res[1]}[/purple]") if self.codec is not None: @@ -238,7 +238,8 @@ class ContentExtractor: f"([green]b[/green]: [yellow]{self.codec.audio_bitrate // 1000}k[/yellow])") else: codec_info = "[cyan]copy[/cyan]" - console.print(f"[bold green]Codec:[/bold green] {codec_info}") + + console.print(f"[bold cyan]Codec →[/bold cyan] {codec_info}") # Fix the URL if it does not include the full protocol if "http" not in self.m3u8_index: @@ -486,19 +487,6 @@ class ContentJoiner: self.there_is_audio = len(downloaded_audio) > 0 self.there_is_subtitle = len(downloaded_subtitle) > 0 - if self.there_is_audio or self.there_is_subtitle: - - # Display the status of available media - table = Table(show_header=False, box=None) - - table.add_row(f"[green]Video - audio", f"[yellow]{self.there_is_audio}") - table.add_row(f"[green]Video - Subtitle", f"[yellow]{self.there_is_subtitle}") - - print("") - console.rule("[bold green] JOIN ", style="bold red") - console.print(table) - print("") - # Start the joining process self.conversione() @@ -584,10 +572,6 @@ class ContentJoiner: # Check if the joined video file already exists if not os.path.exists(path_join_video): - # Set codec to None if not defined in class - #if not hasattr(self, 'codec'): - # self.codec = None - # Join the video segments into a single video file join_video( video_path=self.downloaded_video[0].get('path'), @@ -844,7 +828,7 @@ class HLS_Downloader: f"[bold green]Download completed![/bold green]\n" f"[cyan]File size: [bold red]{formatted_size}[/bold red]\n" f"[cyan]Duration: [bold]{formatted_duration}[/bold]\n" - f"[cyan]Output: [bold]{self.output_filename}[/bold]" + f"[cyan]Output: [bold]{os.path.abspath(self.output_filename)}[/bold]" ) if missing_ts: diff --git a/StreamingCommunity/Lib/Downloader/HLS/segments.py b/StreamingCommunity/Lib/Downloader/HLS/segments.py index 9238c53..a5cd6d8 100644 --- a/StreamingCommunity/Lib/Downloader/HLS/segments.py +++ b/StreamingCommunity/Lib/Downloader/HLS/segments.py @@ -432,7 +432,7 @@ class M3U8_Segments: if "audio" in str(type): TQDM_MAX_WORKER = AUDIO_WORKERS - console.print(f"[cyan]Video workers[white]: [green]{VIDEO_WORKERS} [white]| [cyan]Audio workers[white]: [green]{AUDIO_WORKERS}") + #console.print(f"[cyan]Video workers[white]: [green]{VIDEO_WORKERS} [white]| [cyan]Audio workers[white]: [green]{AUDIO_WORKERS}") # Custom bar for mobile and pc if TQDM_USE_LARGE_BAR: @@ -551,11 +551,7 @@ class M3U8_Segments: console.print(f"[cyan]Max retry per URL[white]: [green]{self.info_maxRetry}[green] [white]| [cyan]Total retry done[white]: [green]{self.info_nRetry}[green] [white]| [cyan]Missing TS: [red]{self.info_nFailed} [white]| [cyan]Duration: {print_duration_table(self.tmp_file_path, None, True)} [white]| [cyan]Expected duation: {ex_formatted_duration} \n") if self.info_nRetry >= len(self.segments) * (1/3.33): - console.print( - "[yellow]⚠ Warning:[/yellow] Too many retries detected! " - "Consider reducing the number of [cyan]workers[/cyan] in the [magenta]config.json[/magenta] file. " - "This will impact [bold]performance[/bold]. \n" - ) + console.print("[yellow]⚠ Warning:[/yellow] Too many retries detected! Consider reducing the number of [cyan]workers[/cyan] in the [magenta]config.json[/magenta] file. This will impact [bold]performance[/bold]. \n") # Info to return return {'type': type, 'nFailed': self.info_nFailed} \ No newline at end of file diff --git a/StreamingCommunity/Lib/FFmpeg/capture.py b/StreamingCommunity/Lib/FFmpeg/capture.py index fedc30f..9d2cb1b 100644 --- a/StreamingCommunity/Lib/FFmpeg/capture.py +++ b/StreamingCommunity/Lib/FFmpeg/capture.py @@ -59,7 +59,7 @@ def capture_output(process: subprocess.Popen, description: str) -> None: # Construct the progress string with formatted output information - progress_string = (f"[yellow][FFmpeg] [white][{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)) diff --git a/StreamingCommunity/Lib/FFmpeg/util.py b/StreamingCommunity/Lib/FFmpeg/util.py index 261419a..86983fa 100644 --- a/StreamingCommunity/Lib/FFmpeg/util.py +++ b/StreamingCommunity/Lib/FFmpeg/util.py @@ -144,23 +144,20 @@ def print_duration_table(file_path: str, description: str = "Duration", return_s - str: The formatted duration string if return_string is True. - dict: A dictionary with keys 'h', 'm', 's' representing hours, minutes, and seconds if return_string is False. """ - try: - video_duration = get_video_duration(file_path) + video_duration = get_video_duration(file_path) - if video_duration is not None: - hours, minutes, seconds = format_duration(video_duration) - formatted_duration = f"[yellow]{int(hours)}[red]h [yellow]{int(minutes)}[red]m [yellow]{int(seconds)}[red]s" - duration_dict = {'h': hours, 'm': minutes, 's': seconds} + if video_duration is not None: + hours, minutes, seconds = format_duration(video_duration) + formatted_duration = f"[yellow]{int(hours)}[red]h [yellow]{int(minutes)}[red]m [yellow]{int(seconds)}[red]s" + duration_dict = {'h': hours, 'm': minutes, 's': seconds} - if description: - console.print(f"[cyan]{description} for [white]([green]{os.path.basename(file_path)}[white]): {formatted_duration}") + if description: + console.print(f"[cyan]{description} for [white]([green]{os.path.basename(file_path)}[white]): {formatted_duration}") + else: + if return_string: + return formatted_duration else: - if return_string: - return formatted_duration - else: - return duration_dict - except: - return None + return duration_dict def get_ffprobe_info(file_path): @@ -211,7 +208,7 @@ def is_png_format_or_codec(file_info): if not file_info: return False - console.print(f"[yellow][FFmpeg] [cyan]Avaiable codec[white]: [red]{file_info['codec_names']}") + #console.print(f"[yellow][FFmpeg] [cyan]Avaiable codec[white]: [red]{file_info['codec_names']}") return file_info['format_name'] == 'png_pipe' or 'png' in file_info['codec_names'] diff --git a/config.json b/config.json index 1b6b4d8..99da269 100644 --- a/config.json +++ b/config.json @@ -8,7 +8,7 @@ "root_path": "Video", "movie_folder_name": "Movie", "serie_folder_name": "TV", - "map_episode_name": "%(tv_name)_S%(season)E%(episode)_%(episode_name)", + "map_episode_name": "%(episode_name)", "config_qbit_tor": { "host": "192.168.1.58", "port": "7060",