Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
the1812 committed May 6, 2022
1 parent e134e1b commit 9513b4a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
21 changes: 17 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ npm install
```

## 添加其他数据源
`src/core/metadata/`中添加文件`xxx.ts`, 继承`MetadataSource`类:
`src/core/metadata/` 中添加文件 `xxx.ts`, 继承 `MetadataSource` 类:
```TypeScript
import { MetadataSource } from './metadata-source'
import { Metadata } from './metadata'
Expand All @@ -24,7 +24,7 @@ export class XXX extends MetadataSource {
}
export const xxx = new XXX()
```
然后在`src/core/metadata/source-mappings.ts`中添加对应项:
然后在 `src/core/metadata/source-mappings.ts` 中添加对应项:
```TypeScript
import { thbWiki } from './thb-wiki';
import { xxx } from './xxx';
Expand All @@ -37,7 +37,7 @@ export const sourceMappings = {
```

## 添加其他文件类型支持
`src/core/writer/`中添加文件`xxx-writer.ts`, 继承`MetadataWriter`类:
`src/core/writer/` 中添加文件 `xxx-writer.ts`, 继承 `MetadataWriter` 类:
```TypeScript
import { MetadataWriter } from './metadata-writer'
import { Metadata } from './metadata'
Expand All @@ -48,7 +48,7 @@ export class XxxWriter extends MetadataWriter {
}
export const xxxWriter = new XxxWriter()
```
然后在`src/core/writer/writer-mappings.ts`中添加对应项:
然后在 `src/core/writer/writer-mappings.ts` 中添加对应项:
```TypeScript
import { MetadataWriter } from './metadata-writer'
import { mp3Writer } from './mp3-writer'
Expand All @@ -64,3 +64,16 @@ export const writerMappings = {
```powershell
tsc
```

## 本地版本
由于 yarn 不支持 global link, 这里只能用 npm.

安装:
```powershell
npm link
```

卸载:
```powershell
npm uninstall -g touhou-tagger
```
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Touhou Tagger
[THBWiki](http://thwiki.cc/首页) 自动填写东方Project CD曲目信息.
[THBWiki](http://thwiki.cc/首页) 自动填写东方 Project CD 曲目信息.

支持的曲目信息包括:
- 标题
Expand Down Expand Up @@ -132,7 +132,7 @@ thtag --no-interactive
```

### 批量运行
假设总的文件夹叫`folder`, 里面有多个文件夹, 每个文件夹包含一张专辑, 文件夹名称为专辑名称
假设总的文件夹叫 `folder`, 里面有多个文件夹, 每个文件夹包含一张专辑, 文件夹名称为专辑名称
> 当前路径就在 `folder` 里的时候, 用 `thtag -b .` 就行了, `.` 表示当前文件夹
```powershell
Expand All @@ -144,6 +144,27 @@ thtag --batch folder
```
程序会将里面的子文件夹逐个进行专辑信息获取.

#### 设置文件夹层级
如果专辑文件夹并不是直接放在 `folder` 下的, 而是有更深的层级, 可以更改批量运行时搜索文件夹的层级来获取正确的专辑文件夹列表.

例如按社团分类后, 专辑相对于 `folder` 隔了两层:
```
folder
├─社团1
│ └─专辑A
└─社团2
└─专辑B
```

将层级设为 `2` 就可以检测到里面的专辑:
```powershell
thtag -bd 2
```
```powershell
thtag --batch-depth 2
```

### 超时 / 重试
默认 30 秒后无法完成专辑信息下载判定为超时, 并自动进行重试, 总尝试次数到达默认的 3 次后, 程序会判为失败并停止.

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "touhou-tagger",
"version": "1.2.2",
"description": "从 THBWiki 自动填写东方Project CD曲目信息.",
"version": "1.3.0",
"description": "从 THBWiki 自动填写东方 Project CD 曲目信息.",
"main": "dist/core/index.js",
"bin": {
"thtag": "dist/cli/index.js"
Expand Down

0 comments on commit 9513b4a

Please sign in to comment.