0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 21:53:54 +01:00

add total pl

This commit is contained in:
2025-04-01 19:10:15 +02:00
parent e6807b2024
commit e80602bfd8

View File

@@ -80,7 +80,7 @@ def calculate_category_percentages(playlists, days):
for category in category_counts for category in category_counts
} }
return percentages, polskie_percentages return percentages, polskie_percentages, sum(polskie_percentages.values())
def update_playlist_file(day: str, period: str, filepath: str, add: bool): def update_playlist_file(day: str, period: str, filepath: str, add: bool):
playlist_dir = ensure_playlist_dir(day) playlist_dir = ensure_playlist_dir(day)
@@ -200,7 +200,7 @@ def draw_interface(audio_files: list, playlists: dict, selected_idx: int, curren
days = get_days_of_week() days = get_days_of_week()
current_day = days[current_day_idx] current_day = days[current_day_idx]
percentages, polskie_percentages = calculate_category_percentages(playlists, days) or ({}, {}) percentages, polskie_percentages, total_pl = calculate_category_percentages(playlists, days) or ({}, {}, 0)
available_lines = term_height - 6 available_lines = term_height - 6
start_idx = max(0, min(scroll_offset, len(audio_files) - available_lines)) start_idx = max(0, min(scroll_offset, len(audio_files) - available_lines))
@@ -211,7 +211,7 @@ def draw_interface(audio_files: list, playlists: dict, selected_idx: int, curren
for category in ['morning', 'day', 'night', 'late_night']: for category in ['morning', 'day', 'night', 'late_night']:
percent = percentages.get(category, 0) percent = percentages.get(category, 0)
polskie_percent = polskie_percentages.get(category, 0) polskie_percent = polskie_percentages.get(category, 0)
category_bar += f" {category[:4].capitalize()}: {percent:.1f}% (P:{polskie_percent:.1f}%) |" category_bar += f"{category[:4].capitalize()}: {percent:.1f}% (P:{polskie_percent:.1f}%) TP:{total_pl:0.1f}"
if len(category_bar) > term_width - 2: if len(category_bar) > term_width - 2:
category_bar = category_bar[:term_width - 5] + "..." category_bar = category_bar[:term_width - 5] + "..."