Skip to content

Fix CLI crash when Plex is disabled in config - #41

Open
bin101 wants to merge 3 commits into
ladyisatis:mainfrom
bin101:fix/issue-23-cli-without-plex
Open

Fix CLI crash when Plex is disabled in config#41
bin101 wants to merge 3 commits into
ladyisatis:mainfrom
bin101:fix/issue-23-cli-without-plex

Conversation

@bin101

@bin101 bin101 commented Jul 13, 2026

Copy link
Copy Markdown

Summary

  • Loading a config where plex.enabled is explicitly false still forced Plex username/password mode, causing a login attempt with empty credentials and a plexapi.exceptions.BadRequest.
  • The resulting error dialog then crashed with RuntimeError: asyncio.run() cannot be called from a running event loop, because the console's message dialog called the synchronous Application.run() from inside the already-running event loop.
  • While testing the flow above, the console's language selection step crashed with AttributeError: property 'language' of 'OrganizerStore' object has no setter — the setter function was named set_language instead of language, so the @language.setter decorator bound to the wrong name and the property stayed read-only.
  • Finishing a run without Plex enabled crashed with KeyError: 'new_show' and never wrote the config, because isinstance(extra_fields.get("new_show", False), int) is True for the default False value (bool is a subclass of int in Python), causing an attempt to delete a key that was never set.

Fixes #23

Changes

  • src/organizer.py: respect the actual boolean value of plex.enabled instead of only checking its presence.
  • src/console.py: make _message_dialog async and use run_async(), matching the existing _input_dialog and GUI implementations.
  • src/store.py: rename the language property setter function from set_language to language so it actually attaches to the property.
  • src/console.py: exclude bool in the new_show int check in start_process()'s finally block so the sentinel/default values don't trigger a bogus key deletion.

Test plan

  • Verified py_compile passes for all changed files
  • Load a config with plex.enabled: false (no top-level mode) in console mode and confirm it starts in .nfo/Jellyfin mode without attempting a Plex login
  • Confirm existing configs with plex.enabled: true / valid mode still go through the Plex login flow unchanged
  • Trigger a Plex error path and confirm the error dialog displays instead of crashing with the asyncio RuntimeError
  • Run through the console "advanced settings" language selection step and confirm no AttributeError is raised
  • Complete a full console run without Plex enabled and confirm the config file is written without a KeyError

…n in console dialog

Loading a config where plex.enabled is explicitly false still forced
Plex username/password mode, causing a login attempt with empty
credentials (plexapi BadRequest). The resulting error dialog then
crashed with "asyncio.run() cannot be called from a running event
loop" because the console's message dialog called the synchronous
Application.run() from inside the already-running event loop.
@bin101
bin101 marked this pull request as draft July 13, 2026 10:53
bin101 added 2 commits July 13, 2026 12:55
The setter was defined as set_language instead of language, so the
@language.setter decorator bound the resulting property to the wrong
name and the language attribute stayed read-only, raising
AttributeError: property 'language' of 'OrganizerStore' object has
no setter.
…arker

extra_fields.get("new_show", False) was checked with isinstance(x, int),
but bool is a subclass of int in Python, so the default False (and the
in-progress True sentinel) were both mistaken for a stored file_action
value. This tried to delete a "new_show" key that was never set,
raising KeyError and aborting before save_config() could run - so no
config was written after a run without Plex enabled.
@bin101
bin101 marked this pull request as ready for review July 31, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1.2.0 CLI issues without Plex

1 participant