add jukebox-enabled flag

This commit is contained in:
sentriz
2020-04-18 20:55:19 +01:00
parent eb33a06cd7
commit e0f194ec6c
5 changed files with 15 additions and 9 deletions

View File

@@ -8,6 +8,7 @@
- browsing by folder (keeping your full tree intact)
- browsing by tags (using [taglib](https://taglib.org/) - supports mp3, opus, flac, ape, m4a, wav, etc.)
- on-the-fly audio transcoding and caching (requires [ffmpeg](https://ffmpeg.org/)) (thank you [spijet](https://github.com/spijet/))
- jukebox mode (thank you [AlexKraak](https://github.com/AlexKraak/))
- pretty fast scanning (with my library of ~27k tracks, initial scan takes about 10m, and about 5s after incrementally)
- multiple users, each with their own transcoding preferences, playlists, top tracks, top artists, etc.
- [last.fm](https://www.last.fm/) scrobbling
@@ -49,6 +50,8 @@ services:
# optionally, see env vars below
expose:
- 80
devices:
- /dev/snd:/dev/snd # if using jukebox
volumes:
- ./data:/data # gonic db etc
- /path/to/music:/music:ro # your music
@@ -67,6 +70,7 @@ then start with `docker-compose up -d`
|`GONIC_LISTEN_ADDR`|`-listen-addr`|**optional** host and port to listen on (eg. `0.0.0.0:4747`, `127.0.0.1:4747`) (*default* `0.0.0.0:4747`)|
|`GONIC_PROXY_PREFIX`|`-proxy-prefix`|**optional** url path prefix to use if behind reverse proxy. eg `/gonic` (see example configs below)|
|`GONIC_SCAN_INTERVAL`|`-scan-interval`|**optional** interval (in minutes) to check for new music (automatic scanning disabled if omitted)|
|`GONIC_JUKEBOX_ENABLED`|`-jukebox-enabled`|**optional** whether the subsonic [jukebox api](https://airsonic.github.io/docs/jukebox/) should be enabled|
## screenshots

View File

@@ -24,6 +24,7 @@ func main() {
cachePath := set.String("cache-path", "/tmp/gonic_cache", "path to cache")
dbPath := set.String("db-path", "gonic.db", "path to database (optional)")
scanInterval := set.Int("scan-interval", 0, "interval (in minutes) to automatically scan music (optional)")
jukeboxEnabled := set.Bool("jukebox-enabled", false, "whether the subsonic jukebox api should be enabled (optional)")
proxyPrefix := set.String("proxy-prefix", "", "url path prefix to use if behind proxy. eg '/gonic' (optional)")
_ = set.String("config-path", "", "path to config (optional)")
showVersion := set.Bool("version", false, "show gonic version")
@@ -40,9 +41,9 @@ func main() {
os.Exit(0)
}
log.Printf("starting gonic %s\n", version.VERSION)
log.Printf("provided config:\n")
log.Printf("provided config\n")
set.VisitAll(func(f *flag.Flag) {
fmt.Printf("\t%s:\t%s\n", f.Name, f.Value)
log.Printf(" %-15s %s\n", f.Name, f.Value)
})
if _, err := os.Stat(*musicPath); os.IsNotExist(err) {
log.Fatal("please provide a valid music directory")
@@ -68,12 +69,14 @@ func main() {
ProxyPrefix: *proxyPrefix,
})
var g run.Group
g.Add(server.StartJukebox())
g.Add(server.StartHTTP(*listenAddr))
if *scanInterval > 0 {
tickerDur := time.Duration(*scanInterval) * time.Minute
g.Add(server.StartScanTicker(tickerDur))
}
if *jukeboxEnabled {
g.Add(server.StartJukebox())
}
if err := g.Run(); err != nil {
log.Printf("error in job: %v", err)
}

View File

@@ -35,8 +35,8 @@ func main() {
}
defer db.Close()
s := scanner.New(
db,
*musicPath,
db,
)
if err := s.Start(); err != nil {
log.Fatalf("error starting scanner: %v\n", err)

View File

@@ -19,7 +19,7 @@ func init() {
}
// benchmarks aren't real code are they? >:)
// here is an absolute path to my music directory
testScanner = New(db, "/home/senan/music")
testScanner = New("/home/senan/music", db)
log.SetOutput(ioutil.Discard)
}

View File

@@ -30,10 +30,9 @@ func init() {
if err != nil {
log.Fatalf("error opening database: %v\n", err)
}
testController = New(
&ctrlbase.Controller{DB: db},
"",
)
testController = &Controller{
Controller: &ctrlbase.Controller{DB: db},
}
}
type queryCase struct {