Add some extra logging when adding a torrent file.
This commit is contained in:
parent
ce5685573f
commit
8e86703f0e
1 changed files with 14 additions and 3 deletions
|
@ -198,6 +198,11 @@ func (q *Queue) addTorrentFilePath(path string) error {
|
||||||
|
|
||||||
q.downloadQueue[torrentHash] = path
|
q.downloadQueue[torrentHash] = path
|
||||||
|
|
||||||
|
if _, exists := q.torrentList[torrentHash]; exists {
|
||||||
|
// the torrent is already on the server
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return q.rtClient.AddTorrent(torrentData)
|
return q.rtClient.AddTorrent(torrentData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +215,9 @@ func (q *Queue) getFinishedTorrents() []rtorrent.Torrent {
|
||||||
q.lock.RUnlock()
|
q.lock.RUnlock()
|
||||||
err := q.addTorrentFilePath(torrentPath)
|
err := q.addTorrentFilePath(torrentPath)
|
||||||
q.lock.RLock()
|
q.lock.RLock()
|
||||||
if err != nil {
|
if err == nil {
|
||||||
|
q.logger.Printf("Added torrent '%s' to rTorrent", torrentPath)
|
||||||
|
} else {
|
||||||
q.logger.Printf("Unable to add torrent '%s' error '%s'", torrentPath, err)
|
q.logger.Printf("Unable to add torrent '%s' error '%s'", torrentPath, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +365,9 @@ func (q *Queue) Run(stop <-chan bool) {
|
||||||
|
|
||||||
q.logger.Printf("Adding %s to download queue", fullPath)
|
q.logger.Printf("Adding %s to download queue", fullPath)
|
||||||
err = q.addTorrentFilePath(fullPath)
|
err = q.addTorrentFilePath(fullPath)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
|
q.logger.Printf("Added torrent '%s' to rTorrent", fullPath)
|
||||||
|
} else {
|
||||||
q.logger.Printf("Failed to add torrent at '%s' error '%s'", fullPath, err)
|
q.logger.Printf("Failed to add torrent at '%s' error '%s'", fullPath, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -401,7 +410,9 @@ func (q *Queue) Run(stop <-chan bool) {
|
||||||
|
|
||||||
q.logger.Printf("Adding %s to download queue", event.Name)
|
q.logger.Printf("Adding %s to download queue", event.Name)
|
||||||
err = q.addTorrentFilePath(event.Name)
|
err = q.addTorrentFilePath(event.Name)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
|
q.logger.Printf("Added torrent '%s' to rTorrent", event.Name)
|
||||||
|
} else {
|
||||||
q.logger.Printf("Failed to add '%s' error '%s'", event.Name, err)
|
q.logger.Printf("Failed to add '%s' error '%s'", event.Name, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue