mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-24 00:29:20 +02:00
Compare commits
No commits in common. "2359ffe9220972bafcd8b8ea3ecfc61ceac30170" and "bcd6c220f346e628ee3c623e19740530b7312f7e" have entirely different histories.
2359ffe922
...
bcd6c220f3
|
@ -274,20 +274,6 @@ 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 = {
|
||||
|
|
|
@ -7,13 +7,13 @@ fzf = FzfPrompt()
|
|||
|
||||
|
||||
@logger.catch
|
||||
def libraries(pg=None, radio=False, search=None):
|
||||
libs_res = list_libraries(pg=pg, q=search)
|
||||
def libraries(pg=None, radio=False):
|
||||
libs_res = list_libraries(pg=pg)
|
||||
libs_count = libs_res.get('count')
|
||||
libs_next = libs_res.get('next')
|
||||
libs_prev = libs_res.get('previous')
|
||||
libs = libs_res.get('results')
|
||||
libraries_listing = ['Search']
|
||||
libraries_listing = []
|
||||
if libs_next:
|
||||
libraries_listing.append('Next')
|
||||
if libs_prev:
|
||||
|
@ -37,12 +37,9 @@ def libraries(pg=None, radio=False, search=None):
|
|||
lib_select = lib_select[0].split('.', 1)
|
||||
|
||||
if lib_select[0] == 'Next':
|
||||
return libraries(pg=libs_next, search=search)
|
||||
return libraries(pg=libs_next)
|
||||
elif lib_select[0] == 'Prev':
|
||||
return libraries(pg=libs_prev, search=search)
|
||||
elif lib_select[0] == 'Search':
|
||||
q = input('Name of library:\n')
|
||||
return libraries(search=q)
|
||||
return libraries(pg=libs_prev)
|
||||
elif lib_select[0] == 'Add remote library':
|
||||
print('Search a remote library (url\\fid):')
|
||||
new_library = federate_remote_library(input().strip())
|
||||
|
|
10
src/utils.py
10
src/utils.py
|
@ -63,18 +63,10 @@ def track_info_output(track):
|
|||
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):
|
||||
if v.get(i):
|
||||
val_override = v.get(i)
|
||||
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