diff --git a/README.md b/README.md index c875d0b..9fb130b 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,9 @@ rtorrent_update_interval: 60000000000 # The number of concurrent completed torrent downloads to have at one time download_jobs: 2 +# Whether or not to attempt to resume a previously interrupted download +resume_downloads: true + rtorrent: # The address to the rtorrent XMLRPC endpoint addr: mycoolrtorrentserver.com/XMLRPC diff --git a/queue/queue.go b/queue/queue.go index e06d0ec..48d7915 100644 --- a/queue/queue.go +++ b/queue/queue.go @@ -40,6 +40,7 @@ type Config struct { FinishedTorrentFilePath map[string]string `json:"watch_to_finish_path" yaml:"watch_to_finish_path,flow"` TorrentListUpdateInterval time.Duration `json:"rtorrent_update_interval" yaml:"rtorrent_update_interval"` ConcurrentDownloads uint `json:"download_jobs" yaml:"download_jobs"` + ResumeDownloads bool `json:"resume_downloads" yaml:"resume_downloads"` } // Queue watches the given folders for new .torrent files, @@ -289,7 +290,7 @@ func (q *Queue) downloadTorrents(torrents []rtorrent.Torrent) { go func(torrentFilePath string, downloadPath string, torrent rtorrent.Torrent) { q.logger.Printf("Downloading '%s' (%s) to '%s' (%s) %s", torrent.Name, torrentFilePath, downloadPath, destDownloadPath, prettyBytes(float64(torrent.Size))) - err := q.sftpClient.Mirror(torrent.Path, downloadPath) + err := q.sftpClient.Mirror(torrent.Path, downloadPath, q.config.ResumeDownloads) if err != nil { q.logger.Printf("Failed to download '%s' to '%s' error '%s'", torrent.Path, downloadPath, err) done <- ""