mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-23 20:59:20 +02:00
Compare commits
2 Commits
bcd6c220f3
...
2359ffe922
Author | SHA1 | Date | |
---|---|---|---|
localhost_frssoft | 2359ffe922 | ||
localhost_frssoft | f4b029630d |
|
@ -274,6 +274,20 @@ 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 = {
|
||||||
|
|
|
@ -7,13 +7,13 @@ fzf = FzfPrompt()
|
||||||
|
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
def libraries(pg=None, radio=False):
|
def libraries(pg=None, radio=False, search=None):
|
||||||
libs_res = list_libraries(pg=pg)
|
libs_res = list_libraries(pg=pg, q=search)
|
||||||
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 = []
|
libraries_listing = ['Search']
|
||||||
if libs_next:
|
if libs_next:
|
||||||
libraries_listing.append('Next')
|
libraries_listing.append('Next')
|
||||||
if libs_prev:
|
if libs_prev:
|
||||||
|
@ -37,9 +37,12 @@ def libraries(pg=None, radio=False):
|
||||||
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)
|
return libraries(pg=libs_next, search=search)
|
||||||
elif lib_select[0] == 'Prev':
|
elif lib_select[0] == 'Prev':
|
||||||
return libraries(pg=libs_prev)
|
return libraries(pg=libs_prev, search=search)
|
||||||
|
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())
|
||||||
|
|
|
@ -68,5 +68,13 @@ 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')
|
||||||
|
|
Loading…
Reference in New Issue