-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
646 lines (600 loc) · 19.2 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
/*
https://github.com/ludoux/qbittorrent-torrents-exporter
ludoux/qbittorrent-torrents-exporter is licensed under the
GNU General Public License v3.0
Lu Chang ([email protected])
*/
package main
import (
"bytes"
"errors"
"flag"
"fmt"
"io"
"log"
"net"
"net/url"
"os"
"reflect"
"sort"
"strconv"
"strings"
"time"
bencode "github.com/jackpal/bencode-go"
"github.com/nohajc/go-qbittorrent/qbt"
"github.com/spf13/cast"
"github.com/weppos/publicsuffix-go/publicsuffix"
)
var qb *qbt.Client
var (
qbUrl string
qbUsername string
qbPassword string
filterPath string
filterTrackerHost string
filterCategory string
filterTag string
appendTag string
disableTrackerHostAnalyze bool = false
detectBtTorrents bool = false
debug bool = false
)
var version string = "0.3.5"
type hashsPair struct {
hash2Torrent map[string]qbt.BasicTorrent
savePath2Hashs map[string][]string
trackerHost2Hashs map[string][]string
category2Hashs map[string][]string
tag2Hashs map[string][]string
}
type filterOptions struct {
pathFilter []string
trackerHostFilter []string
categoryFilter []string
tagFilter []string
}
func getTrackerHost(trackers string) (string, error) {
if disableTrackerHostAnalyze {
return "_tracker_", nil
}
if detectBtTorrents && trackers == "BT" {
return "_bt_", nil
}
if debug {
fmt.Println("==[Debug]==\nRaw Trackers: " + trackers)
}
if len(trackers) == 0 {
return "_no_tracker_", nil
}
urls := strings.Split(trackers, "(split)")
result := ""
preHost := ""
warningFlag := false
for _, ur := range urls {
url, err := url.Parse(ur)
if err != nil {
return "_err_tracker_", errors.New("can't get main host! The raw trackers is " + trackers)
}
tmpHost := url.Hostname()
fmt.Println(url.Hostname())
if tmpHost == "" {
return "_err_tracker_", errors.New("can't get main host! The raw trackers is " + trackers)
}
if tmpHost[0] == '[' {
//ipv6
result = tmpHost
} else if net.ParseIP(tmpHost) != nil {
//可以转换为IP
result = tmpHost
} else {
//domain
result, err = publicsuffix.Domain(tmpHost)
if err != nil {
return "_err_tracker_", errors.New("can't get main host! The raw trackers is " + trackers)
}
}
if preHost == "" {
preHost = result
} else if preHost != result && !warningFlag {
fmt.Println("Warning: different trackerhost in the same torrent! Will report _multi_hosts_")
result = "_multi_trackerhost_"
break
}
}
if debug {
fmt.Println("Result: " + result + "\n==[Off]==")
}
return result, nil
}
func genMap(url string, username string, password string) (hashsPair, error) {
rt := hashsPair{}
//========分类存储
hash2Torrent := map[string]qbt.BasicTorrent{}
savePath2Hashs := map[string][]string{}
trackerHost2Hashs := map[string][]string{} // host.com
category2Hashs := map[string][]string{}
tag2Hashs := map[string][]string{}
qb = qbt.NewClient(url)
err := qb.Login(qbt.LoginOptions{Username: username, Password: password})
if err != nil {
log.Fatal("Error: Login failed. Please check your url, username and password: ", err)
}
singlelimit := 100
for i := 0; true; i++ {
filters := map[string]string{
"limit": cast.ToString(singlelimit),
"sort": "added_on",
"offset": cast.ToString(singlelimit * i),
}
//offset 即为忽略前面多少个,当超过之后,会返回offset=0返回的值
torrents, _ := qb.Torrents(filters)
if len(torrents) == 0 {
break
}
if _, dupe := hash2Torrent[torrents[0].Hash]; dupe {
break
}
fmt.Println("get torrents: " + cast.ToString(singlelimit*i+1) + "~" + cast.ToString(singlelimit*i+len(torrents)))
for _, torrent := range torrents {
/*if !strings.Contains(torrent.State, "UP") && torrent.State != "uploading" {
fmt.Println(torrent.Name, "处于", torrent.State, "状态,跳过")
continue
}*/
torrent.Tracker = ""
// Force to use "api/v2/torrents/trackers" to get trackers
if true {
trackers, _ := qb.TorrentTrackers(torrent.Hash)
for _, v := range trackers {
if detectBtTorrents && v.Tier < 0 && strings.Contains(v.URL, "DHT") && v.Status > 0 {
// if detectBtTorrents is true, we treat torrents with DHT enabled as BT torrents.
torrent.Tracker = "BT"
break
} else if v.Tier >= 0 && v.Status != 0 { //Tier < 0 is used as placeholder when tier does not exist for special entries (such as DHT).
if torrent.Tracker == "" {
torrent.Tracker = v.URL
} else {
torrent.Tracker = torrent.Tracker + "(split)" + v.URL
}
}
}
}
hash2Torrent[torrent.Hash] = torrent
savePath2Hashs[torrent.SavePath] = append(savePath2Hashs[torrent.SavePath], torrent.Hash)
host, err := getTrackerHost(torrent.Tracker)
if err != nil {
return rt, err
}
trackerHost2Hashs[host] = append(trackerHost2Hashs[host], torrent.Hash)
category2Hashs[torrent.Category] = append(category2Hashs[torrent.Category], torrent.Hash)
tags := strings.Split(torrent.Tags, ",")
for _, tag := range tags {
tag2Hashs[tag] = append(tag2Hashs[tag], torrent.Hash)
}
}
if len(torrents) < singlelimit {
break
}
//10=0.010s
time.Sleep(time.Duration(10) * time.Millisecond)
}
rt.hash2Torrent = hash2Torrent
rt.savePath2Hashs = savePath2Hashs
rt.trackerHost2Hashs = trackerHost2Hashs
rt.category2Hashs = category2Hashs
rt.tag2Hashs = tag2Hashs
return rt, nil
}
func contains(elems []string, v string) bool {
for _, s := range elems {
if v == s {
return true
}
}
return false
}
func copyTorrent(src, dst string) (int64, error) {
sourceFileStat, err := os.Stat(src)
if err != nil {
return 0, err
}
if !sourceFileStat.Mode().IsRegular() {
return 0, fmt.Errorf("%s is not a regular file", src)
}
source, err := os.Open(src)
if err != nil {
return 0, err
}
defer source.Close()
oriDst := dst
for i := 1; true; i++ {
_, err = os.Stat(dst)
if err == nil {
//same name file exist
dst = strings.Replace(oriDst, ".torrent", "_"+cast.ToString(i)+".torrent", 1)
} else {
break
}
}
destination, err := os.Create(dst)
if err != nil {
return 0, err
}
defer destination.Close()
nBytes, err := io.Copy(destination, source)
return nBytes, err
}
func toSafeFolderName(folderName string) string {
folderName = strings.ReplaceAll(folderName, `//`, "#")
folderName = strings.ReplaceAll(folderName, `\\`, "#")
folderName = strings.ReplaceAll(folderName, `/`, "#")
folderName = strings.ReplaceAll(folderName, `\`, "#")
folderName = strings.ReplaceAll(folderName, `:`, "#")
folderName = strings.ReplaceAll(folderName, `*`, "#")
folderName = strings.ReplaceAll(folderName, `?`, "#")
folderName = strings.ReplaceAll(folderName, `"`, "#")
folderName = strings.ReplaceAll(folderName, `<`, "#")
folderName = strings.ReplaceAll(folderName, `>`, "#")
folderName = strings.ReplaceAll(folderName, `|`, "#")
return folderName
}
func checkTorrentHasTracker(path string) bool {
op, _ := os.Open(path)
defer op.Close()
data, err := bencode.Decode(op)
if err != nil {
panic(err)
}
rt := cast.ToStringMap(data)
if rt["announce"] == nil {
return rt["announce-list"] != nil
} else {
return true
}
}
func decodeFastResume(path string) []string {
op, _ := os.Open(path)
defer op.Close()
data, err := bencode.Decode(op)
if err != nil {
panic(err)
}
rt := cast.ToStringMap(data)
t := rt["trackers"]
slice := []string{}
toTrackerSlice(t, &slice)
return slice
}
func toTrackerSlice(t interface{}, rt *[]string) {
vs, ok := t.([]interface{})
if !ok {
panic("fail")
}
for _, v := range vs {
if reflect.TypeOf(v).Kind() == reflect.String {
*rt = append(*(rt), cast.ToString(v))
} else {
toTrackerSlice(v, rt)
}
}
}
func appendAnnounce(path string, trackers []string) {
op, _ := os.Open(path)
data, err := bencode.Decode(op)
op.Close()
if err != nil {
panic(err)
}
moded := cast.ToStringMap(data)
moded["announce"] = trackers[0]
if len(trackers) > 1 {
aHead := [][]string{}
aList := []string{}
for i := 0; i < len(trackers); i++ {
aList = append(aList, trackers[i])
}
aHead = append(aHead, aList)
moded["announce-list"] = aHead
}
var buf bytes.Buffer
err = bencode.Marshal(&buf, moded)
if err != nil {
panic(err)
}
e := os.WriteFile(path, buf.Bytes(), 0666)
if e != nil {
panic(e)
}
}
func exportTorrentFiles(hashs *hashsPair, filter *filterOptions, appendTagName string) error {
errorCount := 0
doneHashs := []string{}
curPathStyle := "export/<path>/<trackerhost>/<category>/"
curFilenameStyle := "[<tags>][<state>]<name>.torrent"
for hash, torrent := range hashs.hash2Torrent {
host, _ := getTrackerHost(torrent.Tracker)
if (len(filter.pathFilter) == 0 || contains(filter.pathFilter, torrent.SavePath)) && (len(filter.trackerHostFilter) == 0 || contains(filter.trackerHostFilter, host)) && (len(filter.categoryFilter) == 0 || contains(filter.categoryFilter, torrent.Category)) {
tags := strings.Split(torrent.Tags, ",")
hit := false
for _, tag := range tags {
if len(filter.tagFilter) == 0 || contains(filter.tagFilter, tag) {
hit = true
break
}
}
if !hit {
continue
}
} else {
continue
}
//===pass check
curPath := strings.ReplaceAll(curPathStyle, "<path>", toSafeFolderName(torrent.SavePath))
h, err := getTrackerHost(torrent.Tracker)
if err != nil {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ") Failed to getTrackerHost. err:"+err.Error())
errorCount++
continue
}
if h == "_notracker_" {
fmt.Println("Warning: ", torrent.Name, "(", torrent.Hash, ") 's tracker is empty.")
errorCount++
continue
}
curPath = strings.ReplaceAll(curPath, "<trackerhost>", toSafeFolderName(h))
curPath = strings.ReplaceAll(curPath, "<category>", toSafeFolderName(torrent.Category))
curPath = strings.ReplaceAll(curPath, "//", "/")
os.MkdirAll(curPath, os.ModeDir|os.ModePerm)
os.Create(curPath + "realpath.txt")
err = os.WriteFile(curPath+"realpath.txt", []byte(torrent.SavePath), 0666)
if err != nil {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ") Failed to create realpath.txt. err:"+err.Error())
errorCount++
continue
}
curFilename := curFilenameStyle
curFilename = strings.ReplaceAll(curFilename, "<tags>", toSafeFolderName(torrent.Tags))
curFilename = strings.ReplaceAll(curFilename, "<state>", toSafeFolderName(torrent.State))
curFilename = strings.ReplaceAll(curFilename, "<name>", toSafeFolderName(torrent.Name))
_, err = os.Stat("BT_backup/" + hash + ".torrent")
if err != nil && os.IsNotExist(err) {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ".torrent) Not Found in BT_backup")
errorCount++
continue
} else if err != nil && os.IsPermission(err) {
fmt.Println("Error: No permission to access BT_backup/", torrent.Hash, ".torrent for ", torrent.Name)
errorCount++
continue
} else if err != nil {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ".", "torrent) ", err.Error())
errorCount++
continue
}
_, err = os.Stat("BT_backup/" + hash + ".fastresume")
if err != nil && os.IsNotExist(err) {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ".fastresume) Not Found in BT_backup")
errorCount++
continue
} else if err != nil && os.IsPermission(err) {
fmt.Println("Error: No permission to access BT_backup/", torrent.Hash, ".fastresume for ", torrent.Name)
errorCount++
continue
} else if err != nil {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ".", "fastresume) ", err.Error())
errorCount++
continue
}
_, err = copyTorrent("BT_backup/"+hash+".torrent", curPath+curFilename)
if err != nil {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ") Copy .torrent failed. Please check your file permission. err:"+err.Error())
errorCount++
continue
}
//====qb4.4.x
qb440 := ""
if !checkTorrentHasTracker("BT_backup/" + hash + ".torrent") {
tks := decodeFastResume("BT_backup/" + hash + ".fastresume")
if len(tks) == 0 {
qb440 = " [no tracker found in" + hash + ".torrent/fastresume]"
} else {
qb440 = " [qB4.4.x trackers fixed]"
appendAnnounce(curPath+curFilename, tks)
}
}
fmt.Println("Done:", curPath, curFilename, qb440)
doneHashs = append(doneHashs, hash)
}
if appendTagName != "" {
for _, hash := range doneHashs {
fTags := []string{}
fTags = append(fTags, appendTagName)
oriTags := strings.Split(hashs.hash2Torrent[hash].Tags, ",")
fTags = append(fTags, oriTags...)
ok, _ := qb.AddTorrentTags([]string{hash}, fTags)
if !ok {
fmt.Println("Error: ", hashs.hash2Torrent[hash].Name, "打tag失败!")
}
}
}
fmt.Println("Done.")
if errorCount > 0 {
fmt.Println("ErrorCount: " + cast.ToString(errorCount) + ". Please check the log above.")
}
return nil
}
func genSummary(hashs *hashsPair) string {
rt := "==汇总/Summary==\n种子总数/Torrents Count: " + cast.ToString(len(hashs.hash2Torrent)) + "\nTrackers(" + cast.ToString(len(hashs.trackerHost2Hashs)) + "): \n."
i := 0
for tracker, subHashs := range hashs.trackerHost2Hashs {
if i < len(hashs.trackerHost2Hashs)-1 {
rt = rt + "\n├─" + cast.ToString(tracker) + "(" + cast.ToString(len(subHashs)) + ")"
} else {
rt = rt + "\n└─" + cast.ToString(tracker) + "(" + cast.ToString(len(subHashs)) + ")"
}
i = i + 1
}
rt = rt + "\n\n保存目录/Save Paths(" + cast.ToString(len(hashs.savePath2Hashs)) + "):\n."
i = 0
for savePath, subHashs := range hashs.savePath2Hashs {
if i < len(hashs.savePath2Hashs)-1 {
rt = rt + "\n├─" + cast.ToString(savePath) + "(" + cast.ToString(len(subHashs)) + ")"
} else {
rt = rt + "\n└─" + cast.ToString(savePath) + "(" + cast.ToString(len(subHashs)) + ")"
}
i = i + 1
}
rt = rt + "\n\n分类/Categories(" + cast.ToString(len(hashs.category2Hashs)) + "):\n."
i = 0
for category, subHashs := range hashs.category2Hashs {
if i < len(hashs.category2Hashs)-1 {
rt = rt + "\n├─" + cast.ToString(category) + "(" + cast.ToString(len(subHashs)) + ")"
} else {
rt = rt + "\n└─" + cast.ToString(category) + "(" + cast.ToString(len(subHashs)) + ")"
}
i = i + 1
}
rt = rt + "\n\n标签/Tags(" + cast.ToString(len(hashs.tag2Hashs)) + "):\n."
i = 0
for tag, subHashs := range hashs.tag2Hashs {
if i < len(hashs.savePath2Hashs)-1 {
rt = rt + "\n├─" + cast.ToString(tag) + "(" + cast.ToString(len(subHashs)) + ")"
} else {
rt = rt + "\n└─" + cast.ToString(tag) + "(" + cast.ToString(len(subHashs)) + ")"
}
i = i + 1
}
return rt
}
func setFilter(hashs *hashsPair, filterOp *filterOptions, appendTag *string) {
var ordered []string //因为map为无序
//count := 0
var curMap *map[string][]string
for i := 0; i < 4; i++ {
ordered = make([]string, 0)
switch i {
case 0:
fmt.Println("pathFilter:")
curMap = &hashs.savePath2Hashs
case 1:
fmt.Println("trackerHostFilter:")
curMap = &hashs.trackerHost2Hashs
case 2:
fmt.Println("categoryFilter:")
curMap = &hashs.category2Hashs
case 3:
fmt.Println("tagFilter:")
curMap = &hashs.tag2Hashs
}
for it := range *curMap {
ordered = append(ordered, it)
}
sort.Strings(ordered)
for i, it := range ordered {
fmt.Printf("[%v]%v(%v)\n", i, it, len((*curMap)[it]))
}
fmt.Println("输入筛选项序号,以英文逗号分割。留空表示选择全部/Enter the filter item number, separated by commas. Leave blank to select all.")
input := ""
fmt.Scanln(&input)
if input == "-1" || input == "" {
} else {
split := strings.Split(input, ",")
for _, v := range split {
num, _ := strconv.Atoi(v)
switch i {
case 0:
filterOp.pathFilter = append(filterOp.pathFilter, ordered[num])
case 1:
filterOp.trackerHostFilter = append(filterOp.trackerHostFilter, ordered[num])
case 2:
filterOp.categoryFilter = append(filterOp.categoryFilter, ordered[num])
case 3:
filterOp.tagFilter = append(filterOp.tagFilter, ordered[num])
}
}
}
}
fmt.Println("给导出的任务打tag?留空表示无需/To append tag for the exported torrents? Leave blank to ignore.")
input := ""
fmt.Scanln(&input)
*appendTag = input
}
func init() {
flag.StringVar(&qbUrl, "qh", "", "qBittorrent host. ex: http://127.0.0.1:6363")
flag.StringVar(&qbUsername, "qu", "", "qBittorrent usrname.")
flag.StringVar(&qbPassword, "qp", "", "qBittorrent password.")
flag.StringVar(&filterPath, "fp", "-", "PathFilter")
flag.StringVar(&filterTrackerHost, "fth", "-", "TrackerHostFilter")
flag.StringVar(&filterCategory, "fc", "-", "CategoryFilter")
flag.StringVar(&filterTag, "ft", "-", "TagFilter")
flag.StringVar(&appendTag, "at", "-", "AppendTag")
flag.BoolVar(&disableTrackerHostAnalyze, "disableAnalyze", false, "if true, we report all torrent trackers as _tracker_")
flag.BoolVar(&detectBtTorrents, "detectBt", false, "if true, we treat torrents with DHT enabled as BT torrents, and report its tracker as _bt_")
flag.BoolVar(&debug, "debug", false, "Debug")
}
func main() {
_, err := os.Stat("BT_backup")
if err != nil && os.IsNotExist(err) {
log.Fatal("Error: the BT_backup folder does not exist.")
} else if err != nil && os.IsPermission(err) {
log.Fatal("Error: exporter has no permission to access BT_backup.")
} else if err != nil {
log.Fatal("Error:", err.Error())
} else {
dirEntry, err := os.ReadDir("BT_backup")
if err != nil {
log.Fatal("Error: Failed to read BT_backup path:", err)
}
if len(dirEntry) == 0 {
log.Fatal("Error: There is no file in BT_backup folder.")
}
info, err := dirEntry[0].Info()
if err != nil {
log.Fatal("Error: Failed to read 1st file info:", err)
}
fmt.Println("( BT_backup check PASS. It has", len(dirEntry), "files, the 1st file is", dirEntry[0].Name(), "with the size of", info.Size(), ")")
}
flag.Parse()
fmt.Println("github.com/ludoux/qbittorrent-torrents-exporter v" + version)
if qbUrl == "" {
fmt.Print("qBittorrent host url (ex http://127.0.0.1:6363 ):")
fmt.Scanln(&qbUrl)
if !strings.HasPrefix(qbUrl, "http") {
qbUrl = "http://" + qbUrl
}
fmt.Print("qBittorrent username (press Enter directly if autologon):")
fmt.Scanln(&qbUsername)
fmt.Print("qBittorrent password (press Enter directly if autologon):")
fmt.Scanln(&qbPassword)
}
hashs, err := genMap(qbUrl, qbUsername, qbPassword)
if err != nil {
panic(err)
}
fmt.Println(genSummary(&hashs))
filterOptions := filterOptions{}
if filterPath != "-" || filterTrackerHost != "-" || filterCategory != "-" || filterTag != "-" || appendTag != "-" {
if filterPath != "-" {
split := strings.Split(filterPath, ",")
filterOptions.pathFilter = append(filterOptions.pathFilter, split...)
}
if filterTrackerHost != "-" {
split := strings.Split(filterTrackerHost, ",")
filterOptions.trackerHostFilter = append(filterOptions.trackerHostFilter, split...)
}
if filterCategory != "-" {
split := strings.Split(filterCategory, ",")
filterOptions.categoryFilter = append(filterOptions.categoryFilter, split...)
}
if filterTag != "-" {
split := strings.Split(filterTag, ",")
filterOptions.tagFilter = append(filterOptions.tagFilter, split...)
}
if appendTag == "-" {
appendTag = ""
}
} else {
fmt.Println("\n===SetFilter===\n")
setFilter(&hashs, &filterOptions, &appendTag)
}
fmt.Println("即将导出...")
exportTorrentFiles(&hashs, &filterOptions, appendTag)
}