Populate image/gallery title during scan (#1359)

This commit is contained in:
bnkai
2021-05-03 07:21:51 +03:00
committed by GitHub
parent 896c3874af
commit 2ab42e9cd3
4 changed files with 30 additions and 0 deletions

View File

@@ -283,3 +283,14 @@ func IsPathInDir(dir, pathToCheck string) bool {
return false
}
// GetNameFromPath returns the name of a file from its path
// if stripExtension is true the extension is omitted from the name
func GetNameFromPath(path string, stripExtension bool) string {
fn := filepath.Base(path)
if stripExtension {
ext := filepath.Ext(fn)
fn = strings.TrimSuffix(fn, ext)
}
return fn
}