diff --git a/.ignore b/.ignore new file mode 100644 index 0000000..c6a2292 --- /dev/null +++ b/.ignore @@ -0,0 +1,5 @@ +.git/ +.github/ +screenshots/ +mock-data.yml +README.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index db9e88b..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,10 +0,0 @@ -repos: - - repo: https://github.com/astral-sh/ruff-pre-commit - # Ruff version. - rev: v0.9.0 - hooks: - # Run the linter. - - id: ruff - args: [--fix] - # Run the formatter. - - id: ruff-format diff --git a/.sqlfluff b/.sqlfluff deleted file mode 100644 index 02e9b24..0000000 --- a/.sqlfluff +++ /dev/null @@ -1,11 +0,0 @@ -[sqlfluff] -exclude_rules = L016,L039,L031,L034 - -# Data Types - -extended_capitalisation_policy = lower -# Comma separated list of words to ignore for this rule - -ignore_words = None - -ignore_words_regex = None diff --git a/README.md b/README.md index 41905a0..366839d 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,56 @@ -# GitHub Blueprint +# Earthquakes Near This Screen — Screenly Edge App -Blueprint for GitHub repos. +A map centred on the screen's own location. The nearest earthquake is called out +— magnitude, place, distance, direction, how long ago — with a dashed line from +the screen to it. One quake, not a scatter of them: nothing else is marked. +Nothing moves and nothing animates; the feed is refetched every five minutes. -## Usage +The map runs full bleed and the type sits on it in glass panels: the same paper a +shade down, blurred, with a hairline edge, so the coastlines still read through +them. A screen with no location set says exactly that instead of guessing — the +map and the readout are hidden and it asks for a location. -```bash -$ rsync -aP .github /path/to/repo/ -``` +Two files: `screenly.yml` and `index.html`. No libraries, no build step, no web +fonts, nothing fetched but the data, one setting (miles or kilometres). Data +from the public USGS feed, all magnitudes, past 7 days. + +## How the map works + +The map inlined in `index.html` is a flat (equirectangular) world drawn from +public-domain Natural Earth outlines, so placing a point is arithmetic rather +than a mapping library: +longitude is a fraction across the view, latitude a fraction down. The view is a +window on it, centred on the screen and sized to hold the ten nearest quakes, +though only the closest is marked — never narrower than about 900 miles across. +It is stretched horizontally by 1/cos(latitude) so distances read correctly, +and the graticule is drawn from the same window. -## Repo Configuration +Tectonic plate boundaries are drawn over it as dashed red lines, from the plate +data that was already in this repo. They are the reason the quake sits where it +does. -* Default branch should be `master` -* If relevant, `production` is used as the production branc h -* Branch protection should be enabled on master and production with: - * `Require a pull request before merging`, `Require approvals` and `Require review from Code Owners` - * `Require status checks to pass before merging` +Every size on the page is a multiple of one unit — a hundredth of the screen's +width, or of its height scaled to 16:9, whichever is smaller — so the layout +fills the screen whatever its shape, without clipping or letterboxing. The map +window is fitted to the screen's real aspect ratio, not an assumed one. -## Code Owner +Needs a player: the coordinates, the location name, the units setting and the +CORS proxy all come from the injected `screenly.js` bridge, so it will not run +in a plain browser. The bridge hands the coordinates over as strings — they are +converted on the way in, because `+` on a string silently poisons every sum +downstream. -Adjust `.github/CODEOWNERS` to the squad that owns the repo. \ No newline at end of file +The app holds the screen until it has something to say. `ready_signal: true` +in the manifest stops the player showing the page the moment it loads, and +the app calls `screenly.signalReadyForRendering()` once the first feed +request has settled — so the previous asset stays up through the fetch +instead of the screen flashing a panel of dashes. It signals whether that +fetch succeeded or failed; a player that is never told holds the playlist for +sixty seconds and then abandons the build. A screen with no location has +nothing to wait for and signals straight away. + +## Deploy + +```bash +screenly edge-app deploy +``` diff --git a/index.html b/index.html new file mode 100644 index 0000000..13c6613 --- /dev/null +++ b/index.html @@ -0,0 +1,312 @@ + + +Earthquakes near this screen + + +
+
+ + + + + + + + + + + +
You
+
+
+ +
Earthquakes · past 7 days
+ +
+
+
Magnitude
+
M
+
+
+
+
Distance
+
Direction
+
When
+
+
+ +
+
You are here
+
+
+
+
+ + + diff --git a/pyrightconfig.json b/pyrightconfig.json deleted file mode 100644 index c9bd27d..0000000 --- a/pyrightconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "include": [ - "screenly", - "libs" - ], - "exclude": [ - "**/node_modules", - "**/__pycache__", - "tests" - ], - "typeCheckingMode": "standard", -} diff --git a/ruff.toml b/ruff.toml deleted file mode 100644 index 0754cb2..0000000 --- a/ruff.toml +++ /dev/null @@ -1,57 +0,0 @@ -exclude = [ - "libs", - ".bzr", - ".direnv", - ".eggs", - ".git", - ".git-rewrite", - ".hg", - ".ipynb_checkpoints", - ".mypy_cache", - ".nox", - ".pants.d", - ".pyenv", - ".pytest_cache", - ".pytype", - ".ruff_cache", - ".svn", - ".tox", - ".venv", - ".vscode", - "__pypackages__", - "_build", - "buck-out", - "build", - "dist", - "node_modules", - "site-packages", - "venv", -] - -line-length = 120 -indent-width = 4 - -target-version = "py310" - -[lint] -select = ["E4", "E7", "E9", "F"] -ignore = [] - -fixable = ["ALL"] -unfixable = [] - -# Allow unused variables when underscore-prefixed. -dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" - -[format] -# Like Black, use double quotes for strings. -quote-style = "double" - -# Like Black, indent with spaces, rather than tabs. -indent-style = "space" - -# Like Black, respect magic trailing commas. -skip-magic-trailing-comma = false - -# Like Black, automatically detect the appropriate line ending. -line-ending = "auto" diff --git a/screenly.yml b/screenly.yml new file mode 100644 index 0000000..f05e03c --- /dev/null +++ b/screenly.yml @@ -0,0 +1,28 @@ +--- +syntax: manifest_v1 +id: 01KZ77RN8V1GWCGTYG53HP1V0T +description: Calls out the earthquakes around this screen on a map centred on its own location. +author: Will Cornforth +homepage_url: https://earthquake.usgs.gov +categories: + - Dashboards +entrypoint: + type: file + uri: index.html +ready_signal: true +settings: + units: + type: string + default_value: miles + title: Distance units + optional: true + help_text: + properties: + help_text: Units for the distances in the labels. + options: + - label: Miles + value: miles + - label: Kilometres + value: km + type: select + schema_version: 1