Add resume support to downloading
This commit is contained in:
parent
93cf0597ed
commit
a08a102d15
2 changed files with 5 additions and 1 deletions
|
@ -34,6 +34,9 @@ rtorrent_update_interval: 60000000000
|
||||||
# The number of concurrent completed torrent downloads to have at one time
|
# The number of concurrent completed torrent downloads to have at one time
|
||||||
download_jobs: 2
|
download_jobs: 2
|
||||||
|
|
||||||
|
# Whether or not to attempt to resume a previously interrupted download
|
||||||
|
resume_downloads: true
|
||||||
|
|
||||||
rtorrent:
|
rtorrent:
|
||||||
# The address to the rtorrent XMLRPC endpoint
|
# The address to the rtorrent XMLRPC endpoint
|
||||||
addr: mycoolrtorrentserver.com/XMLRPC
|
addr: mycoolrtorrentserver.com/XMLRPC
|
||||||
|
|
|
@ -40,6 +40,7 @@ type Config struct {
|
||||||
FinishedTorrentFilePath map[string]string `json:"watch_to_finish_path" yaml:"watch_to_finish_path,flow"`
|
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"`
|
TorrentListUpdateInterval time.Duration `json:"rtorrent_update_interval" yaml:"rtorrent_update_interval"`
|
||||||
ConcurrentDownloads uint `json:"download_jobs" yaml:"download_jobs"`
|
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,
|
// 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) {
|
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)))
|
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 {
|
if err != nil {
|
||||||
q.logger.Printf("Failed to download '%s' to '%s' error '%s'", torrent.Path, downloadPath, err)
|
q.logger.Printf("Failed to download '%s' to '%s' error '%s'", torrent.Path, downloadPath, err)
|
||||||
done <- ""
|
done <- ""
|
||||||
|
|
Loading…
Reference in a new issue