mirror of
https://github.com/MoHadiShibli/Control4Free.git
synced 2026-10-06 10:00:28 +02:00
Three bits of polish for people who did not write this. The payload serves /manifest.webmanifest and /icon-192.png, and the page points at both, so a phone can keep the controller on its home screen instead of typing an IP address again. The icon is the app's own icon, rendered by the launcher's drawing code and committed, so the payload build needs no renderer; a test re-renders it and fails if the two drift apart. One size only: the gradient does not compress, and a 512 copy would add 150 KB for a splash screen that a plain HTTP shortcut never shows. write_png now picks the best filter per row, which also shrinks the package icon. When the service starts it works out which address the console is actually reachable on, from the route to the outside world without sending anything, and puts it in the start-up notification on the TV. Every error the page can show now says what happened and what to do about it, rather than "Invalid axis", and the README has a troubleshooting section covering the ones people will actually hit.
31 lines
986 B
Python
31 lines
986 B
Python
"""Render the home-screen icons the payload serves, with the launcher's own
|
|
drawing code, so the page's icon is the app's icon.
|
|
|
|
python3 tools/make_icons.py
|
|
|
|
Writes client/icon-192.png, which the manifest and iOS both use. One size only:
|
|
the dithered gradient does not compress, and a 512 copy would add 150 KB to the
|
|
payload for a splash screen a plain-HTTP shortcut never shows.
|
|
Needs the launcher toolchain image (clang for the host); tests/test_launcher.py
|
|
checks the committed files still match a fresh render.
|
|
"""
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT / 'tools'))
|
|
import package_launcher as package
|
|
|
|
ICONS = {'client/icon-192.png': 192}
|
|
|
|
|
|
def main():
|
|
package.build_art_tool()
|
|
for name, size in ICONS.items():
|
|
package.render(['icon', str(size)], ROOT / name, size, size)
|
|
print(f'{name} {size}x{size} {(ROOT / name).stat().st_size:,} bytes')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|