mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 04:11:29 +00:00
Print info about track in less
This commit is contained in:
parent
dc40e5331c
commit
4ab9f2db2d
|
@ -148,9 +148,8 @@ def radio_load(id_radio=None, type_radio='custom', name=None, related_object=Non
|
|||
name_downloaded = download_track(player.stream_open_filename)
|
||||
elif select == 'Info':
|
||||
track = player_fw_storage.storage.get(track_url_to_uuid())
|
||||
track['direct_url'] = player.stream_open_filename
|
||||
track_info_output(track)
|
||||
print('Direct link: ' + player.stream_open_filename)
|
||||
input()
|
||||
elif select == 'Like':
|
||||
favorite_track(player_fw_storage.storage.get(
|
||||
track_url_to_uuid())['id'])
|
||||
|
|
|
@ -155,9 +155,8 @@ def player_menu(header='', storage={}):
|
|||
name_downloaded = download_track(player.stream_open_filename)
|
||||
elif select == 'Info':
|
||||
track = player_fw_storage.storage.get(track_url_to_uuid())
|
||||
track['direct_url'] = player.stream_open_filename
|
||||
track_info_output(track)
|
||||
print('Direct link: ' + player.stream_open_filename)
|
||||
input()
|
||||
elif select == 'Like':
|
||||
src.fw_api.favorite_track(
|
||||
player_fw_storage.storage.get(track_url_to_uuid())['id'])
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import src.fw_api
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
from urllib.parse import unquote
|
||||
|
@ -57,12 +58,15 @@ def print_there(x, y, text):
|
|||
|
||||
|
||||
def track_info_output(track):
|
||||
output = []
|
||||
for k, v in track.items():
|
||||
if k not in ('cover', 'uploads', 'listen_url', 'mbid', 'id', 'is_playable') and v is not None and v != []:
|
||||
if isinstance(v, dict):
|
||||
for i in ('title', 'name', 'fid'):
|
||||
if v.get(i):
|
||||
val_override = v.get(i)
|
||||
print(f'{k}: {val_override}')
|
||||
output.append(f'{k}: {val_override}')
|
||||
else:
|
||||
print(f'{k}: {v}')
|
||||
output.append(f'{k}: {v}')
|
||||
output = '\n'.join(output)
|
||||
os.system(f'less <<EOF\n{output}')
|
||||
|
|
Loading…
Reference in a new issue