mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-19 15:23:36 +00:00
29 lines
653 B
Go
29 lines
653 B
Go
package core
|
|
|
|
import (
|
|
"context"
|
|
"path/filepath"
|
|
|
|
"github.com/navidrome/navidrome/model"
|
|
"github.com/navidrome/navidrome/model/request"
|
|
)
|
|
|
|
func userName(ctx context.Context) string {
|
|
if user, ok := request.UserFrom(ctx); !ok {
|
|
return "UNKNOWN"
|
|
} else {
|
|
return user.UserName
|
|
}
|
|
}
|
|
|
|
// BFR We should only access files through the `storage.Storage` interface. This will require changing how
|
|
// TagLib and ffmpeg access files
|
|
|
|
var AbsolutePath = func(ctx context.Context, ds model.DataStore, libId int, path string) string {
|
|
libPath, err := ds.Library().GetPath(ctx, libId)
|
|
if err != nil {
|
|
return path
|
|
}
|
|
return filepath.Join(libPath, path)
|
|
}
|