Compare commits

...

2 Commits

3 changed files with 20 additions and 3 deletions

View File

@ -74,17 +74,17 @@ def get_instance_settings():
@logger.catch
def get_audio_file(track_uuid, listen_url=False, download=False,
transcoding=get_config('enable_server_transcoding'), to='ogg'):
if not transcoding:
to = None
params = {
"download": download,
"to": to
}
if not transcoding:
del params['to']
if listen_url:
url = f'https://{current_instance.instance}{track_uuid}?'
else:
url = f'https://{current_instance.instance}/api/v1/listen/{track_uuid}?'
return url + urllib.parse.urlencode(params)
return url + urllib.parse.urlencode(params, doseq=True)
@logger.catch

View File

@ -147,6 +147,7 @@ def radio_load(id_radio=None, type_radio='custom', name=None, related_object=Non
key = track.get(i)
if key and isinstance(key, str):
print(i + ': ' + key)
print('Direct link: ' + player.stream_open_filename)
input()
elif select == 'Like':
favorite_track(player_fw_storage.storage.get(

View File

@ -5,6 +5,7 @@ from loguru import logger
from pyfzf.pyfzf import FzfPrompt
import mpv
import time
import sys
fzf = FzfPrompt()
@ -48,6 +49,20 @@ if track_activity_history:
time.sleep(1)
@player.property_observer('filtered-metadata')
@logger.catch
def osd_observer(_name, 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])
sys.stdout.write('\r ')
sys.stdout.write('\r'+''.join(osd_message))
sys.stdout.flush()
def set_http_header(headers=[]):
player.http_header_fields = headers
@ -91,6 +106,7 @@ def player_menu(header='', storage={}):
key = track.get(i)
if key and isinstance(key, str):
print(i + ': ' + key)
print('Direct link: ' + player.stream_open_filename)
input()
elif select == 'Like':
src.fw_api.favorite_track(