mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
spotify-connect-web: rework
This commit is contained in:
parent
bb46c69f82
commit
c8e8dfd8ba
@ -1,2 +1,13 @@
|
||||
8.0.101
|
||||
- Use mixer card index
|
||||
- Add instructions to the addon settings
|
||||
- Add a configuration wizard to assist with ALSA configuration
|
||||
- Enable setting initial volume
|
||||
- Activate onboard audio interface if no audio interface is active
|
||||
- Activate known audio interface if selected but inactive
|
||||
- Only set the playback route for RPi2 onboard audio interface
|
||||
- Remove default settings
|
||||
- Fix the erroneous bit rate setting
|
||||
|
||||
8.0.100
|
||||
- Initial addon
|
||||
|
@ -18,9 +18,9 @@
|
||||
|
||||
PKG_NAME="spotify-connect-web"
|
||||
PKG_VERSION="0.0.3-alpha"
|
||||
PKG_REV="100"
|
||||
PKG_REV="101"
|
||||
PKG_ARCH="arm"
|
||||
PKG_ADDON_PROJECTS="RPi2"
|
||||
PKG_ADDON_PROJECTS="RPi2 WeTek_Core WeTek_Play"
|
||||
PKG_LICENSE="prop."
|
||||
PKG_SITE="https://github.com/Fornoth/spotify-connect-web"
|
||||
PKG_URL="https://github.com/Fornoth/spotify-connect-web/releases/download/$PKG_VERSION/${PKG_NAME}_$PKG_VERSION.tar.gz"
|
||||
|
@ -17,42 +17,110 @@
|
||||
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
. /etc/os-release
|
||||
. /etc/profile
|
||||
oe_setup_addon service.spotify-connect-web
|
||||
|
||||
chmod +x "$ADDON_DIR/spotify-connect-web"
|
||||
mkdir -p "$ADDON_HOME"
|
||||
|
||||
activate_card() {
|
||||
if [ -e "/proc/asound/$1" ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
if [ "$LIBREELEC_ARCH" == "RPi2.arm" -a "$1" == "ALSA" ]
|
||||
then
|
||||
dtparam audio=on
|
||||
sleep 1
|
||||
else
|
||||
echo "Do not know how to activate card $1 on $LIBREELEC_ARCH"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
if [ ! "$(cat /proc/asound/pcm 2> /dev/null)" ]
|
||||
then
|
||||
if [ "$LIBREELEC_ARCH" == "RPi2.arm" ]
|
||||
then
|
||||
activate_card "ALSA"
|
||||
else
|
||||
echo "Do not how how to activate an audio interface on $LIBREELEC_ARCH"
|
||||
ko="ko"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "$ADDON_HOME/spotify_appkey.key" ]
|
||||
then
|
||||
echo "Exiting: no key"
|
||||
exit
|
||||
echo "Key not found"
|
||||
ko="ko"
|
||||
fi
|
||||
|
||||
if [ ! "$scw_u" ]
|
||||
then
|
||||
echo "Username not set"
|
||||
ko="ko"
|
||||
fi
|
||||
|
||||
if [ ! "$scw_p" ]
|
||||
then
|
||||
echo "Exiting: no password"
|
||||
exit
|
||||
echo "Password not set"
|
||||
ko="ko"
|
||||
fi
|
||||
|
||||
if [ ! "$scw_u" ]
|
||||
if [ ! "$scw_o" ]
|
||||
then
|
||||
echo "Playback device not set"
|
||||
ko="ko"
|
||||
fi
|
||||
|
||||
if [ "$ko" ]
|
||||
then
|
||||
echo "Exiting: no username"
|
||||
exit
|
||||
fi
|
||||
|
||||
amixer &> /dev/null || dtoverlay dtparam audio=on
|
||||
amixer cset numid=3 "$pcm_3"
|
||||
case "$scw_o" in
|
||||
|
||||
[ "$scw_b" ] && scw_B="-b $scw_b"
|
||||
[ "$scw_m" ] && scw_M="-m $scw_m"
|
||||
[ "$scw_o" ] && scw_O="-o $scw_o"
|
||||
*:CARD=*)
|
||||
card="${scw_o##*:CARD=}"
|
||||
activate_card "$card"
|
||||
index="$(readlink /proc/asound/$card)"
|
||||
index="${index##*card}"
|
||||
;;
|
||||
|
||||
cd $ADDON_DIR
|
||||
chmod +x spotify-connect-web
|
||||
./spotify-connect-web $scw_B \
|
||||
hw:*,*)
|
||||
echo "The hw:d,s specification is unreliable, use device:CARD=card instead"
|
||||
index="${scw_o##hw:}"
|
||||
index="${index%%,*}"
|
||||
card="card$index"
|
||||
activate_card "$card"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown playback device specification $swc_o"
|
||||
exit
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
[ "$scw_m" ] && [ "$vol_0" ] && amixer -c "$index" set "$scw_m" "$vol_0%"
|
||||
|
||||
if [ "$LIBREELEC_ARCH" == "RPi2.arm" -a \
|
||||
"$(readlink /proc/asound/ALSA)" == "card$index" ]
|
||||
then
|
||||
[ "$pcm_3" ] && amixer -c "$index" cset name="PCM Playback Route" "$pcm_3"
|
||||
fi
|
||||
|
||||
[ "$scw_b" == "-" ] && scw_b=""
|
||||
[ "$scw_b" ] && scw_b="-b $scw_b"
|
||||
[ "$scw_m" ] && scw_m="-m $scw_m"
|
||||
|
||||
cd "$ADDON_DIR"
|
||||
./spotify-connect-web $scw_b \
|
||||
-k "$ADDON_HOME/spotify_appkey.key" \
|
||||
$scw_M \
|
||||
$scw_m \
|
||||
-n "$HOSTNAME" \
|
||||
$scw_O \
|
||||
-o "$scw_o" \
|
||||
-p "$scw_p" \
|
||||
-u "$scw_u"
|
||||
-u "$scw_u" \
|
||||
--mixer_device_index "$index"
|
||||
|
@ -3,66 +3,110 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30000"
|
||||
msgctxt "#30100"
|
||||
msgid "Configuration"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30001"
|
||||
msgctxt "#30101"
|
||||
msgid "Spotify"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30002"
|
||||
msgid "username"
|
||||
msgctxt "#30102"
|
||||
msgid "Username"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30003"
|
||||
msgid "password"
|
||||
msgctxt "#30103"
|
||||
msgid "Password"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30004"
|
||||
msgid "bit rate"
|
||||
msgctxt "#30104"
|
||||
msgid "Bit rate"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30005"
|
||||
msgid ""
|
||||
msgctxt "#30105"
|
||||
msgid "-"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30006"
|
||||
msgctxt "#30106"
|
||||
msgid "90"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30007"
|
||||
msgctxt "#30107"
|
||||
msgid "160"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30008"
|
||||
msgctxt "#30108"
|
||||
msgid "320"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30009"
|
||||
msgctxt "#30109"
|
||||
msgid "ALSA"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30010"
|
||||
msgid "playback device"
|
||||
msgctxt "#30110"
|
||||
msgid "Configuration wizard"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30011"
|
||||
msgid "playback route"
|
||||
msgctxt "#30111"
|
||||
msgid "Playback device"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30012"
|
||||
msgctxt "#30112"
|
||||
msgid "Mixer"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30113"
|
||||
msgid "Initial volume"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30114"
|
||||
msgid "Playback route"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30115"
|
||||
msgid "auto detect"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30013"
|
||||
msgctxt "#30116"
|
||||
msgid "headphone jack"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30014"
|
||||
msgctxt "#30117"
|
||||
msgid "HDMI"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30015"
|
||||
msgid "mixer"
|
||||
msgctxt "#30200"
|
||||
msgid "Instructions"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30201"
|
||||
msgid "1. Copy your spofify_appkey.key the addon's home folder"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30202"
|
||||
msgid "2. Enter your Spotify username and password"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30203"
|
||||
msgid "3. Configure ALSA with the wizard"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30204"
|
||||
msgid "4. Save the settings"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30205"
|
||||
msgid "5. Play Spotify through the addon, using a Spotify app as a remote"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30206"
|
||||
msgid "5. Enjoy!"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30210"
|
||||
msgid "No playback device"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30211"
|
||||
msgid "Could not find a playback device"
|
||||
msgstr ""
|
||||
|
@ -1,13 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<settings>
|
||||
<category label="30000">
|
||||
<setting label="30001" type="lsep"/>
|
||||
<setting label="30002" id="scw_u" type="text" />
|
||||
<setting label="30003" id="scw_p" type="text" option="hidden" />
|
||||
<setting label="30004" id="scw_b" type="labelenum" lvalues="30005|30006|30007|30008" />
|
||||
<setting label="30009" type="lsep"/>
|
||||
<setting label="30010" id="scw_o" type="text" default="hw:0,1"/>
|
||||
<setting label="30011" id="pcm_3" type="enum" lvalues="30012|30013|30014" />
|
||||
<setting label="30015" id="scw_m" type="text" />
|
||||
</category>
|
||||
<category label="30100" >
|
||||
<setting label="30101" type="lsep" />
|
||||
<setting label="30102" type="text" id="scw_u" />
|
||||
<setting label="30103" type="text" id="scw_p" option="hidden" />
|
||||
<setting label="30104" type="labelenum" id="scw_b" lvalues="30105|30106|30107|30108" />
|
||||
<setting label="30109" type="lsep" />
|
||||
<setting label="30110" type="action" action="RunScript(/storage/.kodi/addons/service.spotify-connect-web/wizard.py)" />
|
||||
<setting label="30111" type="text" id="scw_o" default=""/>
|
||||
<setting label="30112" type="text" id="scw_m" default="" />
|
||||
<setting label="30113" type="slider" id="vol_0" default="80" range="0,10,100" option="percent"
|
||||
visible="!eq(-1,)" />
|
||||
<setting label="30114" type="enum" id="pcm_3" lvalues="30115|30116|30117"
|
||||
visible="eq(-3,default:CARD=ALSA) | eq(-3,sysdefault:CARD=ALSA)" />
|
||||
</category>
|
||||
<category label="30200" >
|
||||
<setting label="30201" type="lsep" />
|
||||
<setting label="30202" type="lsep" />
|
||||
<setting label="30203" type="lsep" />
|
||||
<setting label="30204" type="lsep" />
|
||||
<setting label="30205" type="lsep" />
|
||||
<setting label="30206" type="lsep" />
|
||||
</category>
|
||||
</settings>
|
||||
|
@ -1,8 +0,0 @@
|
||||
<settings>
|
||||
<setting id="pcm_3" value="0" />
|
||||
<setting id="scw_b" value="" />
|
||||
<setting id="scw_m" value="" />
|
||||
<setting id="scw_o" value="hw:0,1" />
|
||||
<setting id="scw_p" value="" />
|
||||
<setting id="scw_u" value="" />
|
||||
</settings>
|
53
packages/addons/service/spotify-connect-web/source/wizard.py
Normal file
53
packages/addons/service/spotify-connect-web/source/wizard.py
Normal file
@ -0,0 +1,53 @@
|
||||
################################################################################
|
||||
# This file is part of LibreELEC - https://libreelec.tv
|
||||
# Copyright (C) 2016 Team LibreELEC
|
||||
#
|
||||
# LibreELEC is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# LibreELEC is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
import alsaaudio as alsa
|
||||
import xbmcaddon
|
||||
import xbmcgui
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
addon = xbmcaddon.Addon("service.spotify-connect-web")
|
||||
dialog = xbmcgui.Dialog()
|
||||
strings = addon.getLocalizedString
|
||||
|
||||
while True:
|
||||
pcms = alsa.pcms()[1:]
|
||||
if len(pcms) == 0:
|
||||
dialog.ok(strings(30210), strings(30211))
|
||||
break
|
||||
pcmx = dialog.select(strings(30111), pcms)
|
||||
if pcmx == -1:
|
||||
break
|
||||
pcm = pcms[pcmx]
|
||||
pair = pcm.split(":CARD=")
|
||||
device = pair[0]
|
||||
card = pair[1].split(",")[0]
|
||||
cardx = alsa.cards().index(card)
|
||||
mixers = [mixer for mixer in alsa.mixers(cardindex=cardx, device=device)
|
||||
if 'Playback Volume' in alsa.Mixer(control=mixer, cardindex=cardx).volumecap()]
|
||||
if len(mixers) == 0:
|
||||
mixer = ""
|
||||
else:
|
||||
mixerx = dialog.select(strings(30112), mixers)
|
||||
if mixerx == -1:
|
||||
continue
|
||||
mixer = mixers[mixerx]
|
||||
addon.setSetting("scw_m", mixer)
|
||||
addon.setSetting("scw_o", pcm)
|
||||
break
|
Loading…
x
Reference in New Issue
Block a user