Skip to content

v2.0: Multi-source wallpaper engine with live satellites - #12

Open
AlperSakarya wants to merge 37 commits into
limhenry:masterfrom
AlperSakarya:master
Open

v2.0: Multi-source wallpaper engine with live satellites#12
AlperSakarya wants to merge 37 commits into
limhenry:masterfrom
AlperSakarya:master

Conversation

@AlperSakarya

Copy link
Copy Markdown
Contributor

Earth View Wallpaper Engine v2.0

Major rewrite turning the original single-source wallpaper changer into a full multi-source engine.

What changed

  • Complete rewrite of indicator.py with modern architecture
  • Plugin-based source system - easy to add new image sources
  • 6 image sources (all work without API keys):
    • Google Earth View (original, preserved)
    • NASA EPIC (real-time full-disc Earth from DSCOVR satellite)
    • Himawari-8 (Japanese weather satellite, updates every 10 min)
    • GOES-16/18 (NOAA satellites, Americas in true color)
    • NASA APOD (Astronomy Picture of the Day)
    • Unsplash (scenery, aerial, space - searches for fresh full-res wallpapers)
  • Themed collections: Volcanic Landscapes, River Deltas, Arctic Ice, Desert Abstract, Human Patterns
  • Time-aware mode - picks wallpapers matching time of day (sunrise/day/sunset/night)
  • Fly-over mode - virtual flights along 6 scenic routes (Nile River, Mediterranean Coast, Andes, Silk Road, Pacific Ring of Fire, Great Barrier Reef)
  • Location-aware - IP geolocation to show nearby satellite imagery
  • Favorites and history system
  • Auto-change timer (5 min to 24 hours)
  • GTK preferences dialog with tabs for sources, schedule, and modes
  • Debian package with build script
  • Data migration utility for old format

Backward compatible

The original Earth View source and data.json are preserved and still work as before. This is additive - the original functionality is now one of many sources.

No API keys needed

Everything works out of the box. Optional keys for Unsplash and NASA APOD give better rate limits but aren't required.

AlperSakarya and others added 30 commits May 1, 2016 19:45
…rom any directory now and changes the wallpaper.
Optimize Earth View Wallpaper Changer for modern Ubuntu

This commit significantly improves the application with:
- Refactored indicator.py using OOP for better organization
- Added threading to prevent UI freezing during downloads
- Improved error handling throughout the application
- Added compatibility with Ubuntu 22.04+ (GNOME 42+)
- Enhanced UI with About dialog and better notifications
- Optimized parser.py with parallel processing and CLI arguments
- Updated documentation with clearer installation instructions
- Fixed potential race conditions in wallpaper changing process
- Updated requirements.txt with proper dependencies

The app now provides a smoother user experience while maintaining
its core simplicity and functionality.
- Add complete Debian package structure with control files and postinst script
- Include pre-built .deb package for easy installation
- Add desktop entry and application icon for system integration
- Update README with comprehensive installation instructions for both .deb and manual methods
- Add auto-start configuration option in the application menu
- Update dependencies to use system packages instead of pip requirements
- Add AmazonQ.md documentation file
- Improve troubleshooting section with package-specific instructions
…utes, and time-aware mode

Added plugin-based source system with NASA EPIC, Himawari-8, GOES-16/18,
NASA APOD, and Unsplash alongside the original Earth View. Includes themed
collections, favorites, history, auto-change timer, preferences dialog,
fly-over routes (Nile, Mediterranean, Andes, Silk Road, etc.), and
time-aware wallpaper selection. Full rewrite of indicator.py.
- Sources now cycle in strict order (EarthView -> GOES -> Himawari -> APOD -> EPIC -> Unsplash)
- Every image URL is tracked; no repeat within 7 days
- All 6 sources get equal usage, no more Earth View domination
- State persisted across restarts
Root cause of the repeating wallpapers: fly-over 'location' mode routed
through fetch_near_location, which filtered to sources with
supports_location=True. Only Earth View sets that, so every change came
from Earth View - and its geo lookup sampled only the 5 nearest images,
so the same few towns cycled forever.

- Location mode now round-robins ALL sources; geo-capable ones return
  nearby imagery, others contribute their normal fetch
- Earth View geo pool widened from 5 to 40+ candidates
- GOES: retarget GOES19 (NOAA retired GOES16 path), add 23 verified
  sector views, time-bucketed URL so the live feed is not treated as a
  single image by dedup
- NASA EPIC: draw from ~3592 archive dates instead of only the latest
- Retry loop no longer burns API quota when a source returns None

Verified: 18/18 unique URLs across all 6 sources in location mode;
every source has >336 unique images available per week.
Make the .deb behave like a proper installer instead of unpacking over a
running application.

Maintainer scripts:
- prerm stops running instances (SIGTERM, then SIGKILL after 5s), clears
  stale single-instance locks, and records who to restart on upgrade
- postinst removes stale bytecode, refreshes icon/desktop/man caches, and
  restarts the app for users who had it running
- postrm cleans runtime bytecode and empty dirs; per-user settings under
  ~/.config and ~/.cache are deliberately left alone

Correctness:
- Wallpaper now written to ~/.cache/earthview/ instead of the install
  directory. It previously wrote to /usr/share/earthview/, which only
  worked because package files were wrongly owned by the build user;
  with correct root ownership that path is not user-writable.
- Build with --root-owner-group so files install as root:root
- Stop shipping wallpaper.jpg, a 1.1MB runtime artifact (deb: 1.2MB -> 80KB)

Policy compliance (lintian now reports zero errors and warnings):
- Add changelog and copyright under /usr/share/doc, changelog gzipped
- Add a man page for earthview-wallpaper(1)
- Icon was 512x512 installed into a 128x128 directory; now generated at
  48/64/128/256/512 with matching dimensions
- Normalise directory perms to 755 and data files to 644
- Build script validates control version and lints maintainer script syntax
Logging:
- New logsetup.py writes to ~/.cache/earthview/earthview.log with 1MB
  rotation and 3 backups, mirrored to stderr
- Enable verbose output with --debug or EARTHVIEW_DEBUG=1
- Replaced every print() in the source plugins and registry with logger
  calls, so provider failures are recorded rather than sent to a stdout
  that nobody reads
- Logs source rotation decisions, duplicate rejections, download size and
  content type, and gsettings results
- New 'View Log' menu entry

Black desktop after upgrading from <=2.0.2:
- Those versions wrote the wallpaper into the install directory, which is
  removed on upgrade, leaving picture-uri-dark pointing at a missing file.
  In dark mode that renders black.
- The app now detects a wallpaper setting pointing at a nonexistent file on
  startup and repairs it from cache, or fetches a replacement
- postinst clears stale /usr/share/earthview/wallpaper.jpg references
- Both picture-uri and picture-uri-dark are always set, and gsettings
  failures are logged instead of silently ignored. Previously a failure to
  set the dark key was discarded.
- Downloads under 1KB are rejected rather than applied, since a truncated
  response or error page also renders black

Packaging:
- Pristine changelog, copyright and man page now live in packaging/ and are
  staged into the tree at build time. The previous in-place gzip consumed
  its own input, which silently dropped the man page from a rebuild.
- Build verifies the changelog's top version matches the build version
- Generated doc/man output is gitignored

lintian remains clean across repeated builds.
The previous icon was derived from Google imagery. Replaced with
hand-authored original SVG artwork: a globe with orbital arcs and
viewfinder framing, no third party branding.

- Install 32/48/64/128/256/512 PNGs plus a scalable SVG, so desktop
  environments pick a real size instead of rescaling one bitmap. The old
  set shipped a single 512x512 file inside a 128x128 directory.
- Master artwork lives in packaging/icons and is staged at build time, so
  the installed theme cannot drift from the source files. Build fails if
  any expected size is missing.
- Tray indicator and About dialog artwork updated to match.
- Generated icon theme is now gitignored, like the doc and man output.
- Removed AmazonQ.md, a leftover duplicate of the README.

lintian clean from a clean build tree.
The 2.0.4 and 2.0.5 packages could not start at all. Both omitted
logsetup.py, so the installed app aborted with
'ModuleNotFoundError: No module named logsetup'. The build staged modules
from a hardcoded list that was not updated when the module was added.

- Stage modules by glob so new files cannot be silently omitted
- Verify after building that every source module is present in the archive
  and that the entry point's imports resolve, discarding the archive and
  failing the build if not. Confirmed this catches the original bug.

Start after installation:
- Fresh install starts the app for every user with an active graphical
  session, using dpkg's previous-version argument to detect a first install
- Upgrade restores only users who had it running, so someone who
  deliberately quit is not relaunched
- Skip users with no session bus, and users already running it
- Detect the user's DISPLAY from their running session rather than assuming
  :0. DISPLAY is unset under dpkg, so the previous fallback would have
  failed on this machine, whose display is :1.
New 'Lock to Sources' tray submenu restricts automatic and manual changes
to one or more chosen sources, so it is possible to run only Unsplash, or
only the live satellites. Locked sources rotate evenly among themselves and
the seven day no-repeat guarantee still applies.

- Menu label shows the current lock, e.g. 'Lock to Sources [Unsplash]'
- 'All Sources (randomize)' or an empty selection uses everything
- 'Change From Source' still ignores the lock, being an explicit one-off

Fixes two problems in the existing Preferences checkboxes, which drove the
same setting:
- Ticking one box while none were recorded silently restricted the app to
  that single source, since an empty list means 'all'. Unticking from that
  state now seeds the full set first, so it reads as 'all except this'.
- Unticking the last box left no usable source. A full selection is now
  stored as no lock, giving one canonical form.
- Clearing the lock took effect only after restart, because the registry was
  updated only for a non-empty list.

Verified: locked to one source 8/8 fetches obeyed it, a two source lock split
evenly, unlocking spread across sources.
The bundled Unsplash photo IDs were never verified against the images they
reference. Entries were labelled as scenery while pointing at arbitrary
photos: the one titled 'Tropical Beach Paradise' is a portrait headshot,
which is what surfaced as a wallpaper.

Compounding it, the keyless search path never worked. All three keyless
routes are closed: the internal napi search returns 307 to non-browser
clients, source.unsplash.com is retired and returns 503, and the documented
API returns 401 unauthenticated. Unsplash therefore always fell back to the
unverified list, so every Unsplash wallpaper came from it.

- Removed the unverified list rather than correcting it, since its metadata
  could not be trusted
- Unsplash now requires a free API key and reports itself unavailable
  without one, so it is skipped rather than substituting arbitrary images
- Screen results against their description and tags to reject
  people-centric photos, which Unsplash returns freely for scenery queries
- An unsatisfiable lock, such as Unsplash with no key, now falls back to the
  available sources instead of leaving the wallpaper frozen. Verified: with
  the lock set and no key, changes continued across the other five sources.
- Tray menu marks sources needing a key and warns when a lock is unusable
- Purged the affected URLs from local history and dedup state

Note the 100 consecutive Unsplash entries in history were not a rotation
fault; the lock was set to Unsplash, working as designed.
Diagnostics on the bundled Unsplash list found 33 of its 36 images were
genuinely good scenery, 2 were dead 404s and 1 was the portrait. Removing all
36 in 2.1.1 was an overcorrection.

No image identifiers remain in the code. Every source now discovers images at
run time via a search, an archive index or a category listing.

- New Wikimedia Commons source: ~1,600 peer-reviewed landscape and astronomy
  photographs from Featured pictures and Quality images categories, 4-6K
  native resolution, no API key. The category listing is cached for a week
  since Commons answers repeated requests with 429.
- Unsplash switched to live search, requiring a free key. No keyless route
  exists: napi answers 307, source.unsplash.com 503, the API 401. Photo IDs
  are opaque so cannot be generated either.
- Send a descriptive User-Agent when downloading. Requests sends none, and
  Wikimedia answers that with 403, so Commons images could not have been
  downloaded at all. Verified: 403 without, 429 with a short value, 200 with
  a compliant one.
- Removed 3 collection entries returning 404; the remaining 26 all resolve.

Investigated generating Earth View IDs randomly as suggested. Its IDs are
sequential, but probing 60 random values in range yielded a 21% hit rate and
zero images absent from data.json, so that file is already a complete
enumeration and probing would only waste requests.
Notifications could wake a monitor that had powered down, which is unwelcome
when the machine is sitting idle.

- New Notifications submenu in the tray, mirrored in Preferences, with a
  setting to turn desktop notifications off
- Notifications are silenced automatically while the monitor is in a DPMS
  power saving state or the session is locked. On by default, and separately
  switchable so the old always-notify behaviour is still available.
- New screenstate module reads monitor power via xset, lock state and idle
  time via GNOME DBus. Every probe fails open, reporting the screen as on when
  it cannot tell, so notifications are never lost to a failing check.
- Menu and Preferences show the current screen state; suppressed
  notifications are logged with the reason

Verified all six combinations of the two settings against monitor on, monitor
off and locked, including that turning notifications off silences them
regardless of screen state.

Also fixes settings added by a new version never appearing in an existing
config. Defaults are now merged on load and written back, so upgrades gain new
keys instead of relying on the in-code fallback forever.
Read the Unsplash API documentation and moved to a better endpoint.

- GET /photos/random replaces /search/photos. It returns genuinely random
  photos rather than relevance-ranked ones, and accepts count up to 30, so one
  request yields 30 candidates instead of one.
- Three queries are merged and shuffled per refill, about 85 photos. Batching a
  single query produced 10 consecutive Earth-from-space wallpapers, since one
  query returns one theme; merging fixes that. Usage stays far inside the 50
  requests per hour a demo key allows.
- Chose queries over the official topics after measuring: a specific query gave
  30/30 on subject, query=landscape 27/30, topics=wallpapers,nature only 12/30.
  Those topics are broad buckets holding 3D renders, abstracts and animals.
- Register a download when an image is applied. Their API Guidelines require a
  request to the photo's download_location when an image is selected as a
  wallpaper, naming that case explicitly, and we were not doing it. Sources can
  now implement notify_applied for provider obligations of this kind; verified
  returning HTTP 200 and routed through the registry.
- Keep the location Unsplash supplies, present on about half of photos, so
  those wallpapers report a city and country like the satellite sources.

Note /photos/random returns an empty tags array unlike search, so the
people filter now relies on descriptions alone.

README updated for the current seven sources with pool sizes, the key
requirements and why they exist, logging, and troubleshooting for rate limits
and skipped sources.
The project outgrew its original scope as a Google Earth View wallpaper
script and now spans seven providers, so it has moved out of the fork
network into its own repository.
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