diff --git a/README.md b/README.md index b2ee3ebe..f356551c 100644 --- a/README.md +++ b/README.md @@ -53,23 +53,24 @@ https://github.com/sentriz/gonic/wiki/installation#with-systemd ## configuration options -| env var | command line arg | description | -| ----------------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------- | -| `GONIC_MUSIC_PATH` | `-music-path` | path to your music collection (see also multi-folder support below) | -| `GONIC_PODCAST_PATH` | `-podcast-path` | path to a podcasts directory | -| `GONIC_CACHE_PATH` | `-cache-path` | path to store audio transcodes, covers, etc | -| `GONIC_DB_PATH` | `-db-path` | **optional** path to database file | -| `GONIC_HTTP_LOG` | `-http-log` | **optional** http request logging, enabled by default | -| `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_TLS_CERT` | `-tls-cert` | **optional** path to a TLS cert (enables HTTPS listening) | -| `GONIC_TLS_KEY` | `-tls-key` | **optional** path to a TLS key (enables HTTPS listening) | -| `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_SCAN_AT_START_ENABLED` | `-scan-at-start-enabled` | **optional** whether to perform an initial scan at startup | -| `GONIC_SCAN_WATCHER_ENABLED` | `-scan-watcher-enabled` | **optional** whether to watch file system for new music and rescan | -| `GONIC_JUKEBOX_ENABLED` | `-jukebox-enabled` | **optional** whether the subsonic [jukebox api](https://airsonic.github.io/docs/jukebox/) should be enabled | -| `GONIC_PODCAST_PURGE_AGE` | `-podcast-purge-age` | **optional** age (in days) to purge podcast episodes if not accessed | -| `GONIC_GENRE_SPLIT` | `-genre-split` | **optional** a string or character to split genre tags on for multi-genre support (eg. `;`) | +| env var | command line arg | description | +| ------------------------------ | ------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `GONIC_MUSIC_PATH` | `-music-path` | path to your music collection (see also multi-folder support below) | +| `GONIC_PODCAST_PATH` | `-podcast-path` | path to a podcasts directory | +| `GONIC_CACHE_PATH` | `-cache-path` | path to store audio transcodes, covers, etc | +| `GONIC_DB_PATH` | `-db-path` | **optional** path to database file | +| `GONIC_HTTP_LOG` | `-http-log` | **optional** http request logging, enabled by default | +| `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_TLS_CERT` | `-tls-cert` | **optional** path to a TLS cert (enables HTTPS listening) | +| `GONIC_TLS_KEY` | `-tls-key` | **optional** path to a TLS key (enables HTTPS listening) | +| `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_SCAN_AT_START_ENABLED` | `-scan-at-start-enabled` | **optional** whether to perform an initial scan at startup | +| `GONIC_SCAN_WATCHER_ENABLED` | `-scan-watcher-enabled` | **optional** whether to watch file system for new music and rescan | +| `GONIC_JUKEBOX_ENABLED` | `-jukebox-enabled` | **optional** whether the subsonic [jukebox api](https://airsonic.github.io/docs/jukebox/) should be enabled | +| `GONIC_JUKEBOX_MPV_EXTRA_ARGS` | `-jukebox-mpv-extra-args` | **optional** extra command line arguments to pass to the jukebox mpv daemon | +| `GONIC_PODCAST_PURGE_AGE` | `-podcast-purge-age` | **optional** age (in days) to purge podcast episodes if not accessed | +| `GONIC_GENRE_SPLIT` | `-genre-split` | **optional** a string or character to split genre tags on for multi-genre support (eg. `;`) | ## screenshots diff --git a/cmd/gonic/gonic.go b/cmd/gonic/gonic.go index ee3b5b5a..e445df4a 100644 --- a/cmd/gonic/gonic.go +++ b/cmd/gonic/gonic.go @@ -13,6 +13,7 @@ import ( "strings" "time" + "github.com/google/shlex" _ "github.com/jinzhu/gorm/dialects/sqlite" "github.com/oklog/run" "github.com/peterbourgon/ff" @@ -40,6 +41,7 @@ func main() { confScanAtStart := set.Bool("scan-at-start-enabled", false, "whether to perform an initial scan at startup (optional)") confScanWatcher := set.Bool("scan-watcher-enabled", false, "whether to watch file system for new music and rescan (optional)") confJukeboxEnabled := set.Bool("jukebox-enabled", false, "whether the subsonic jukebox api should be enabled (optional)") + confJukeboxMPVExtraArgs := set.String("jukebox-mpv-extra-args", "", "extra command line arguments to pass to the jukebox mpv daemon (optional)") confPodcastPurgeAgeDays := set.Int("podcast-purge-age", 0, "age (in days) to purge podcast episodes if not accessed (optional)") confProxyPrefix := set.String("proxy-prefix", "", "url path prefix to use if behind proxy. eg '/gonic' (optional)") confGenreSplit := set.String("genre-split", "\n", "character or string to split genre tag data on (optional)") @@ -68,7 +70,7 @@ func main() { log.Printf("provided config\n") set.VisitAll(func(f *flag.Flag) { value := strings.ReplaceAll(f.Value.String(), "\n", "") - log.Printf(" %-15s %s\n", f.Name, value) + log.Printf(" %-25s %s\n", f.Name, value) }) if len(confMusicPaths) == 0 { @@ -142,7 +144,8 @@ func main() { g.Add(server.StartScanWatcher()) } if *confJukeboxEnabled { - g.Add(server.StartJukebox(nil)) + extraArgs, _ := shlex.Split(*confJukeboxMPVExtraArgs) + g.Add(server.StartJukebox(extraArgs)) } if *confPodcastPurgeAgeDays > 0 { g.Add(server.StartPodcastPurger(time.Duration(*confPodcastPurgeAgeDays) * 24 * time.Hour))