Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 34 additions & 22 deletions spotify/UIConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"data": [
"bitrate",
"debug",
"normalisation_enabled",
"normalisation_pregain",
"icon"
]
Expand Down Expand Up @@ -102,51 +103,62 @@
"value": false,
"hidden": true
},
{
"id": "normalisation_enabled",
"element": "switch",
"doc": "TRANSLATE.NORMALISATION_ENABLED_DOC",
"label": "TRANSLATE.NORMALISATION_ENABLED",
"value": false
},
{
"id": "normalisation_pregain",
"element": "select",
"doc": "Select the value in DB to apply as pre-gain",
"label": "Normalisation pre-gain",
"doc": "TRANSLATE.NORMALISATION_PREGAIN_DOC",
"label": "TRANSLATE.NORMALISATION_PREGAIN",
"value": {
"value": "1.0",
"label": "1.0"
"value": "0",
"label": "0 dB"
},
"options": [
{
"value": "1.0",
"label": "1.0"
"value": "0",
"label": "0 dB"
},
{
"value": "1",
"label": "+1 dB"
},
{
"value": "2.0",
"label": "2.0"
"value": "2",
"label": "+2 dB"
},
{
"value": "3.0",
"label": "3.0"
"value": "3",
"label": "+3 dB"
},
{
"value": "4.0",
"label": "4.0"
"value": "4",
"label": "+4 dB"
},
{
"value": "5.0",
"label": "5.0"
"value": "5",
"label": "+5 dB"
},
{
"value": "6.0",
"label": "6.0"
"value": "6",
"label": "+6 dB"
},
{
"value": "7.0",
"label": "7.0"
"value": "7",
"label": "+7 dB"
},
{
"value": "8.0",
"label": "8.0"
"value": "8",
"label": "+8 dB"
},
{
"value": "9.0",
"label": "9.0"
"value": "9",
"label": "+9 dB"
}
]
},
Expand Down
17 changes: 9 additions & 8 deletions spotify/config.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
log_level: trace
device_name: "${device_name}"
server_port: 9879
audio_device: "volumio"
device_type: "${device_type}"
bitrate: ${bitrate_number}
external_volume: ${external_volume}
normalisation_pregain: ${normalisation_pregain}
log_level: trace
device_name: "${device_name}"
server_port: 9879
audio_device: "volumio"
device_type: "${device_type}"
bitrate: ${bitrate_number}
external_volume: ${external_volume}
normalisation_disabled: ${normalisation_disabled}
normalisation_pregain: ${normalisation_pregain}
4 changes: 4 additions & 0 deletions spotify/i18n/strings_en.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
"DESCGAPLESS": "Enable/Disable gapless playback between tracks",
"AUTOPLAY": "Autoplay",
"DESCAUTOPLAY": "Autoplay similar songs when your music ends ",
"NORMALISATION_ENABLED": "Normalisation",
"NORMALISATION_ENABLED_DOC": "Whether track normalisation is enabled",
"NORMALISATION_PREGAIN": "Normalisation pre-gain",
"NORMALISATION_PREGAIN_DOC": "The normalisation pregain to apply to track normalisation factors",
"OPEN_OR_INSTALL_SPOTIFY_TITLE":"Open or Install Spotify",
"OPEN_OR_INSTALL_SPOTIFY_DESCRIPTION":"To listen to Spotify, simply open or Install Spotify from any device in the network and select this device as output. Spotify Premium is required",
"LOGIN_TO_ENABLE_BROWSING": "To browse your tracks, albums and playlists, login with your Spotify Credentials",
Expand Down
42 changes: 18 additions & 24 deletions spotify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ ControllerSpotify.prototype.getUIConfig = function () {
uiconf.sections[2].content[0].value.value = bitrateNumber
uiconf.sections[2].content[0].value.label = self.getLabelForSelect(uiconf.sections[2].content[0].options, bitrateNumber);

var normalisationPregainValue = self.config.get('normalisation_pregain', '1.0');
uiconf.sections[2].content[2].value.value = normalisationPregainValue;
uiconf.sections[2].content[2].value.label = normalisationPregainValue;
uiconf.sections[2].content[2].value = self.config.get('normalisation_enabled', false);

var normalisationPregain = self.config.get('normalisation_pregain', '0');
uiconf.sections[2].content[3].value.value = normalisationPregain;
uiconf.sections[2].content[3].value.label = self.getLabelForSelect(uiconf.sections[2].content[3].options, normalisationPregain);

var icon = self.config.get('icon', 'avr');
uiconf.sections[2].content[3].value.value = icon;
uiconf.sections[2].content[3].value.label = self.getLabelForSelect(uiconf.sections[2].content[3].options, icon);
uiconf.sections[2].content[4].value.value = icon;
uiconf.sections[2].content[4].value.label = self.getLabelForSelect(uiconf.sections[2].content[4].options, icon);

defer.resolve(uiconf);
})
Expand Down Expand Up @@ -737,12 +739,13 @@ ControllerSpotify.prototype.createConfigFile = function () {
if (mixerType === 'None') {
externalVolume = false;
}
var normalisationPregain = self.config.get('normalisation_pregain', '1.0');
var normalisationPregain = self.config.get('normalisation_pregain', '0');

var conf = template.replace('${device_name}', devicename)
.replace('${bitrate_number}', selectedBitrate)
.replace('${device_type}', icon)
.replace('${external_volume}', externalVolume)
.replace('${normalisation_disabled}', !self.config.get('normalisation_enabled', false))
.replace('${normalisation_pregain}', normalisationPregain);

var credentials_type = self.config.get('credentials_type', 'zeroconf');
Expand Down Expand Up @@ -791,34 +794,25 @@ ControllerSpotify.prototype.isOauthLoginAlreadyConfiguredOnDaemon = function ()
}
};

ControllerSpotify.prototype.saveGoLibrespotSettings = function (data, avoidBroadcastUiConfig) {
var self = this;
var defer = libQ.defer();

var broadcastUiConfig = true;
if (avoidBroadcastUiConfig === true){
broadcastUiConfig = false;
}

ControllerSpotify.prototype.saveGoLibrespotSettings = function (data) {
if (data.bitrate !== undefined && data.bitrate.value !== undefined) {
self.config.set('bitrate_number', data.bitrate.value);
this.config.set('bitrate_number', data.bitrate.value);
}

if (data.debug !== undefined) {
self.config.set('debug', data.debug);
this.config.set('debug', data.debug);
}
if (data.icon && data.icon.value !== undefined) {
self.config.set('icon', data.icon.value);
this.config.set('icon', data.icon.value);
}
this.config.set('normalisation_enabled', !!data.normalisation_enabled);
if (data.normalisation_pregain && data.normalisation_pregain.value !== undefined) {
self.config.set('normalisation_pregain', data.normalisation_pregain.value);
this.config.set('normalisation_pregain', data.normalisation_pregain.value);
}


self.selectedBitrate = self.config.get('bitrate_number', '320').toString();
self.initializeLibrespotDaemon();

return defer.promise;
this.selectedBitrate = this.config.get('bitrate_number', '320').toString();
this.initializeLibrespotDaemon();
this.commandRouter.pushToastMessage('info', this.getI18n('CONFIGURATION_SUCCESSFULLY_UPDATED'))
};

// OAUTH
Expand Down
2 changes: 1 addition & 1 deletion spotify/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fi


DAEMON_BASE_URL=https://github.com/devgianlu/go-librespot/releases/download/v
VERSION=0.0.10
VERSION=0.0.11
DAEMON_ARCHIVE=go-librespot_linux_$ARCH.tar.gz
DAEMON_DOWNLOAD_URL=$DAEMON_BASE_URL$VERSION/$DAEMON_ARCHIVE
DAEMON_DOWNLOAD_PATH=/home/volumio/$DAEMON_ARCHIVE
Expand Down