From 39f23c3135ce724e3e16fe088fc8b52e46db2dfb Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sat, 24 Dec 2022 19:39:53 +0300 Subject: [PATCH] Add playlist pos and shortened "caching" --- src/mpv_control.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mpv_control.py b/src/mpv_control.py index 7b84873..4775157 100644 --- a/src/mpv_control.py +++ b/src/mpv_control.py @@ -77,22 +77,26 @@ def waiting_load_observer(_name, value): @logger.catch def universal_observer(_name, value): if value: + percent = int(value) if player.audio_bitrate: - kbps = round(player.audio_bitrate/1024, 1) + kbps = int(player.audio_bitrate/1024) else: kbps = '?' - percent = int(value) if player.file_size: track_size = round(player.file_size/1024/1024, 1) else: track_size = '?' if player.cache_speed: - cache_speed = round(player.cache_speed/1024/1024*8, 1) - cache_speed = f'| caching: ~{cache_speed}Mbit/s' + cache_speed = int(player.cache_speed/1024/1024*8) + cache_speed = f'| ~{cache_speed}Mbit/s' else: cache_speed = '' + if player.playlist_count > -1: + player_pos = f'{player.playlist_current_pos}/{player.playlist_count}' + else: + player_pos = '-/-' print_there(2, 2, f'\r'+' '*get_terminal_size().columns) - print_there(2, 2, f'\r{kbps} kbps | {percent}% | {track_size}MB {cache_speed}') + print_there(2, 2, f'\r{player_pos} | {kbps} kbps | {percent}% | {track_size}MB {cache_speed}') time.sleep(1)