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

View file

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