mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Image improvements (#847)
* Fix image performer filtering * Add performer images tab * Add studio images tab * Rename interface * Add tag images tab * Add path filtering for images * Show image stats on stats page * Fix incorrect scan counts after timeout * Add gallery filters * Relax scene gallery selector
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/user"
|
||||
@@ -188,29 +187,6 @@ func IsZipFileUncompressed(path string) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// humanize code taken from https://github.com/dustin/go-humanize and adjusted
|
||||
|
||||
func logn(n, b float64) float64 {
|
||||
return math.Log(n) / math.Log(b)
|
||||
}
|
||||
|
||||
// HumanizeBytes returns a human readable bytes string of a uint
|
||||
func HumanizeBytes(s uint64) string {
|
||||
sizes := []string{"B", "KB", "MB", "GB", "TB", "PB", "EB"}
|
||||
if s < 10 {
|
||||
return fmt.Sprintf("%d B", s)
|
||||
}
|
||||
e := math.Floor(logn(float64(s), 1024))
|
||||
suffix := sizes[int(e)]
|
||||
val := math.Floor(float64(s)/math.Pow(1024, e)*10+0.5) / 10
|
||||
f := "%.0f %s"
|
||||
if val < 10 {
|
||||
f = "%.1f %s"
|
||||
}
|
||||
|
||||
return fmt.Sprintf(f, val, suffix)
|
||||
}
|
||||
|
||||
// WriteFile writes file to path creating parent directories if needed
|
||||
func WriteFile(path string, file []byte) error {
|
||||
pathErr := EnsureDirAll(filepath.Dir(path))
|
||||
|
||||
Reference in New Issue
Block a user