search in libraries menu

This commit is contained in:
localhost_frssoft 2023-08-03 00:29:11 +03:00
parent f4b029630d
commit 2359ffe922

View File

@ -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())