From 610fc8f1f331b25f87d6d5ebd06818f78840db76 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sun, 11 Jun 2023 02:06:44 +0300 Subject: [PATCH] osd title changed --- src/mpv_control.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mpv_control.py b/src/mpv_control.py index a950a04..6282265 100644 --- a/src/mpv_control.py +++ b/src/mpv_control.py @@ -60,19 +60,19 @@ if track_activity_history: time.sleep(1) -@player.property_observer('filtered-metadata') -@logger.catch -def osd_observer(_name, value): +def osd_observer(value): '''Sumulate osd playing message in console''' if value: osd_message = [] for i in value.items(): if i[0] in ('Artist', 'Album', 'Title'): osd_message.append(i[1]) - print_there(0, 0, '\r ') - osd_string = ' — '.join(osd_message) + osd_string = ' - '.join(osd_message) term_len = get_terminal_size().columns + print_there(0, 0, '\r'+' '*term_len) print_there(0, 0, '\r'+osd_string[:term_len]) + else: + print_there(0, 0, '\rNo metadata...') @player.event_callback('start-file') @@ -109,6 +109,7 @@ def universal_observer(_name, value): player_pos = f'{player.playlist_pos_1}/{player.playlist_count}' else: player_pos = '-/-' + osd_observer(player.filtered_metadata) print_there(2, 2, f'\r'+' '*get_terminal_size().columns) print_there(2, 2, f'\r{player_pos} | {kbps} kbps | {percent}% | {track_size}MB {cache_speed}') time.sleep(1)