Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reset loop when unplugging sd card (while using usb too) #311

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ui/initial_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,18 @@ 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]:
if current_book.startswith(path):
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):
Expand Down