mirror of
https://github.com/rumanzo/deluge2qbt.git
synced 2024-11-08 20:12:29 +01:00
Probably lock fix
This commit is contained in:
parent
ab0fd855bc
commit
0204538b1d
@ -222,7 +222,7 @@ func logic(key string, newstructure NewTorrentStructure, torrentspath *string, w
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var delugedir, qbitdir, config, ddir, btconf, btbackup string
|
var delugedir, qbitdir, config, ddir, btconf, btbackup string
|
||||||
var with_label, with_tags bool = true, true
|
var with_label, with_tags = true, true
|
||||||
var without_label, without_tags bool
|
var without_label, without_tags bool
|
||||||
sep := string(os.PathSeparator)
|
sep := string(os.PathSeparator)
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
@ -230,13 +230,13 @@ func main() {
|
|||||||
btconf = os.Getenv("APPDATA") + sep + "qBittorrent" + sep + "qBittorrent.ini"
|
btconf = os.Getenv("APPDATA") + sep + "qBittorrent" + sep + "qBittorrent.ini"
|
||||||
btbackup = os.Getenv("LOCALAPPDATA") + sep + "qBittorrent" + sep + "BT_backup" + sep
|
btbackup = os.Getenv("LOCALAPPDATA") + sep + "qBittorrent" + sep + "BT_backup" + sep
|
||||||
} else {
|
} else {
|
||||||
user, err := user.Current()
|
usr, err := user.Current()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
ddir = user.HomeDir + sep + ".config" + sep + "deluge" + sep
|
ddir = usr.HomeDir + sep + ".config" + sep + "deluge" + sep
|
||||||
btconf = user.HomeDir + sep + ".config" + sep + "qBittorrent" + sep + "qBittorrent.conf"
|
btconf = usr.HomeDir + sep + ".config" + sep + "qBittorrent" + sep + "qBittorrent.conf"
|
||||||
btbackup = user.HomeDir + sep + ".local" + sep + "share" + sep + "data" + sep + "qBittorrent" + sep + "BT_backup"
|
btbackup = usr.HomeDir + sep + ".local" + sep + "share" + sep + "data" + sep + "qBittorrent" + sep + "BT_backup"
|
||||||
}
|
}
|
||||||
gnuflag.StringVar(&delugedir, "source", ddir,
|
gnuflag.StringVar(&delugedir, "source", ddir,
|
||||||
"Source directory that contains resume.dat and torrents files")
|
"Source directory that contains resume.dat and torrents files")
|
||||||
@ -319,7 +319,7 @@ func main() {
|
|||||||
numjob := 1
|
numjob := 1
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
comChannel := make(chan string, totaljobs)
|
comChannel := make(chan string, totaljobs)
|
||||||
errChannel := make(chan string, totaljobs)
|
errChannel := make(chan string, totaljobs*2)
|
||||||
positionnum := 0
|
positionnum := 0
|
||||||
var jsn bytes.Buffer
|
var jsn bytes.Buffer
|
||||||
var hashlabels Alabels
|
var hashlabels Alabels
|
||||||
@ -339,7 +339,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
json.Unmarshal(jsn.Bytes(), &hashlabels)
|
if err := json.Unmarshal(jsn.Bytes(), &hashlabels); err != nil {
|
||||||
|
with_label, with_tags = false, false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for key, value := range fastresumefile {
|
for key, value := range fastresumefile {
|
||||||
positionnum++
|
positionnum++
|
||||||
@ -374,9 +376,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
var waserrors bool
|
var waserrors bool
|
||||||
for message := range errChannel {
|
for message := range errChannel {
|
||||||
fmt.Printf("%v/%v %v \n", numjob, totaljobs, message)
|
log.Printf("%v \n", message)
|
||||||
waserrors = true
|
waserrors = true
|
||||||
numjob++
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if with_tags == true {
|
if with_tags == true {
|
||||||
|
Loading…
Reference in New Issue
Block a user