osd title changed

This commit is contained in:
localhost_frssoft 2023-06-11 02:06:44 +03:00
parent abf0b7f4c0
commit 610fc8f1f3

View File

@ -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)