From 9faed2a803294fb2569cebffa9cb282816c6d19c Mon Sep 17 00:00:00 2001 From: Mark Ferry Date: Sun, 19 Nov 2023 15:13:09 +0000 Subject: [PATCH] librespot-java: generate librespot configs --- Makefile | 5 +++ templates/librespot.template | 86 ++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 templates/librespot.template diff --git a/Makefile b/Makefile index 3bc0898..dc8b8d4 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,7 @@ DEBIAN_UNITS := \ ALL_MOPIDY := $(patsubst %, mopidy.%.conf, $(ALL_ZONES)) ALL_AIRPLAY := $(patsubst %, shairport-sync.%.conf, $(ALL_HOSTS)) ALL_SNAPCLIENTS := $(patsubst %, snapclient.%.conf, $(ALL_HOSTS)) +ALL_SPOTIFY := $(patsubst %, librespot.%.toml, $(ALL_HOSTS)) ALL_NGINX := $(patsubst %, iris.%.conf, $(ALL_HOSTS)) ALL_HOME_ASSISTANT := $(patsubst %, home-assistant.%.yaml, $(ALL_ZONES)) ALL_HOME_ASSISTANT_INSTALL := \ @@ -55,6 +56,7 @@ ALL_CONFIGS := \ $(ALL_AIRPLAY) \ $(ALL_NGINX) \ $(ALL_HOME_ASSISTANT) \ + $(ALL_SPOTIFY) \ $(ALL_SNAPCLIENTS) \ DEV_CONFIGS := \ @@ -136,6 +138,9 @@ snapclient.%.conf: $(config) templates/snapclient.template $(RENDER) shairport-sync.%.conf: $(config) templates/shairport-sync.template $(RENDER) python $(RENDER) -z $* -d $< templates/shairport-sync.template | grep -v '^//\|^$$' > $@ +librespot.%.toml: $(config) templates/librespot.template $(RENDER) + python $(RENDER) -z $* -d $< templates/librespot.template > $@ + iris.%.conf: $(config) templates/iris.template $(RENDER) python $(RENDER) -z $* -d $< templates/iris.template > $@ diff --git a/templates/librespot.template b/templates/librespot.template new file mode 100644 index 0000000..dd49d76 --- /dev/null +++ b/templates/librespot.template @@ -0,0 +1,86 @@ +deviceId = "" ### Device ID (40 chars, leave empty for random) ### +clientToken = "" ### Client Token (168 bytes Base64 encoded) ### +deviceName = "{{zone.Name}}" ### Device name ### +deviceType = "SPEAKER" ### Device type (COMPUTER, TABLET, SMARTPHONE, SPEAKER, TV, AVR, STB, AUDIO_DONGLE, GAME_CONSOLE, CAST_VIDEO, CAST_AUDIO, AUTOMOBILE, WEARABLE, UNKNOWN_SPOTIFY, CAR_THING, UNKNOWN) ### +preferredLocale = "en" ### Preferred locale ### +logLevel = "OFF" ### Log level (OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL) ### + +[auth] ### Authentication ### +strategy = "ZEROCONF" # Strategy (USER_PASS, ZEROCONF, BLOB, FACEBOOK, STORED) +username = "" # Spotify username (BLOB, USER_PASS only) +password = "" # Spotify password (USER_PASS only) +blob = "" # Spotify authentication blob Base64-encoded (BLOB only) +storeCredentials = false # Whether to store reusable credentials on disk (not a plain password) +credentialsFile = "credentials.json" # Credentials file (JSON) + +[zeroconf] ### Zeroconf ### +listenPort = {{zone.spotify.zeroconf}} # Listen on this TCP port (`-1` for random) +listenAll = true # Listen on all interfaces (overrides `zeroconf.interfaces`) +interfaces = "" # Listen on these interfaces (comma separated list of names) + +[cache] ### Cache ### +enabled = true # Cache enabled +dir = "{{path.media_root}}/{{path.music_metadata}}/librespot-java" +doCleanUp = true + +[network] ### Network ### +connectionTimeout = 10 # If ping isn't received within this amount of seconds, reconnect + +[preload] ### Preload ### +enabled = true # Preload enabled + +[time] ### Time correction ### +synchronizationMethod = "NTP" # Time synchronization method (NTP, PING, MELODY, MANUAL) +manualCorrection = 0 # Manual time correction in millis + +[player] ### Player ### +autoplayEnabled = true # Autoplay similar songs when your music ends +preferredAudioQuality = "NORMAL" # Preferred audio quality (NORMAL, HIGH, VERY_HIGH) +enableNormalisation = true # Whether to apply the Spotify loudness normalisation +normalisationPregain = +3.0 # Normalisation pregain in decibels (loud at +6, normal at +3, quiet at -5) +initialVolume = 32767 # Initial volume (0-65536) +volumeSteps = 64 # Number of volume notches +logAvailableMixers = true # Log available mixers +mixerSearchKeywords = "" # Mixer/backend search keywords (semicolon separated) +crossfadeDuration = {{zone.spotify.crossfade_ms}} # Crossfade overlap time (in milliseconds) +output = "STDOUT" # Audio output device (MIXER, PIPE, STDOUT, CUSTOM) +outputClass = "" # Audio output Java class name +releaseLineDelay = 20 # Release mixer line after set delay (in seconds) +pipe = "" # Output raw (signed) PCM to this file (`player.output` must be PIPE) +retryOnChunkError = true # Whether the player should retry fetching a chuck if it fails +metadataPipe = "" # Output metadata in Shairport Sync format (https://github.com/mikebrady/shairport-sync-metadata-reader) +bypassSinkVolume = false # Whether librespot-java should ignore volume events, sink volume is set to the max +localFilesPath = "" # Where librespot-java should search for local files + +[api] ### API ### +port = {{zone.spotify.api_port}} # API port (`api` module only) +host = "0.0.0.0" # API listen interface (`api` module only) + +[proxy] ### Proxy ### +enabled = false # Whether the proxy is enabled +type = "HTTP" # The proxy type (HTTP, SOCKS) +ssl = false # Connect to proxy using SSL (HTTP only) +address = "" # The proxy hostname +port = 0 # The proxy port +auth = false # Whether authentication is enabled on the server +username = "" # Basic auth username +password = "" # Basic auth password + +[shell] ### Shell ### +enabled = false # Shell events enabled +executeWithBash = false # Execute the command with `bash -c` +onContextChanged = "" +onTrackChanged = "" +onPlaybackEnded = "" +onPlaybackPaused = "" +onPlaybackResumed = "" +onPlaybackFailed = "" +onTrackSeeked = "" +onMetadataAvailable = "" +onVolumeChanged = "" +onInactiveSession = "" +onPanicState = "" +onConnectionDropped = "" +onConnectionEstablished = "" +onStartedLoading = "" +onFinishedLoading = ""