mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-08 14:26:37 +08:00
fix: align scraped media naming and release sorting
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func firstRemoteURL(baseDir string, values ...string) string {
|
||||
@@ -69,6 +70,18 @@ func yearFromDate(value string) int {
|
||||
return year
|
||||
}
|
||||
|
||||
func normalizeReleaseDate(value string) string {
|
||||
value = strings.TrimSpace(value)
|
||||
if len(value) < len("2006-01-02") {
|
||||
return ""
|
||||
}
|
||||
value = value[:len("2006-01-02")]
|
||||
if parsed, err := time.Parse("2006-01-02", value); err == nil {
|
||||
return parsed.Format("2006-01-02")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func samePath(a, b string) bool {
|
||||
return strings.EqualFold(filepath.Clean(a), filepath.Clean(b))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user