@@ -9,100 +9,11 @@ const options = yargs(hideBin(process.argv))
9
9
. parserConfiguration ( {
10
10
'short-option-groups' : false ,
11
11
} )
12
- . command (
13
- [ 'tag' , '*' ] ,
14
- '为音乐文件写入元数据' ,
15
- ( ) => {
16
- return yargs
17
- . option ( 'comment-language' , {
18
- type : 'string' ,
19
- default : configFile ?. commentLanguage ?? 'zho' ,
20
- description : '自定义 ID3 Tag 注释的语言 (ISO-639-2)' ,
21
- } )
22
- . option ( 'cover-compress-size' , {
23
- alias : 'ccs' ,
24
- type : 'number' ,
25
- default : configFile ?. coverCompressSize ?? 0 ,
26
- description : '封面达到指定的大小 (MB) 时, 自动进行压缩 (只影响嵌入文件的封面)' ,
27
- } )
28
- . option ( 'cover-compress-resolution' , {
29
- alias : 'ccr' ,
30
- type : 'number' ,
31
- default : configFile ?. coverCompressResolution ?? 0 ,
32
- description : '压缩封面时的最大边长, 超过时会进行缩放' ,
33
- } )
34
- . option ( 'source' , {
35
- alias : 's' ,
36
- type : 'string' ,
37
- default : 'thb-wiki' ,
38
- choices : [ 'thb-wiki' , 'thb-wiki-cache' , 'doujin-meta' , 'local-mp3' , 'local-json' ] ,
39
- description : '设置数据源' ,
40
- } )
41
- . option ( 'lyric' , {
42
- alias : 'l' ,
43
- type : 'boolean' ,
44
- default : false ,
45
- description : '是否启用歌词写入 (会增加运行时间)' ,
46
- } )
47
- . option ( 'lyric-type' , {
48
- alias : 'lt' ,
49
- type : 'string' ,
50
- default : configFile ?. lyric ?. type ?? 'original' ,
51
- choices : [ 'original' , 'translated' , 'mixed' ] ,
52
- description : '歌词类型, 可以选择原文/译文/混合模式' ,
53
- } )
54
- . option ( 'lyric-output' , {
55
- alias : 'lo' ,
56
- type : 'string' ,
57
- default : configFile ?. lyric ?. output ?? 'metadata' ,
58
- choices : [ 'metadata' , 'lrc' ] ,
59
- description : '歌词输出方式, 可以选择写入歌曲元数据或者保存为 lrc 文件' ,
60
- } )
61
- . option ( 'lyric-cache-size' , {
62
- alias : 'lcs' ,
63
- type : 'number' ,
64
- default : 16 ,
65
- description : '下载歌词时的最大缓存数量' ,
66
- } )
67
- . option ( 'translation-separator' , {
68
- alias : 'ts' ,
69
- type : 'string' ,
70
- default : configFile ?. lyric ?. translationSeparator ?? ' // ' ,
71
- description : '指定混合歌词模式下, 使用的分隔符' ,
72
- } )
73
- . option ( 'lyric-time' , {
74
- type : 'boolean' ,
75
- default : true ,
76
- description : '是否启用歌词时轴' ,
77
- } )
78
- . option ( 'separator' , {
79
- type : 'string' ,
80
- default : configFile ?. separator ?? DefaultMetadataSeparator ,
81
- description : '指定 mp3 元数据的分隔符' ,
82
- } )
83
- . option ( 'timeout' , {
84
- type : 'number' ,
85
- default : configFile ?. timeout ?? 30 ,
86
- description : '指定一次运行的超时时间' ,
87
- } )
88
- . option ( 'retry' , {
89
- type : 'number' ,
90
- default : configFile ?. retry ?? 3 ,
91
- description : '指定超时后自动重试的最大次数' ,
92
- } )
93
- . option ( 'interactive' , {
94
- alias : 'i' ,
95
- type : 'boolean' ,
96
- default : true ,
97
- description : '是否允许交互' ,
98
- } )
99
- } ,
100
- ( ) => {
101
- import ( './run-tagger' ) . then ( ( { runTagger } ) => {
102
- runTagger ( )
103
- } )
104
- } ,
105
- )
12
+ . command ( [ 'tag' , '*' ] , '为音乐文件写入元数据' , { } , ( ) => {
13
+ import ( './run-tagger' ) . then ( ( { runTagger } ) => {
14
+ runTagger ( )
15
+ } )
16
+ } )
106
17
. command ( 'dump' , '从音乐文件提取元数据' , { } , ( ) => {
107
18
import ( './run-dumper' ) . then ( ( { dump } ) => {
108
19
dump ( )
@@ -131,6 +42,88 @@ const options = yargs(hideBin(process.argv))
131
42
default : 1 ,
132
43
description : '指定批量模式的文件夹层级' ,
133
44
} )
45
+ . option ( 'comment-language' , {
46
+ type : 'string' ,
47
+ default : configFile ?. commentLanguage ?? 'zho' ,
48
+ description : '自定义 ID3 Tag 注释的语言 (ISO-639-2)' ,
49
+ } )
50
+ . option ( 'cover-compress-size' , {
51
+ alias : 'ccs' ,
52
+ type : 'number' ,
53
+ default : configFile ?. coverCompressSize ?? 0 ,
54
+ description : '封面达到指定的大小 (MB) 时, 自动进行压缩 (只影响嵌入文件的封面)' ,
55
+ } )
56
+ . option ( 'cover-compress-resolution' , {
57
+ alias : 'ccr' ,
58
+ type : 'number' ,
59
+ default : configFile ?. coverCompressResolution ?? 0 ,
60
+ description : '压缩封面时的最大边长, 超过时会进行缩放' ,
61
+ } )
62
+ . option ( 'source' , {
63
+ alias : 's' ,
64
+ type : 'string' ,
65
+ default : 'thb-wiki' ,
66
+ choices : [ 'thb-wiki' , 'thb-wiki-cache' , 'doujin-meta' , 'local-mp3' , 'local-json' ] ,
67
+ description : '设置数据源' ,
68
+ } )
69
+ . option ( 'lyric' , {
70
+ alias : 'l' ,
71
+ type : 'boolean' ,
72
+ default : false ,
73
+ description : '是否启用歌词写入 (会增加运行时间)' ,
74
+ } )
75
+ . option ( 'lyric-type' , {
76
+ alias : 'lt' ,
77
+ type : 'string' ,
78
+ default : configFile ?. lyric ?. type ?? 'original' ,
79
+ choices : [ 'original' , 'translated' , 'mixed' ] ,
80
+ description : '歌词类型, 可以选择原文/译文/混合模式' ,
81
+ } )
82
+ . option ( 'lyric-output' , {
83
+ alias : 'lo' ,
84
+ type : 'string' ,
85
+ default : configFile ?. lyric ?. output ?? 'metadata' ,
86
+ choices : [ 'metadata' , 'lrc' ] ,
87
+ description : '歌词输出方式, 可以选择写入歌曲元数据或者保存为 lrc 文件' ,
88
+ } )
89
+ . option ( 'lyric-cache-size' , {
90
+ alias : 'lcs' ,
91
+ type : 'number' ,
92
+ default : 16 ,
93
+ description : '下载歌词时的最大缓存数量' ,
94
+ } )
95
+ . option ( 'translation-separator' , {
96
+ alias : 'ts' ,
97
+ type : 'string' ,
98
+ default : configFile ?. lyric ?. translationSeparator ?? ' // ' ,
99
+ description : '指定混合歌词模式下, 使用的分隔符' ,
100
+ } )
101
+ . option ( 'lyric-time' , {
102
+ type : 'boolean' ,
103
+ default : true ,
104
+ description : '是否启用歌词时轴' ,
105
+ } )
106
+ . option ( 'separator' , {
107
+ type : 'string' ,
108
+ default : configFile ?. separator ?? DefaultMetadataSeparator ,
109
+ description : '指定 mp3 元数据的分隔符' ,
110
+ } )
111
+ . option ( 'timeout' , {
112
+ type : 'number' ,
113
+ default : configFile ?. timeout ?? 30 ,
114
+ description : '指定一次运行的超时时间' ,
115
+ } )
116
+ . option ( 'retry' , {
117
+ type : 'number' ,
118
+ default : configFile ?. retry ?? 3 ,
119
+ description : '指定超时后自动重试的最大次数' ,
120
+ } )
121
+ . option ( 'interactive' , {
122
+ alias : 'i' ,
123
+ type : 'boolean' ,
124
+ default : true ,
125
+ description : '是否允许交互' ,
126
+ } )
134
127
. parseSync ( )
135
128
136
129
setDebug ( options . debug )
0 commit comments