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
@@ -13,12 +13,16 @@ import (
|
||||
|
||||
"ddc/internal/auth"
|
||||
"ddc/internal/config"
|
||||
"ddc/internal/history"
|
||||
"ddc/internal/jobs"
|
||||
"ddc/internal/preferences"
|
||||
"ddc/internal/server"
|
||||
)
|
||||
|
||||
const settingsFileName = ".settings.json"
|
||||
const (
|
||||
settingsFileName = ".settings.json"
|
||||
historyFileName = ".history.json"
|
||||
)
|
||||
|
||||
func main() {
|
||||
settings, err := config.Load()
|
||||
@@ -43,7 +47,12 @@ func main() {
|
||||
log.Fatalf("settings error: %v", err)
|
||||
}
|
||||
|
||||
manager := jobs.NewManager(settings, store)
|
||||
historyStore, err := history.Open(filepath.Join(settings.DownloadDir, historyFileName))
|
||||
if err != nil {
|
||||
log.Fatalf("history error: %v", err)
|
||||
}
|
||||
|
||||
manager := jobs.NewManager(settings, store, historyStore)
|
||||
if err := manager.RestoreExisting(); err != nil {
|
||||
log.Printf("could not restore existing downloads: %v", err)
|
||||
}
|
||||
@@ -70,10 +79,9 @@ func main() {
|
||||
|
||||
<-shutdownSignal.Done()
|
||||
log.Printf("shutting down")
|
||||
manager.CancelAll()
|
||||
|
||||
shutdownContext, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
manager.Shutdown(shutdownContext)
|
||||
if err := httpServer.Shutdown(shutdownContext); err != nil {
|
||||
log.Printf("shutdown error: %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user