mirror of
https://github.com/rumanzo/bt2qbt.git
synced 2024-11-12 22:02:44 +01:00
Strings.Fields() instead regex
This commit is contained in:
parent
78736ef4e0
commit
e9c18aab73
@ -14,7 +14,6 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@ -210,17 +209,14 @@ func (newstructure *NewTorrentStructure) iflabel(label interface{}) {
|
||||
}
|
||||
|
||||
func (newstructure *NewTorrentStructure) gettrackers(trackers interface{}) {
|
||||
reg := regexp.MustCompile(`\s+`)
|
||||
switch strct := trackers.(type) {
|
||||
case []interface{}:
|
||||
for _, st := range strct {
|
||||
newstructure.gettrackers(st)
|
||||
}
|
||||
case string:
|
||||
for _, str := range reg.Split(strct, -1) {
|
||||
if len(str) != 0 {
|
||||
newstructure.Trackers = append(newstructure.Trackers, []string{str})
|
||||
}
|
||||
for _, str := range strings.Fields(strct) {
|
||||
newstructure.Trackers = append(newstructure.Trackers, []string{str})
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user