forked from hhj/subscript_template
add global rules
This commit is contained in:
parent
6a4904ebb3
commit
1d9dcf8b4f
36
README.md
36
README.md
@ -1,13 +1,43 @@
|
||||
# 小新记账订阅模板
|
||||
|
||||
### 规则编写
|
||||
APP对应规则写在apps目录下
|
||||
|
||||
APP 对应规则写在 apps 目录下
|
||||
|
||||
- 文件名格式为包名点分割末尾字符
|
||||
|
||||
### 生成订阅JSON文件
|
||||
### 生成订阅 JSON 文件
|
||||
|
||||
```
|
||||
python main.py
|
||||
```
|
||||
|
||||
生成完毕之后目标JSON文件在`dist`目录,文件名格式为`${VERSION}.json`
|
||||
生成完毕之后目标 JSON 文件在`dist`目录,文件名格式为`${VERSION}.json`
|
||||
|
||||
### 属性说明
|
||||
|
||||
#### `global` 全局规则
|
||||
|
||||
- `name` 全局规则名称
|
||||
- `rules` 规则列表
|
||||
- `apps` 全局规则匹配的应用
|
||||
- `id` 应用包名
|
||||
- `enable` 是否默认启用
|
||||
|
||||
#### `rules` 规则列表
|
||||
|
||||
- `key` 规则的唯一 ID
|
||||
- `selector` 元素选择器
|
||||
- `action` 操作类型,支持`setText`、`click`、`longClick`、`back`
|
||||
- `actionDelay` 操作完成后的延迟,单位 ms
|
||||
- `args` 当`action`为`setText`时填充的字符串
|
||||
- `preAction` 当前操作的前置操作的`key`
|
||||
- `activityId` 指定的 Activity
|
||||
- `classId` 指定的 className
|
||||
|
||||
#### `apps` 应用规则
|
||||
|
||||
- `packageName` 应用包名
|
||||
- `name` 应用名
|
||||
- `version` 应用版本
|
||||
- `rules` 规则列表
|
||||
|
14
global_rules.py
Normal file
14
global_rules.py
Normal file
@ -0,0 +1,14 @@
|
||||
global_rules = {
|
||||
"name": "全局测试",
|
||||
"rules": [
|
||||
{
|
||||
"key": 0,
|
||||
"selector": "[text='记账']",
|
||||
"action": "click",
|
||||
"actionDelay": 50,
|
||||
}
|
||||
],
|
||||
"apps": [
|
||||
{"id": "tech.cqxqg.hhjapp", "enable": True},
|
||||
],
|
||||
}
|
@ -1,16 +1,21 @@
|
||||
import importlib.util
|
||||
import os
|
||||
from global_rules import global_rules
|
||||
|
||||
|
||||
version = "0.0.1_alpha"
|
||||
key = -1
|
||||
name = "Test Subscription"
|
||||
version = "0.0.1_beta"
|
||||
|
||||
|
||||
def get_subscription():
|
||||
apps_folder = "apps"
|
||||
apps = get_global_vars_from_apps(apps_folder)
|
||||
return {
|
||||
"key": key,
|
||||
"name": name,
|
||||
"version": version,
|
||||
"apps": apps,
|
||||
"global": global_rules,
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user