Automatically follow on library when adding

This commit is contained in:
localhost_frssoft 2023-06-15 15:11:21 +03:00
parent adfa00aeb4
commit 35879ac63e
3 changed files with 38 additions and 5 deletions

View file

@ -1,4 +1,4 @@
from src.fw_api import current_instance, list_libraries, federate_remote_library, scan_remote_library
from src.fw_api import current_instance, list_libraries, federate_remote_library, scan_remote_library, follow_on_remote_library
from pyfzf.pyfzf import FzfPrompt
from loguru import logger
import time
@ -41,13 +41,17 @@ def libraries(pg=None, radio=False):
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())
new_library = federate_remote_library(input().strip())
if new_library.get('detail'):
logger.error(new_library['detail'])
return
if new_library.get('count') > 0:
print('Library found')
one_lib = new_library['results'][0]
if one_lib['privacy_level'] == 'private':
logger.warning('This library is private, you should wait until your request is approved')
follow_on_remote_library(one_lib['uuid'])
scan = scan_remote_library(one_lib['uuid'])
if scan.get('detail'):
logger.error(scan['detail'])