refactor: consolidate specid <-> filesystem mapping and always use abs paths (#309)

This commit is contained in:
Senan Kelly
2023-04-22 18:23:17 +01:00
committed by GitHub
parent efe72fc447
commit 74de06430a
10 changed files with 232 additions and 173 deletions

View File

@@ -1,4 +1,4 @@
// Package ctrlsubsonic provides HTTP handlers for subsonic api
// Package ctrlsubsonic provides HTTP handlers for subsonic API
package ctrlsubsonic
import (
@@ -10,7 +10,6 @@ import (
"net/http"
"go.senan.xyz/gonic/jukebox"
"go.senan.xyz/gonic/paths"
"go.senan.xyz/gonic/podcasts"
"go.senan.xyz/gonic/scrobble"
"go.senan.xyz/gonic/server/ctrlbase"
@@ -27,12 +26,24 @@ const (
CtxParams
)
type MusicPath struct {
Alias, Path string
}
func PathsOf(paths []MusicPath) []string {
var r []string
for _, p := range paths {
r = append(r, p.Path)
}
return r
}
type Controller struct {
*ctrlbase.Controller
CachePath string
CoverCachePath string
MusicPaths []MusicPath
PodcastsPath string
MusicPaths paths.MusicPaths
CacheAudioPath string
CoverCachePath string
Jukebox *jukebox.Jukebox
Scrobblers []scrobble.Scrobbler
Podcasts *podcasts.Podcasts