download visible

This commit is contained in:
localhost_frssoft 2022-11-06 03:56:09 +03:00
parent a4694a4dbe
commit b0d4d3976e
2 changed files with 4 additions and 3 deletions

View file

@ -62,7 +62,6 @@ def radio_load(id_radio=None, type_radio='custom'):
radio_task.start() radio_task.start()
while True: while True:
try: try:
input()
select = fzf.prompt(('Next', 'Prev', 'Pause', 'Download', 'Exit'), f'--header=\'Radio playing...\'')[0] select = fzf.prompt(('Next', 'Prev', 'Pause', 'Download', 'Exit'), f'--header=\'Radio playing...\'')[0]
if select == 'Next': if select == 'Next':
radio_get_track(radio_session_id) radio_get_track(radio_session_id)
@ -75,7 +74,9 @@ def radio_load(id_radio=None, type_radio='custom'):
else: else:
player.pause = True player.pause = True
elif select == 'Download': elif select == 'Download':
download_track(player.filename) print('Downloading...')
name_downloaded = download_track(player.filename)
print(f'Downloaded: {name_downloaded}')
elif select == 'Exit': elif select == 'Exit':
try: try:
radio_event_gen.clear() radio_event_gen.clear()

View file

@ -19,4 +19,4 @@ def download_track(url, name=None):
with open(name, 'wb') as f: with open(name, 'wb') as f:
f.write(r.content) f.write(r.content)
return name