mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
Progress when downloading single files and when parsing remote mirrors.
This commit is contained in:
@@ -85,6 +85,11 @@ func (downloader *downloaderImpl) Resume() {
|
||||
}
|
||||
}
|
||||
|
||||
// GetProgress returns Progress object
|
||||
func (downloader *downloaderImpl) GetProgress() aptly.Progress {
|
||||
return downloader.progress
|
||||
}
|
||||
|
||||
// Download starts new download task
|
||||
func (downloader *downloaderImpl) Download(url string, destination string, result chan<- error) {
|
||||
downloader.DownloadWithChecksum(url, destination, result, utils.ChecksumInfo{Size: -1}, false)
|
||||
@@ -211,6 +216,10 @@ func DownloadTempWithChecksum(downloader aptly.Downloader, url string, expected
|
||||
|
||||
tempfile := filepath.Join(tempdir, "buffer")
|
||||
|
||||
if expected.Size != -1 && downloader.GetProgress() != nil {
|
||||
downloader.GetProgress().InitBar(expected.Size, true)
|
||||
}
|
||||
|
||||
ch := make(chan error, 1)
|
||||
downloader.DownloadWithChecksum(url, tempfile, ch, expected, ignoreMismatch)
|
||||
|
||||
@@ -219,6 +228,10 @@ func DownloadTempWithChecksum(downloader aptly.Downloader, url string, expected
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if expected.Size != -1 && downloader.GetProgress() != nil {
|
||||
downloader.GetProgress().ShutdownBar()
|
||||
}
|
||||
|
||||
file, err := os.Open(tempfile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -130,3 +130,8 @@ func (f *FakeDownloader) Pause() {
|
||||
// Resume does nothing
|
||||
func (f *FakeDownloader) Resume() {
|
||||
}
|
||||
|
||||
// GetProgress returns Progress object
|
||||
func (f *FakeDownloader) GetProgress() aptly.Progress {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user