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
@@ -5,14 +5,17 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"ddc/internal/diskspace"
|
||||
)
|
||||
|
||||
var ErrUnknownDestination = errors.New("destination is not a first level folder of a library root")
|
||||
|
||||
type Destination struct {
|
||||
Name string `json:"name"`
|
||||
Root string `json:"root"`
|
||||
Path string `json:"path"`
|
||||
Name string `json:"name"`
|
||||
Root string `json:"root"`
|
||||
Path string `json:"path"`
|
||||
FreeBytes int64 `json:"freeBytes"`
|
||||
}
|
||||
|
||||
func Discover(roots []string) []Destination {
|
||||
@@ -26,10 +29,16 @@ func Discover(roots []string) []Destination {
|
||||
if !entry.IsDir() || strings.HasPrefix(entry.Name(), ".") {
|
||||
continue
|
||||
}
|
||||
path := filepath.Join(root, entry.Name())
|
||||
freeBytes, err := diskspace.Available(path)
|
||||
if err != nil {
|
||||
freeBytes = -1
|
||||
}
|
||||
destinations = append(destinations, Destination{
|
||||
Name: entry.Name(),
|
||||
Root: root,
|
||||
Path: filepath.Join(root, entry.Name()),
|
||||
Name: entry.Name(),
|
||||
Root: root,
|
||||
Path: path,
|
||||
FreeBytes: freeBytes,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user