Compare commits

..

No commits in common. "2359ffe9220972bafcd8b8ea3ecfc61ceac30170" and "bcd6c220f346e628ee3c623e19740530b7312f7e" have entirely different histories.

3 changed files with 6 additions and 31 deletions

View File

@ -274,20 +274,6 @@ def list_libraries(page=None, page_size=None, q=None, scope='all', pg=None):
return r.json() 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 @logger.catch
def get_tags(q=None, ordering='-creation_date', pg=None): def get_tags(q=None, ordering='-creation_date', pg=None):
params = { params = {

View File

@ -7,13 +7,13 @@ fzf = FzfPrompt()
@logger.catch @logger.catch
def libraries(pg=None, radio=False, search=None): def libraries(pg=None, radio=False):
libs_res = list_libraries(pg=pg, q=search) libs_res = list_libraries(pg=pg)
libs_count = libs_res.get('count') libs_count = libs_res.get('count')
libs_next = libs_res.get('next') libs_next = libs_res.get('next')
libs_prev = libs_res.get('previous') libs_prev = libs_res.get('previous')
libs = libs_res.get('results') libs = libs_res.get('results')
libraries_listing = ['Search'] libraries_listing = []
if libs_next: if libs_next:
libraries_listing.append('Next') libraries_listing.append('Next')
if libs_prev: if libs_prev:
@ -37,12 +37,9 @@ def libraries(pg=None, radio=False, search=None):
lib_select = lib_select[0].split('.', 1) lib_select = lib_select[0].split('.', 1)
if lib_select[0] == 'Next': if lib_select[0] == 'Next':
return libraries(pg=libs_next, search=search) return libraries(pg=libs_next)
elif lib_select[0] == 'Prev': elif lib_select[0] == 'Prev':
return libraries(pg=libs_prev, search=search) return libraries(pg=libs_prev)
elif lib_select[0] == 'Search':
q = input('Name of library:\n')
return libraries(search=q)
elif lib_select[0] == 'Add remote library': elif lib_select[0] == 'Add remote library':
print('Search a remote library (url\\fid):') print('Search a remote library (url\\fid):')
new_library = federate_remote_library(input().strip()) new_library = federate_remote_library(input().strip())

View File

@ -68,13 +68,5 @@ def track_info_output(track):
output.append(f'{k}: {val_override}') output.append(f'{k}: {val_override}')
else: else:
output.append(f'{k}: {v}') 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) output = '\n'.join(output)
os.system(f'less <<EOF\n{output}\nEOF') os.system(f'less <<EOF\n{output}\nEOF')