Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
tests: every front page's theme count is the number of theme folders
xbshengbcb9450e3ea6
diff --git a/README.de.md b/README.de.mdindex 43983ab9d..e95ccf3b8 100644--- a/README.de.md+++ b/README.de.md@@ -256,7 +256,7 @@ Gerät übrig bleibt, steht in der [Fehlerbehebung](docs/TROUBLESHOOTING.md).|---|---|| **Einrichten** | Dock-Reihenfolge, versteckte Apps, Live-TV-App, 4 bis 7 Kacheln je Zeile, reduzierte Bewegung. Alles in [`config.xml`](launcher/app/src/main/res/values/config.xml) || **Einstellungen am Fernseher** | OK auf Einstellungen halten für die Launcher-Einstellungen. Ein optionales `launcher_settings_button` lässt einen normalen Klick sie direkt öffnen; die TV-Einstellungen bleiben auf der Einstellungsseite und ihrer App-Kachel. |-| **Themes** | Hintergrund, Wallpaper und Layout aus einer `config.json`, über WLAN aufgespielt, ohne neuen Build. Zehn liegen in [`themes/`](themes/), das eingebaute `default/` mitgerechnet |+| **Themes** | Hintergrund, Wallpaper und Layout aus einer `config.json`, über WLAN aufgespielt, ohne neuen Build. Elf liegen in [`themes/`](themes/), das eingebaute `default/` mitgerechnet || **30 Sprachen** | Folgt der Sprache des Fernsehers, mit vollständig gespiegeltem Layout von rechts nach links für Hebräisch || **App-Bibliothek** | Optional: jede installierte App durchsehen und Home-Verknüpfungen hinzufügen oder entfernen. Siehe [die Anleitung zur App-Bibliothek](docs/app-library.md) || **Kachelmenü** | Optional (`tile_menu`): OK auf einer Kachel halten für Verschieben, Von Home entfernen und App-Info. Aus: OK halten öffnet App-Info |diff --git a/README.nl.md b/README.nl.mdindex f84e639a2..329818a0f 100644--- a/README.nl.md+++ b/README.nl.md@@ -606,7 +606,7 @@ De **tv** moet Android 8.0 (API 26) of nieuwer gebruiken. `minSdk` stelt de mini|---|---|| **Configuratie** | Volgorde van het dock, verborgen apps, Live-tv-app, 4 tot 7 tegels per rij en minder beweging. Alles staat in [`config.xml`](launcher/app/src/main/res/values/config.xml). || **Instellingen op de tv** | Houd OK ingedrukt op Instellingen om de launcherinstellingen te openen. Met de optionele instelling `launcher_settings_button` opent een gewone klik ze direct; de tv-instellingen blijven beschikbaar via de instellingenpagina en de tegel van die app. |-| **Thema's** | Achtergrond, wallpaper en indeling komen uit een via wifi verzonden `config.json`; opnieuw bouwen is niet nodig. In [`themes/`](themes/) staan tien thema's, inclusief het ingebouwde `default/`. |+| **Thema's** | Achtergrond, wallpaper en indeling komen uit een via wifi verzonden `config.json`; opnieuw bouwen is niet nodig. In [`themes/`](themes/) staan elf thema's, inclusief het ingebouwde `default/`. || **30 talen** | Volgt de taal van de tv, met een volledig gespiegeld rechts-naar-links ontwerp voor Hebreeuws. || **Appbibliotheek** | Optioneel: bekijk alle geïnstalleerde apps en voeg snelkoppelingen op het startscherm toe of verwijder ze. Zie [de handleiding voor de appbibliotheek](docs/app-library.md). || **Tegelmenu** | Optioneel (`tile_menu`): houd OK ingedrukt op een tegel voor Verplaatsen, Verwijderen van startscherm en App-info. Staat dit uit, dan opent lang indrukken de app-info. |diff --git a/docs/workflows/theme.md b/docs/workflows/theme.mdindex d648e20db..4b3694c1a 100644--- a/docs/workflows/theme.md+++ b/docs/workflows/theme.md@@ -10,9 +10,11 @@Home with the focus on the dock: a JPEG at 1280x720 (16:9), at most 300 KB. Not a mock-up, not anemulator. `tests/test_themes.py` fails without it.4. Add a row to the table in `themes/README.md` showing the screenshot, like the others.-5. Bump the count in `README.md`'s Themes feature row (the `N ship in themes/` sentence):- `tests/test_readme_theme_count.py` counts the folders that carry a `config.json` and fails until the- sentence says the same number.+5. Bump the count in the Themes feature row of every front page that states it: today `README.md`+ ("`N ship in themes/`"), `README.de.md` and `README.nl.md`, each in its own words; the three are+ today's pages rather than the rule. `tests/test_readme_theme_count.py` counts the folders that carry a+ `config.json` and fails on a page whose number is not that count, naming the page and the folders+ (`README.nl.md says 10 themes and themes/ holds 11: aurora, ...`).6. A look that needs a new key is a launcher switch first, in its own PR.Then run the tests: `python3 -m unittest discover -s tests -v`.diff --git a/tests/test_readme_theme_count.py b/tests/test_readme_theme_count.pyindex 4ffe77ee4..3be3f8bd2 100644--- a/tests/test_readme_theme_count.py+++ b/tests/test_readme_theme_count.py@@ -1,14 +1,26 @@-"""The front page's theme count matches the themes/ folder.+"""The front page's theme count matches the themes/ folder, on every front page.README.md's feature table answers "what can I get without a rebuild?" with a themes row, and that-row carries a number: "Five ship in themes/". The number is a claim about the tree, and nothing read+row carries a number: "eleven ship in themes/". The number is a claim about the tree, and nothing readit: it was written when themes/ held five folders (aurora, default, dussehra, scenes, six-columns)and stayed at five while glass and ruska were added, so the page offered a reader two fewer looksthan the repo ships.+The count is on more than one front page. README.de.md and README.nl.md carry the same feature row+in their own words ("Zehn liegen in themes/", "staan tien thema's"), and nothing read those: on+main both still say ten while themes/ holds eleven, so the German and Dutch pages offer a reader one+fewer look than the English one does - the gap #2132 and #2461 closed for the press counts, on the+number a theme PR moves.++The number is never copied here. A page's count is read out of the sentence it writes it in, through+one table of the words these three languages state a number in, so a theme folder added by a PR moves+this test with that page, and a page that starts stating the count is held the same way. A word the+table does not carry names the page that wrote it rather than reading as no claim at all; one is left+out of the table on purpose, since "een" and "ein" are also the articles these languages put before a+noun, and a single-theme repo is not a thing.+A theme folder is one with a config.json - the same rule tests/test_themes.py uses, and the same one-the launcher pushes (tools/theme.sh reads a folder's config.json). The number in the row is read-from the page, never copied here, so a third theme cannot land without the sentence following.+the launcher pushes (tools/theme.sh reads a folder's config.json).Run from the repository root: python3 -m unittest discover -s tests -v"""@@ -32,6 +44,24 @@ WORDS = {"seven": 7, "eight": 8, "nine": 9, "ten": 10, "eleven": 11, "twelve": 12,}+# Every feature row that names themes/ and states how many ship there, whatever language it is in:+# English "eleven ship in", German "Zehn liegen in", Dutch "staan tien thema's". The words come from+# the three languages the front pages are written in today, two to twenty each; one is left out+# because "een" and "ein" are also the articles those languages put before a noun, so an English+# "one" would read a Dutch sentence as a claim of one theme.+NUMBER_WORDS = {**WORDS, "thirteen": 13, "fourteen": 14, "fifteen": 15, "sixteen": 16,+ "seventeen": 17, "eighteen": 18, "nineteen": 19, "twenty": 20,+ "zwei": 2, "drei": 3, "vier": 4, "fünf": 5, "sechs": 6, "sieben": 7, "acht": 8,+ "neun": 9, "zehn": 10, "elf": 11, "zwölf": 12, "dreizehn": 13, "vierzehn": 14,+ "fünfzehn": 15, "sechzehn": 16, "siebzehn": 17, "achtzehn": 18, "neunzehn": 19,+ "zwanzig": 20,+ "twee": 2, "drie": 3, "vijf": 5, "zes": 6, "zeven": 7, "negen": 9, "tien": 10,+ "twaalf": 12, "dertien": 13, "veertien": 14, "vijftien": 15, "zestien": 16,+ "zeventien": 17, "achttien": 18, "negentien": 19, "twintig": 20}+THEMES_LINK = "[`themes/`](themes/)"+NUMBER = re.compile(r"\b(\d+|" + "|".join(sorted((re.escape(w) for w in NUMBER_WORDS),+ key=len, reverse=True)) + r")\b", re.IGNORECASE)+def themes_row(text):"""The README feature row for themes, or None when the page has no such row."""@@ -59,6 +89,29 @@ def theme_folders(root=THEMES):return sorted(p.name for p in root.iterdir() if p.is_dir() and (p / "config.json").is_file())+def front_pages(root=ROOT):+ """Every front page: README.md and the translations beside it."""+ return sorted(p for p in root.glob("README*.md") if p.is_file())+++def claims(text):+ """[(number, line)] for every line that names themes/ and states how many ship there.++ A page's sentence puts the count either side of the link ("eleven ship in themes/", "staan tien+ thema's"), so the line is read as a whole and every number word on it is taken as a claim. A line+ that names themes/ without a number - the Tools table row that pushes a folder from themes/ - is+ not one.+ """+ found = []+ for line in text.split("\n"):+ if THEMES_LINK not in line:+ continue+ values = {int(t) if t.isdigit() else NUMBER_WORDS[t.lower()] for t in NUMBER.findall(line)}+ if values:+ found.append((values, line))+ return found++class ReadmeThemeCountTest(unittest.TestCase):def test_the_count_names_every_theme(self):row = themes_row(FRONT.read_text(encoding="utf-8"))@@ -71,6 +124,28 @@ class ReadmeThemeCountTest(unittest.TestCase):claimed, len(shipped),f"the Themes row says {claimed} and themes/ holds {len(shipped)}: {', '.join(shipped)}")+ def test_every_front_page_names_the_same_themes(self):+ shipped = theme_folders()+ stating = []+ for page in front_pages():+ for values, line in claims(page.read_text(encoding="utf-8")):+ with self.subTest(page=page.name):+ self.assertEqual(len(values), 1,+ f"{page.name} states more than one number beside the themes/ "+ f"link, so which one is the count cannot be read: {line}")+ claimed = next(iter(values))+ stating.append(page.name)+ self.assertEqual(+ claimed, len(shipped),+ f"{page.name} says {claimed} themes and themes/ holds {len(shipped)}: "+ f"{', '.join(shipped)}")+ # The walk above passes while finding nothing, which is how the German and Dutch rows went+ # stale in the first place: these three pages state the count today, so one that stops+ # saying it fails here rather than quietly leaving the check.+ self.assertEqual(sorted(set(stating)), ["README.de.md", "README.md", "README.nl.md"],+ "the front pages that state the theme count are not the three that did: "+ f"{sorted(set(stating))}")+class CountTest(unittest.TestCase):"""The readers above, so the repo-wide test cannot pass by finding nothing."""@@ -103,6 +178,64 @@ class CountTest(unittest.TestCase):(root / "README.md").write_text("not a folder", encoding="utf-8")self.assertEqual(["aurora"], theme_folders(root))+ def test_a_translated_sentence_is_read(self):+ german = "| **Themes** | ... Elf liegen in [`themes/`](themes/) |"+ dutch = "| **Thema's** | In [`themes/`](themes/) staan elf thema's |"+ self.assertEqual([({11}, german)], claims(german))+ self.assertEqual([({11}, dutch)], claims(dutch))++ def test_a_digits_count_is_read_in_any_sentence(self):+ self.assertEqual([({12}, "| **Themes** | 12 liegen in [`themes/`](themes/) |")],+ claims("| **Themes** | 12 liegen in [`themes/`](themes/) |"))++ def test_a_row_that_does_not_state_a_count_is_not_a_claim(self):+ tools = "| [`theme.sh`](tools/theme.sh) | Push a folder from [`themes/`](themes/) |"+ self.assertEqual([], claims(tools))+ self.assertEqual([], claims("No themes yet."))++ def test_a_page_stating_one_number_beside_the_link_is_the_count(self):+ page = ("| **Themes** | Background and layout. Zehn liegen in [`themes/`](themes/) |\n"+ "| **[`themes/`](themes/)** | where they live |\n")+ self.assertEqual([({10}, "| **Themes** | Background and layout. Zehn liegen in "+ "[`themes/`](themes/) |")], claims(page))++ def test_two_numbers_on_one_line_cannot_be_read_as_the_count(self):+ line = "| **Themes** | Zehn liegen in [`themes/`](themes/), elf mit `default/` |"+ self.assertEqual([({10, 11}, line)], claims(line))++ def test_a_word_the_table_does_not_carry_is_not_silently_skipped(self):+ # "elf" is German and Dutch for eleven and English for nothing this page would say; a page+ # that writes the count in a word missing from the table would read as making no claim at+ # all, which is how the two translations stayed at ten. The table is the one place to add it.+ self.assertIn("elf", NUMBER_WORDS)+ self.assertNotIn("een", NUMBER_WORDS)++ def test_every_front_page_in_a_stand_in_tree_is_walked(self):+ with tempfile.TemporaryDirectory() as tmp:+ root = Path(tmp)+ (root / "README.md").write_text("eleven ship in [`themes/`](themes/)", encoding="utf-8")+ (root / "README.de.md").write_text("Zehn liegen in [`themes/`](themes/)", encoding="utf-8")+ (root / "docs").mkdir()+ (root / "docs" / "README.other.md").write_text("nothing", encoding="utf-8")+ self.assertEqual(["README.de.md", "README.md"],+ [p.name for p in front_pages(root)])++ def test_a_page_that_names_one_too_few_is_refused(self):+ """The failure the German and Dutch pages carried: a stand-in tree with four themes and a+ page that says three."""+ with tempfile.TemporaryDirectory() as tmp:+ root = Path(tmp)+ for name in ("aurora", "default", "glass", "ruska"):+ (root / "themes" / name).mkdir(parents=True)+ (root / "themes" / name / "config.json").write_text("{}", encoding="utf-8")+ shipped = theme_folders(root / "themes")+ self.assertEqual(4, len(shipped))+ page = "| **Themes** | Drei liegen in [`themes/`](themes/) |"+ (root / "README.de.md").write_text(page, encoding="utf-8")+ claimed = next(iter(claims(page)))[0]+ self.assertNotEqual(claimed, {len(shipped)},+ "a page saying three themes must not read as the four that ship")+if __name__ == "__main__":unittest.main()