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
docs: the showcase recipe names the third page that spells the count, and the Portuguese one catches up
xbsheng5135b195118f
diff --git a/README.pt-BR.md b/README.pt-BR.mdindex 5dc1c17c8..73fe5e3f3 100644--- a/README.pt-BR.md+++ b/README.pt-BR.md@@ -518,7 +518,7 @@ as mesmas regras para ele.|---|---|| **Lista de remoção da sua TV** | É a contribuição mais útil: a próxima pessoa com esse modelo não precisará fazer a etapa de identificação. || **Launcher e prompt** | Melhorias no launcher e ajustes para deixar o prompt mais claro também são bem-vindos. |-| **Criou algo com base no projeto?** | Um launcher, port ou tema: adicione-o ao [SHOWCASE.md](SHOWCASE.md), que já reúne cento e noventa e três projetos organizados em telas iniciais, forks, complementos, ferramentas e outras plataformas, além de um índice por marca de TV. |+| **Criou algo com base no projeto?** | Um launcher, port ou tema: adicione-o ao [SHOWCASE.md](SHOWCASE.md), que já reúne duzentos e dezoito projetos organizados em telas iniciais, forks, complementos, ferramentas e outras plataformas, além de um índice por marca de TV. |As pessoas cujo trabalho faz parte deste repositório:diff --git a/docs/workflows/showcase.md b/docs/workflows/showcase.mdindex 563675f47..c870d524e 100644--- a/docs/workflows/showcase.md+++ b/docs/workflows/showcase.md@@ -9,9 +9,12 @@the same brand. `tests/test_showcase_brand_index.py` fails on a brand named twice - "a brand is listedtwice in 'Find a project by TV brand', so a project on one of the lines is hard to find" - and printsthe links only one of the two lines carries, which is a fork nobody scrolling the first line sees.-2. Bump the two counts by one: `SHOWCASE.md` opens with an `N projects so far.` line, and the "Built- something on top?" row in `README.md` spells the same number in words. `tests/test_showcase_project_count.py`- refuses a row that leaves either of them behind.+2. Bump the three counts by one: `SHOWCASE.md` opens with an `N projects so far.` line, and the "Built+ something on top?" row spells the same number in words on two front pages - `README.md` ("... projects+ already live") and `README.pt-BR.md` ("que já reúne ... projetos"). `tests/test_showcase_project_count.py`+ counts the rows and reads each page's spelled number with the parser for its language (its+ SPELLED_PAGES table, which is where a translation that starts spelling the count is added), and+ refuses a row that leaves any of the three behind.3. Keep each cell to one line: what it is, what it was built and tested on, and the author.4. The project is open source with a link people can read and build, says which TV it was tested on, collectsnothing beyond what its README says, and is yours or listed with the author's blessing.diff --git a/tests/test_showcase_project_count.py b/tests/test_showcase_project_count.pyindex c93aeb134..9271e2efd 100644--- a/tests/test_showcase_project_count.py+++ b/tests/test_showcase_project_count.py@@ -8,10 +8,18 @@ seventy while the page said 71.These tests read the number out of the page rather than copying it into the test, count the projectrows the way the page lays them out (a table row whose first cell is a project link), and fail when-the two disagree, naming both numbers. The README's spelled form is read through a word parser, so a-row reworded around the number still counts. No other prose is matched.--Adding a project therefore means bumping both numbers, which is what the failure message says.+the two disagree, naming both numbers. The spelled forms are read through word parsers, so a row+reworded around the number still counts. No other prose is matched.++README.pt-BR.md carries the same row in Portuguese ("que já reúne cento e noventa e três projetos"),+and nothing read it: it was translated when SHOWCASE.md held 193 rows, stood at 193 while the page+moved to 218, and the suite stayed green - so a reader of the Portuguese front page was offered 25+projects fewer than the showcase holds. Every page in SPELLED_PAGES is read now, with the parser for+its own language, so a translation that starts spelling the number is a page this test judges rather+than one it silently skips.++Adding a project therefore means bumping every page in SPELLED_PAGES, which is what the failure+message says."""import re@@ -77,24 +85,88 @@ def spelled_number(word):return None-def readme_spelled(lines):- """(number, the words it was read from) for README's "<words> projects" phrase, or (None, None).+# Portuguese number words, for the front page that spells the count in Portuguese. English needs+# "two hundred and four"; Portuguese is additive ("duzentos e dezoito") and "cento" is the hundred+# that takes a tail ("cento e noventa e três"), so a sum is the whole grammar these pages use.+PT_ONES = {+ "um": 1, "uma": 1, "dois": 2, "duas": 2, "três": 3, "quatro": 4, "cinco": 5, "seis": 6,+ "sete": 7, "oito": 8, "nove": 9, "dez": 10, "onze": 11, "doze": 12, "treze": 13, "catorze": 14,+ "quatorze": 14, "quinze": 15, "dezesseis": 16, "dezasseis": 16, "dezessete": 17,+ "dezassete": 17, "dezoito": 18, "dezenove": 19,+}+PT_TENS = {+ "vinte": 20, "trinta": 30, "quarenta": 40, "cinquenta": 50, "sessenta": 60, "setenta": 70,+ "oitenta": 80, "noventa": 90,+}+PT_HUNDREDS = {+ "cem": 100, "cento": 100, "duzentos": 200, "duzentas": 200, "trezentos": 300,+ "trezentas": 300, "quatrocentos": 400, "quatrocentas": 400, "quinhentos": 500,+ "quinhentas": 500, "seiscentos": 600, "seiscentas": 600, "setecentos": 700,+ "setecentas": 700, "oitocentos": 800, "oitocentas": 800, "novecentos": 900,+ "novecentas": 900,+}- The words directly before "projects" are tried two at a time and then one at a time ("twenty- one" needs both, "seventy-five" is one), so the sentence around the number can be reworded.++def spelled_number_pt(text):+ """"cento e noventa e três" -> 193, "duzentos e dezoito" -> 218, anything else -> None.++ No "mil": a count past 999 is a parser to extend, and an unreadable number fails loudly where a+ guessed one would silently agree with nothing.+ """+ total = 0+ for word in text.lower().replace("-", " ").split():+ if word == "e":+ continue+ if word in PT_HUNDREDS:+ total += PT_HUNDREDS[word]+ elif word in PT_TENS:+ total += PT_TENS[word]+ elif word in PT_ONES:+ total += PT_ONES[word]+ else:+ return None+ return total or None+++def spelled_count(lines, word, reader, most=6):+ """(number, the words it was read from) for a page's "<words> <word>" phrase, or (None, None).++ The words directly before the word are tried longest first and then shorter, so "twenty one"+ needs both, "seventy-five" is one, "cento e noventa e três" is five, and the sentence around the+ number can be reworded. `[^\\W\\d_]+` is every letter, accented ones included, and a hyphen keeps+ the words it joins together, so each page can spell the number in its own language."""for line in lines:- for match in re.finditer(r"projects\b", line):- words = re.findall(r"[A-Za-z-]+", line[: match.start()].rstrip())- for take in (5, 4, 3, 2, 1):+ for match in re.finditer(rf"{word}\b", line):+ words = re.findall(r"[^\W\d_]+(?:-[^\W\d_]+)*", line[: match.start()].rstrip())+ for take in range(most, 0, -1):if len(words) >= take:candidate = " ".join(words[-take:])- number = spelled_number(candidate)+ number = reader(candidate)if number is not None:return number, candidatereturn None, None+def readme_spelled(lines):+ """README.md's "<words> projects", read with the English parser."""+ return spelled_count(lines, "projects", spelled_number)+++def pt_spelled(lines):+ """README.pt-BR.md's "<words> projetos", read with the Portuguese parser."""+ return spelled_count(lines, "projetos", spelled_number_pt)+++# The pages that spell the count in words, and the word each spells it before. SHOWCASE.md's own+# "N projects so far." line is the number the rows are counted from; every page here must agree with+# it, and adding a project means bumping all of them.+SPELLED_PAGES = {+ "README.md": ("projects", spelled_number),+ "README.pt-BR.md": ("projetos", spelled_number_pt),+}++def audit(showcase_lines):"""(stated, counted, error) - error is None when the page and its rows agree."""counted = len(project_rows(showcase_lines))@@ -132,15 +204,20 @@ class ShowcaseProjectCount(unittest.TestCase):self.assertEqual(len(counted_at), 1, "expected exactly one 'N projects so far.' line")self.assertLess(counted_at[0], headings[0], "the count line belongs above the first section")- def test_readme_spells_the_same_number(self):- number, word = readme_spelled(self.readme)- self.assertIsNotNone(number, "README.md's 'Built something on top?' row lost its spelled count")+ def test_every_page_that_spells_the_count_agrees_with_the_rows(self):counted = len(project_rows(self.showcase))- self.assertEqual(- number,- counted,- f"README.md says '{word} projects' and SHOWCASE.md holds {counted} rows",- )+ for page, (word, reader) in SPELLED_PAGES.items():+ with self.subTest(page=page):+ lines = (ROOT / page).read_text(encoding="utf-8").splitlines()+ number, phrase = spelled_count(lines, word, reader)+ self.assertIsNotNone(+ number, f"{page} spells the project count in words and none was read"+ )+ self.assertEqual(+ number,+ counted,+ f"{page} says '{phrase} {word}' and SHOWCASE.md holds {counted} rows",+ )class TheCheckerItself(unittest.TestCase):@@ -197,6 +274,22 @@ class TheCheckerItself(unittest.TestCase):self.assertEqual(readme_spelled(["where one hundred and twenty-one projects live"]), (121, "one hundred and twenty-one"))self.assertEqual(readme_spelled(["a row with no count at all"]), (None, None))+ def test_portuguese_words_are_read(self):+ self.assertEqual(spelled_number_pt("cento e noventa e três"), 193)+ self.assertEqual(spelled_number_pt("Duzentos e dezoito"), 218)+ self.assertEqual(spelled_number_pt("duzentos e trinta e um"), 231)+ self.assertEqual(spelled_number_pt("cem"), 100)+ self.assertIsNone(spelled_number_pt("reúne"))+ self.assertIsNone(spelled_number_pt("cento e many"))++ def test_the_portuguese_row_is_read_and_a_number_before_the_word_is_not(self):+ row = "que já reúne cento e noventa e três projetos organizados em telas iniciais"+ self.assertEqual(pt_spelled([row]), (193, "cento e noventa e três"))+ self.assertEqual(pt_spelled(["um tema com três projetos"]), (3, "três"))+ self.assertEqual(pt_spelled(["Esses aplicativos são projetos independentes"]), (None, None))+ # A number that does not touch "projetos" is not the count.+ self.assertEqual(pt_spelled(["193 telas, e os projetos vêm depois"]), (None, None))+if __name__ == "__main__":unittest.main()