Compare commits

..

No commits in common. "b74e5ce026d1eb8a908252b512f27b06df4d33bd" and "86bbdcf0ea905ec020a7043352e9b5cc630a39d6" have entirely different histories.

3 changed files with 5 additions and 29 deletions

View file

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

View file

@ -126,11 +126,7 @@ def radio_load(id_radio=None, type_radio='custom', name=None, related_object=Non
if playlist_remaining <= 2: if playlist_remaining <= 2:
threading.Thread(target=radio_get_track, args=( threading.Thread(target=radio_get_track, args=(
radio_session_id,), daemon=True).start() radio_session_id,), daemon=True).start()
if playlist_remaining > 1: player.playlist_next()
player.playlist_next()
else:
print('No more tracks, please wait for new...')
time.sleep(3)
elif select == 'Prev': elif select == 'Prev':
player.playlist_prev() player.playlist_prev()
elif select in ('Pause', 'Play'): elif select in ('Pause', 'Play'):
@ -151,7 +147,6 @@ def radio_load(id_radio=None, type_radio='custom', name=None, related_object=Non
key = track.get(i) key = track.get(i)
if key and isinstance(key, str): if key and isinstance(key, str):
print(i + ': ' + key) print(i + ': ' + key)
print('Direct link: ' + player.stream_open_filename)
input() input()
elif select == 'Like': elif select == 'Like':
favorite_track(player_fw_storage.storage.get( favorite_track(player_fw_storage.storage.get(

View file

@ -5,7 +5,6 @@ from loguru import logger
from pyfzf.pyfzf import FzfPrompt from pyfzf.pyfzf import FzfPrompt
import mpv import mpv
import time import time
import sys
fzf = FzfPrompt() fzf = FzfPrompt()
@ -49,20 +48,6 @@ if track_activity_history:
time.sleep(1) 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=[]): def set_http_header(headers=[]):
player.http_header_fields = headers player.http_header_fields = headers
@ -85,10 +70,7 @@ def player_menu(header='', storage={}):
select = fzf.prompt(player_items_menu, f"--header=\'{header}\'")[0] select = fzf.prompt(player_items_menu, f"--header=\'{header}\'")[0]
if select == 'Next': if select == 'Next':
try: player.playlist_next()
player.playlist_next()
except:
print('No more next tracks')
elif select == 'Prev': elif select == 'Prev':
player.playlist_prev() player.playlist_prev()
elif select in ('Pause', 'Play'): elif select in ('Pause', 'Play'):
@ -109,7 +91,6 @@ def player_menu(header='', storage={}):
key = track.get(i) key = track.get(i)
if key and isinstance(key, str): if key and isinstance(key, str):
print(i + ': ' + key) print(i + ': ' + key)
print('Direct link: ' + player.stream_open_filename)
input() input()
elif select == 'Like': elif select == 'Like':
src.fw_api.favorite_track( src.fw_api.favorite_track(