mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-12-22 05:39:48 +00:00
added related libraries track info
This commit is contained in:
parent
bcd6c220f3
commit
f4b029630d
@ -274,6 +274,20 @@ def list_libraries(page=None, page_size=None, q=None, scope='all', pg=None):
|
||||
return r.json()
|
||||
|
||||
|
||||
@logger.catch
|
||||
def assigned_libraries_on_track(track_id, page=None, page_size=None, pg=None):
|
||||
params = {
|
||||
'page': page,
|
||||
'page_size': page_size,
|
||||
}
|
||||
if pg:
|
||||
r = current_instance.s.get(pg)
|
||||
else:
|
||||
r = current_instance.s.get(
|
||||
f'https://{current_instance.instance}/api/v1/tracks/{track_id}/libraries', params=params)
|
||||
return r.json()
|
||||
|
||||
|
||||
@logger.catch
|
||||
def get_tags(q=None, ordering='-creation_date', pg=None):
|
||||
params = {
|
||||
|
@ -68,5 +68,13 @@ def track_info_output(track):
|
||||
output.append(f'{k}: {val_override}')
|
||||
else:
|
||||
output.append(f'{k}: {v}')
|
||||
output.append('Related Libraries:')
|
||||
try:
|
||||
assigned_libs = src.fw_api.assigned_libraries_on_track(track['id'])['results']
|
||||
for i in assigned_libs:
|
||||
for prop in ('fid', 'name', 'description', 'creation_date'):
|
||||
output.append(i.get(prop))
|
||||
except:
|
||||
output.append('Failed get related')
|
||||
output = '\n'.join(output)
|
||||
os.system(f'less <<EOF\n{output}\nEOF')
|
||||
|
Loading…
Reference in New Issue
Block a user