mirror of
https://github.com/Gathin23/cleanyourtv.git
synced 2026-11-03 20:46:47 +00:00
Disable 25 Xiaomi/Google bloat packages (telemetry, PatchWall, SmartShare, MiLink, update service, Alexa bridge, preloads) with a restore script and pre-change package backups. Add a native Android TV launcher (launcher/): black background, bottom dock with four favourites in a rounded band, app grid below, a single spring- animated glass highlight, ambient glow and large title for the focused dock app, frosted Inputs / Wi-Fi / Settings pills, Outfit clock, and a compact Inputs dropdown driving the TV input framework. Add tools/tv.py, a pure-Python ADB client that works around macOS Local Network privacy blocking the stock adb, plus a chunked base64 uploader. Include the reusable prompt (PROMPT.md), before/after photos and licences.
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Fallback file transfer: send a file to the TV as base64 chunks through plain shell commands.
|
|
|
|
Usage: b64push.py <local file> <remote path>
|
|
"""
|
|
import base64
|
|
import hashlib
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
import tv # noqa: E402
|
|
|
|
CHUNK = 48 * 1024 # raw bytes per shell command (base64 grows it by 4/3)
|
|
|
|
|
|
def main():
|
|
local, remote = sys.argv[1], sys.argv[2]
|
|
data = open(local, "rb").read()
|
|
want = hashlib.md5(data).hexdigest()
|
|
dev = tv.connect()
|
|
tmp = remote + ".b64"
|
|
dev.shell(f"rm -f {remote} {tmp}")
|
|
n = (len(data) + CHUNK - 1) // CHUNK
|
|
for i in range(n):
|
|
part = base64.b64encode(data[i * CHUNK:(i + 1) * CHUNK]).decode()
|
|
out = dev.shell(f"echo '{part}' >> {tmp} && echo ok{i}", read_timeout_s=60.0)
|
|
if f"ok{i}" not in out:
|
|
print(f"chunk {i} failed: {out}")
|
|
sys.exit(1)
|
|
print(f"\rchunk {i + 1}/{n}", end="", flush=True)
|
|
print()
|
|
out = dev.shell(f"base64 -d {tmp} > {remote} && rm {tmp} && md5sum {remote}", read_timeout_s=120.0)
|
|
got = out.split()[0] if out.strip() else ""
|
|
print("md5 remote:", got, "local:", want, "MATCH" if got == want else "MISMATCH")
|
|
dev.close()
|
|
sys.exit(0 if got == want else 1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|