From 19e1ce2f45416884cece315a2612792567634e93 Mon Sep 17 00:00:00 2001 From: wowlikon Date: Thu, 2 Oct 2025 10:32:51 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B0=D1=82=D1=87=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=B2=D1=8B=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=BE=20=D1=80=D0=B5=D0=BB=D0=B8=D0=B7=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- configs/color_theme.json | 18 +-------------- configs/selectable_text.json | 1 + main.py | 3 --- patches/selectable_text.py | 43 ++++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 configs/selectable_text.json create mode 100644 patches/selectable_text.py diff --git a/configs/color_theme.json b/configs/color_theme.json index d38eff4..01db6eb 100644 --- a/configs/color_theme.json +++ b/configs/color_theme.json @@ -1,17 +1 @@ -{ - "enabled": true, - "logo": { - "gradient": { - "angle": 0.0, - "start_color": "#ffccff00", - "end_color": "#ffcccc00" - }, - "ears_color": "#ffd0d0d0" - }, - "colors": { - "primary": "#ccff00", - "secondary": "#ffcccc00", - "background": "#ffffff", - "text": "#000000" - } -} +{"enabled":true,"logo":{"gradient":{"angle":0.0,"start_color":"#ffccff00","end_color":"#ffcccc00"},"ears_color":"#ffd0d0d0"},"colors":{"primary":"#ccff00","secondary":"#ffcccc00","background":"#ffffff","text":"#000000"}} \ No newline at end of file diff --git a/configs/selectable_text.json b/configs/selectable_text.json new file mode 100644 index 0000000..310f75e --- /dev/null +++ b/configs/selectable_text.json @@ -0,0 +1 @@ +{"enabled":true} \ No newline at end of file diff --git a/main.py b/main.py index 970c5ef..cdde703 100644 --- a/main.py +++ b/main.py @@ -1,17 +1,14 @@ from typing import List, Dict, Any -import httpx import typer import importlib import traceback import yaml -from pydantic import BaseModel, ValidationError from plumbum import local, ProcessExecutionError from rich.console import Console from rich.progress import Progress from rich.prompt import Prompt -from rich.table import Table from utils.config import * from utils.tools import * diff --git a/patches/selectable_text.py b/patches/selectable_text.py new file mode 100644 index 0000000..029093e --- /dev/null +++ b/patches/selectable_text.py @@ -0,0 +1,43 @@ +""" + Делает текст в описании аниме копируемым + +"selectable_text": { + "enabled": true +} +""" + +priority = 0 + +# imports +from tqdm import tqdm +from lxml import etree +from typing import Dict, Any +from pydantic import Field + +from utils.config import PatchConfig + +#Config +class Config(PatchConfig): ... + +# Patch +def apply(config: Config, base: Dict[str, Any]) -> bool: + + file_path = "./decompiled/res/layout/release_info.xml" + + parser = etree.XMLParser(remove_blank_text=True) + tree = etree.parse(file_path, parser) + root = tree.getroot() + + # Список тегов, к которым нужно добавить атрибут + tags = ["TextView", "at.blogc.android.views.ExpandableTextView"] + + for tag in tags: + for element in root.findall(f".//{tag}", namespaces=base["xml_ns"]): + # Проверяем, нет ли уже атрибута + if f"{{{base['xml_ns']['android']}}}textIsSelectable" not in element.attrib: + element.set(f"{{{base['xml_ns']['android']}}}textIsSelectable", "true") + + # Сохраняем обратно + tree.write(file_path, encoding="utf-8", xml_declaration=True, pretty_print=True) + + return True