Skip to content

Commit 9e1cbc6

Browse files
committed
Multilingual support
1 parent dec1331 commit 9e1cbc6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+11833
-321
lines changed

Aria2.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ func aria2Load() {
1616
var err error
1717
aria2Rpc, err = rpc.New(context.Background(), info.Aria2Server, info.Aria2Key, time.Second*10, &Aria2Notifier{})
1818
dropErr(err)
19-
log.Printf("connecting to %s", info.Aria2Server)
19+
log.Printf(locText("connectTo"), info.Aria2Server)
2020
version, err := aria2Rpc.GetVersion()
2121
dropErr(err)
22-
log.Printf("Aria2 websocket connection established!Aria2 Version:%s", version.Version)
22+
log.Printf(locText("connectSuccess"), version.Version)
2323
}
2424

2525
func formatTellSomething(info []rpc.StatusInfo, err error) string {
2626
dropErr(err)
2727
res := ""
2828
log.Printf("%+v\n", info)
29-
var statusFlag = map[string]string{"active": "进行中", "paused": "暂停中", "complete": "已完成", "removed": "被移除"}
29+
var statusFlag = map[string]string{"active": locText("active"), "paused": locText("paused"), "complete": locText("complete"), "removed": locText("removed")}
3030
for index, Files := range info {
3131
if Files.BitTorrent.Info.Name != "" {
3232
m := make(map[string]string)
@@ -45,11 +45,11 @@ func formatTellSomething(info []rpc.StatusInfo, err error) string {
4545
m["Speed"] = byte2Readable(downloadSpeed)
4646
m["Status"] = statusFlag[Files.Status]
4747
if Files.Status == "paused" {
48-
res += fmt.Sprintf("GID:%s\n名称: %s\n进度: %s\n大小: %s", m["GID"], m["Name"], m["Progress"], m["Size"])
48+
res += fmt.Sprintf(locText("queryInformationFormat1"), m["GID"], m["Name"], m["Progress"], m["Size"])
4949
} else if Files.Status == "complete" || Files.Status == "removed" {
50-
res += fmt.Sprintf("GID:%s\n名称: %s\n状态: %s\n进度: %s\n大小: %s", m["GID"], m["Name"], m["Status"], m["Progress"], m["Size"])
50+
res += fmt.Sprintf(locText("queryInformationFormat2"), m["GID"], m["Name"], m["Status"], m["Progress"], m["Size"])
5151
} else {
52-
res += fmt.Sprintf("GID:%s\n名称: %s\n进度: %s\n大小: %s\n速度: %s/s", m["GID"], m["Name"], m["Progress"], m["Size"], m["Speed"])
52+
res += fmt.Sprintf(locText("queryInformationFormat3"), m["GID"], m["Name"], m["Progress"], m["Size"], m["Speed"])
5353
}
5454
} else {
5555
for _, File := range Files.Files {
@@ -70,11 +70,11 @@ func formatTellSomething(info []rpc.StatusInfo, err error) string {
7070
m["Speed"] = byte2Readable(downloadSpeed)
7171
m["Status"] = statusFlag[Files.Status]
7272
if Files.Status == "paused" {
73-
res += fmt.Sprintf("GID:%s\n名称: %s\n进度: %s\n大小: %s", m["GID"], m["Name"], m["Progress"], m["Size"])
73+
res += fmt.Sprintf(locText("queryInformationFormat1"), m["GID"], m["Name"], m["Progress"], m["Size"])
7474
} else if Files.Status == "complete" || Files.Status == "removed" {
75-
res += fmt.Sprintf("GID:%s\n名称: %s\n状态: %s\n进度: %s\n大小: %s", m["GID"], m["Name"], m["Status"], m["Progress"], m["Size"])
75+
res += fmt.Sprintf(locText("queryInformationFormat2"), m["GID"], m["Name"], m["Status"], m["Progress"], m["Size"])
7676
} else {
77-
res += fmt.Sprintf("GID:%s\n名称: %s\n进度: %s\n大小: %s\n速度: %s/s\n线程数:%s", m["GID"], m["Name"], m["Progress"], m["Size"], m["Speed"], m["Threads"])
77+
res += fmt.Sprintf(locText("queryInformationFormat3"), m["GID"], m["Name"], m["Progress"], m["Size"], m["Speed"])
7878
}
7979
}
8080
}

Aria2.go.bak

-179
This file was deleted.

README.md

+71-72
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,93 @@
1-
# DownloadBot
2-
1+
[简体中文](README_zh-CN.md) [繁體中文](README_zh-TW.md)
32

4-
(目前)🤖 一个控制你的Aria2服务器的Telegram Bot。
3+
# DownloadBot
54

5+
(Currently) 🤖 A Telegram Bot that controls your Aria2 server.
66

7-
## 实现
7+
## Functions realized
88

9-
#### 下载方式
10-
- [x] Aria2 控制
11-
- [ ] [SimpleTorrent](https://github.com/boypt/simple-torrent) 控制
12-
- [ ] qbittorrent 控制
9+
#### Download method
10+
- [x] Aria2 control
11+
- [ ] [SimpleTorrent](https://github.com/boypt/simple-torrent) control
12+
- [ ] qbittorrent control
1313

14-
#### 机器人协议支持
14+
#### The robot protocol supports
1515
- [x] Telegram Bot
16-
- [ ] 钉钉机器人
17-
18-
#### 功能
19-
- [x] 下载文件
20-
- [x] 下载 HTTP/FTP 链接
21-
- [x] 下载 Magnet 链接
22-
- [x] 下载 BT 文件内的文件
23-
- [ ] 自定义的 Torrent/Magnet 下载
24-
- [ ] 不下载小于指定大小的文件
25-
- [ ] 自适应环境存储空间的 Torrent/Magnet 下载
26-
- [ ] 不下载超过存储空间的文件
27-
- [ ] 根据存储空间分块多次下载 Torrent/Magnet 内的文件
28-
- [ ] 上传文件
29-
- [ ] 下载完成后,向 OneDrive 上传文件
30-
- [ ] 下载完成后,向 Google Drive 上传文件
31-
- [ ] 下载完成后,向 Mega 上传文件
32-
- [ ] 下载完成后,向 天翼网盘 上传文件
33-
- [x] 附加其他功能
34-
- [ ] 多语言支持
35-
- [x] 简体中文
36-
- [ ] 英语
37-
- [ ] 繁体中文
38-
- [ ] 日语
39-
- [ ] 无人值守的BT站下载
16+
- [ ] DingTalk robot
17+
18+
#### Function
19+
- [x] Download files
20+
- [x] Download HTTP/FTP link
21+
- [x] Download Magnet link
22+
- [ ] Download the files in the BT file
23+
- [ ] Custom Torrent/Magnet download
24+
- [ ] Do not download files smaller than the specified size
25+
- [ ] Download Torrent/Magnet according to the size of storage space
26+
- [ ] Do not download files that exceed storage space
27+
- [ ] Download the files in Torrent/Magnet several times according to the storage space
28+
- [ ] Upload a file
29+
- [ ] Upload the file to OneDrive when the download is complete
30+
- [ ] Upload a file to Google Drive when the download is complete
31+
- [ ] Upload the file to Mega when the download is complete
32+
- [ ] Upload the file to 189Cloud when the download is complete
33+
- [x] Additional features
34+
- [x] Multilingual support
35+
- [x] Simplified Chinese
36+
- [x] English
37+
- [x] Traditional Chinese
38+
- [ ] Japanese
39+
- [ ] Download of unattended BT station
4040
- [ ] Nyaa
4141
- [ ] ThePirateBay
42-
- [ ] 其他功能
43-
- [ ] 通过演员ID获取在DMM中使用的所有CID
44-
- [ ] 查询 "ikoa "中的影片参数(利用mahuateng)
45-
- [ ] 通过javlibary演员网址获得所有演员的编号。
46-
- [ ] 查询dmm cid信息、预览影片、预览图片。
47-
- [ ] 在sukebei中按关键词搜索。
48-
- [ ] 根据关键词在dmm中搜索,最多30项。
49-
- [ ] 输入dmm链接,列出所有项目。
50-
- [ ] 搜索当前dmm热门和最新电影,限制30条(测试版)
51-
52-
## 目前特点
53-
1. 完全基于触摸,更容易使用,使用这个机器人基本不需要命令。
54-
2. 实时通知,使用Aria2的Websocket协议进行通信。
55-
3. 更好的配置文件支持。
56-
57-
## 开始
58-
59-
1. 通过[@BotFather](https://telegram.me/botfather)创建您自己的bot并使用。
60-
2. (可选)您所在地区/国家的Telegram被封锁?一定要有一个 **HTTP** proxy启动并运行,您可以设置您的系统环境变量`HTTPS_PROXY`为代理地址来进行代理。
61-
3. 下载本程序
62-
4. 在想要执行本程序的根目录配置`config.json`
63-
5. 运行可执行文件
64-
65-
## 三种方式传递参数
66-
您可以通过三种方式将参数传递给`DownloadBot`
67-
* [X] 配置文件
68-
* [ ] Cil 命令行
69-
* [ ] 系统环境变量
70-
42+
- [ ] Other functions
43+
- [ ] Get all CIDs used in DMM via actor ID
44+
- [ ] Query the movie parameters in "ikoa" (using mahuateng).
45+
- [ ] Get the numbers of all actors via the javlibary actors' website.
46+
- [ ] Query the dmm cid information, preview the movie, preview the picture.
47+
- [ ] Search by keyword in sukebei.
48+
- [ ] Search in dmm based on keywords, up to 30 items.
49+
- [ ] Enter the dmm link to list all items.
50+
- [ ] Search for current dmm hits and the latest movies, limited to 30 (beta).
51+
52+
## Current features
53+
1. Fully touch based, more easy to use, no command required to use this bot.
54+
2. Real time notification, it's now using Aria2's Websocket protocol to communicate.
55+
3. Better config file support.
56+
57+
## Setup
58+
59+
1. Create your own bot and get its access token by using [@BotFather](https://telegram.me/botfather)
60+
2. (Optional) Telegram blocked in your region/country? be sure to have a HTTP proxy up and running,and You can set your system environment variable `HTTPS_ Proxy` is the proxy address.
61+
3. Download this program
62+
4. Configure `config.json` at the root of the program that you want to execute.
63+
5. Run the executable file
64+
65+
## 3 ways to pass parameters
66+
You can pass parameters to `DownloadBot in three ways:
67+
* [X] configuration file
68+
* [ ] cli
69+
* [ ] environment variable
7170

7271
Option priorities also follow this order, so cli has the highest priority.
7372

74-
| | Aria2 server | Aria2 key | Telegram bot key | Telegram user id |Max items in range(default 20) |
75-
|----------------------------- |----------------- |-------------- |------------------ |------------------ |-------------------------------- |
76-
| 配置文件 参数 | aria2-server | aria2-key | bot-key | user-id |max-index |
77-
| Cil 命令行 参数 | --aria2-server | --aria2-key | --bot-key | --user-id |--max-index |
78-
| 系统环境变量参数 | ta.aria2-server | ta.aria2-key | ta.bot-key | ta.user-id |ta.max-index |
79-
73+
| | Aria2 server | Aria2 key | Telegram bot key | Telegram user id | Max items in range(default 20) | language |
74+
|-----------------------------|-----------------|--------------|------------------|------------------|--------------------------------|-------------|
75+
| configuration file option | aria2-server | aria2-key | bot-key | user-id | max-index | language |
76+
| cli option | --aria2-server | --aria2-key | --bot-key | --user-id | --max-index | --language |
77+
| environment variable option | ta.aria2-server | ta.aria2-key | ta.bot-key | ta.user-id | ta.max-index | ta.language |
8078

81-
### 配置文件示例
79+
## Example of a profile
8280

8381
```json
8482
{
8583
"aria2-server": "ws://192.168.1.154:6800/jsonrpc",
8684
"aria2-key": "xxx",
87-
"proxy": "http://127.0.0.1:7890",
8885
"bot-key": "123456789:xxx",
8986
"user-id": "123456",
90-
"max-index": 10
87+
"max-index": 10,
88+
"language":"en"
9189
}
9290
```
93-
如果您不知道您的 `user-id` ,可以将此项留空,在运行这个机器人后输入`/myid`,此机器人就会返回您的`user-id`.
91+
If you don't know your `user-id`, you can leave this field blank and enter `/myid` after running the robot, and the robot will return your `user-id`
92+
9493

0 commit comments

Comments
 (0)