Skip to content

Refactor/local only screensaver#65

Open
atrugiel69 wants to merge 8 commits intoenen92:masterfrom
atrugiel69:refactor/local-only-screensaver
Open

Refactor/local only screensaver#65
atrugiel69 wants to merge 8 commits intoenen92:masterfrom
atrugiel69:refactor/local-only-screensaver

Conversation

@atrugiel69
Copy link

No description provided.

google-labs-jules bot and others added 8 commits July 11, 2025 12:19
This major refactoring removes all Apple TV aerial video functionality,
focusing the addon exclusively on playing videos from a user-specified
local directory.

Changes include:
- Removed logic for fetching and processing Apple's video data from playlist.py.
- Removed Apple-specific helper functions from commonatv.py.
- Deleted downloader.py and offline.py.
- Made entrypointscript.py a placeholder to prevent errors.
- Significantly simplified settings.xml:
    - Removed "Aerial Screensavers" and "Videos" categories.
    - Renamed "Offline mode" category to "Advanced Settings".
    - Kept only "Extra local files" and "Start local videos at random time" settings.
- Updated strings.po to remove unused strings and add new ones for the
  simplified UI and messages.
- Simplified atv.py by removing DPMS logic, 'is_locked' setting usage,
  and references to offline functionality. Updated 'no videos' message.

The addon now functions as a dedicated local video screensaver.
This commit addresses issues identified after the major refactoring:

1.  Resolves `TypeError: Invalid setting type` related to the removed
    `is_locked` setting. Calls to `getSettingBool` and `setSettingBool`
    for `is_locked` were removed from `service.py` and
    `resources/lib/screensaver.py`. `service.py` is now a placeholder.
2.  Fixes `unknown operator "!isempty"` warning in settings. The
    visibility dependency for the `random-seek-local` setting in
    `resources/settings.xml` now uses `operator="!eq"` to check if
    `extra-local-folder` is not empty.
This commit addresses several issues and incorporates identity changes:

1.  Fixes the screensaver not starting by modifying `entrypointscreensaver.py`
    to directly call `atv.run()`, ensuring the correct screensaver window
    (`atv.Screensaver`) is instantiated.
2.  Updates `addon.xml` with a new ID (`screensaver.localvideo`),
    name (`Local Video`), version (`0.0.1`), and provider name.
3.  Updates all Python logging messages to use the new addon ID
    `[screensaver.localvideo]` for consistency.
4.  Removes `resources/lib/screensaver.py` as it became orphaned code
    after the launch mechanism and feature refactoring.
This commit addresses critical errors identified after the major
refactoring to a local-only video screensaver:

1.  Resolves `ModuleNotFoundError: No module named 'resources.lib.offline'`
    by removing the orphaned import of `offline` from `resources/lib/atv.py`.
2.  Resolves `ImportError: cannot import name 'find_ranked_key_in_dict'`
    by correcting the import statement in `resources/lib/playlist.py`
    to only import `addon` from `.commonatv`.
3.  Resolves `NameError: name 'addon_path' is not defined` in
    `resources/lib/playlist.py` by removing unused module-level constants
    (`apple_resources_tar_url`, `apple_local_tar_path`) and unused
    imports (`json`, `tarfile`, `urllib.request`) that were remnants of
    the Apple video functionality.

These fixes ensure the addon can now launch and operate correctly
after the significant code stripping and restructuring.
This commit restores the user-configurable DPMS (Digital Power
Management Signaling) controls that were removed during the major
refactoring. This allows you to manage display and device power
saving behavior initiated by the screensaver.

Changes:
- Restored the DPMS settings group (DPMS mode, action, manual
  timeout, display/CEC toggles) to `resources/settings.xml` under the
  "Advanced Settings" category.
- Restored the corresponding language strings to
  `resources/language/resource.language.en_gb/strings.po`.
- Restored the DPMS handling logic to `resources/lib/atv.py`,
  including the monitoring loop and the `activateDPMS` method.
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 participant