diff --git a/ui/initial_state.py b/ui/initial_state.py index 18e8550..5c16aa9 100644 --- a/ui/initial_state.py +++ b/ui/initial_state.py @@ -71,6 +71,7 @@ def swap_library(current_book, books): """ config = config_loader.load() library = config.get('files', {}).get('library', []) + rel_book = None # check for expected path, for backward compatibility with standalone unit for path in ['front-usb' + os.path.sep, 'back-usb' + os.path.sep]: @@ -78,6 +79,10 @@ def swap_library(current_book, books): rel_book = current_book[len(path):] break + if rel_book is None: + log.info(f'current book not on swappable device ({current_book})') + return + # see if we can find it on a different swappable device path for lib in library: if lib.get('swappable', False):