Add resumable downloads, download paths, queue controls and history
This commit is contained in:
1 parent
434f6441da
commit
6027cfabb9
43 files changed
+2138
-291
No files matched your search
@@ -0,0 +1,33 @@
|
||||
package jobs
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"ddc/internal/history"
|
||||
)
|
||||
|
||||
func (manager *Manager) History() []history.Entry {
|
||||
return manager.history.List()
|
||||
}
|
||||
|
||||
func (manager *Manager) ClearHistory() error {
|
||||
return manager.history.Clear()
|
||||
}
|
||||
|
||||
func (manager *Manager) recordHistory(job *Job, destination string, movedNames []string) {
|
||||
if len(movedNames) == 0 {
|
||||
return
|
||||
}
|
||||
snapshot := job.snapshot()
|
||||
entry := history.Entry{
|
||||
FileName: snapshot.FileName,
|
||||
SourceURL: snapshot.SourceURL,
|
||||
Destination: destination,
|
||||
Items: movedNames,
|
||||
MovedAt: time.Now(),
|
||||
}
|
||||
if err := manager.history.Add(entry); err != nil {
|
||||
log.Printf("could not save history: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user