Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi Player Support #2164

Draft
wants to merge 127 commits into
base: future3/develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 109 commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
c3549eb
Asking user for spotify
Groovylein Nov 30, 2021
5aaa2d1
activate spotify installation
Groovylein Nov 30, 2021
059566d
Merge branch 'future3/develop' into future3/spotify
Groovylein Dec 15, 2021
7992662
Enable spotify installation
Groovylein Dec 16, 2021
6b89ddf
Introduce default spotify folder
Groovylein Dec 16, 2021
1890016
Added information for installation
Groovylein Dec 20, 2021
32d53af
Setup librespot-java in Docker for development
pabera Dec 20, 2021
00d1ea5
Added docker for spotify development
Groovylein Dec 21, 2021
a19382b
Improve Docker file
pabera Dec 21, 2021
98cb97d
Ignore spotify config.toml file to avoid accidental credential commit
pabera Dec 21, 2021
d1536de
Create default config.toml file
pabera Dec 21, 2021
efb3590
Ignore spotify config.toml file to avoid accidental credential commit
Groovylein Dec 22, 2021
01ff28d
Delete docker.spotify.config.toml
Groovylein Dec 24, 2021
83001f7
Merge branch 'MiczFlor:future3/spotify' into future3/spotify
Groovylein Dec 24, 2021
e365417
Merge pull request #1680 from pabera/future3/spotify
Groovylein Dec 26, 2021
19ebc60
First implementation of spotify functions: play, stop, pause, prev, n…
Groovylein Dec 26, 2021
271c634
Merge branch 'future3/spotify' into future3/spotify
Groovylein Dec 26, 2021
92135e9
Merge pull request #1 from MiczFlor/future3/spotify
Groovylein Dec 26, 2021
6646f9a
Removed SpotLock
Groovylein Dec 27, 2021
6e0a3f8
Cleanup and device_info implementation
Groovylein Dec 27, 2021
5c1b84d
Playlist and volume implemented
Groovylein Dec 28, 2021
c74ead5
Added HTTP Error handling for spotify requests
Groovylein Dec 29, 2021
cbd59de
Catch other exception for spotify api
Groovylein Dec 29, 2021
81143cb
Added headers for requests calls
Groovylein Dec 29, 2021
93fc3a9
Refactored http error handling
Groovylein Jan 11, 2022
98da122
Delete json_example.json
Groovylein Jan 11, 2022
1c505b5
Spotify websocket initialization
Groovylein Jan 12, 2022
f3eeb6e
Merge branch 'future3/develop' into future3/spotify
Groovylein Jan 14, 2022
1b4b540
Bugfixing: import, paths, asyncio
Groovylein Jan 14, 2022
998ed06
Bugfixing: URL paths
Groovylein Jan 14, 2022
ade2023
Bugfixing: wait until connection to spotify api possible
Groovylein Jan 14, 2022
2b4e666
Bugfixing: Handle device_info right
Groovylein Jan 14, 2022
29cc50a
Docker adjustments
Groovylein Jan 14, 2022
d4ddadc
Adjustment in Websocket loop
Groovylein Jan 14, 2022
e1c25a7
Use JRE instead of JDE
pabera Jan 5, 2022
2d8ca15
Outsource http and ws client into own class (ws non functional!)
pabera Jan 15, 2022
a955afb
Use websocket-client and make http-client useful
pabera Jan 16, 2022
5aef09f
Reformating code
Groovylein Jan 17, 2022
6b3b6fc
Enhance spotify websocket to publish player status
Groovylein Jan 17, 2022
9928012
Fixing bugs in Contributing.md
pabera Jan 17, 2022
cbe4749
Abstract implementation of Player Factory
pabera Jan 18, 2022
e12a53b
Update factory naming
pabera Jan 19, 2022
5bf3b40
Fix builder init
pabera Jan 19, 2022
d0f64f4
Introduce PlayerStatus class and WS client for Spotify
pabera Jan 20, 2022
f7d5dff
Show Title, Album, CoverArt in webapp, prepare controls
pabera Jan 20, 2022
a75b0d2
Introduce Player Counter on React side
pabera Jan 21, 2022
df89357
Initial proposal for new player API with multi-backend handling
Jan 22, 2022
6e64466
Flake8 fixes
Groovylein Jan 28, 2022
5847dad
Flake8 fixes #2
Groovylein Jan 28, 2022
244a0cf
Reworked multi-backend proposal + AsyncIO MPD stub
Feb 2, 2022
04fc9fc
Merge pull request #1751 from ChisSoc: AsyncIO MPD player backend
Feb 6, 2022
2bf8fbc
Implement folder and album playback
Feb 8, 2022
de9cbb7
Clean up
Feb 8, 2022
90b54c4
Merge pull request #1759 from ChisSoc/future3/newplayer
Groovylein Feb 9, 2022
665a53f
Disable autoplay
Groovylein Feb 9, 2022
8db761f
First attempt Spotify Backend
Groovylein Feb 11, 2022
55d721a
Flake 8 corrections
Groovylein Feb 11, 2022
5412b59
Read mpd host config from jukebox.yaml
pabera Feb 13, 2022
ece4c2b
[Webapp] Interim MPD player adjustment to new player backend
pabera Feb 15, 2022
d47087e
Fix album decoding from URI
Feb 19, 2022
fbe43a0
Merge pull request #1767 from ChisSoc/future3/newplayer
Feb 19, 2022
c094839
Disable autoplay
Groovylein Feb 9, 2022
ecf11dc
First attempt Spotify Backend
Groovylein Feb 11, 2022
839f1ff
Flake 8 corrections
Groovylein Feb 11, 2022
c94d5db
Merge branch 'MiczFlor-future3/spotify' into future3/spotify
Groovylein Feb 24, 2022
5e3bc6d
Simplified internal Spotify URI
Groovylein Feb 24, 2022
a118f70
bugfixing connection loss of Spotify websocket
Groovylein Feb 24, 2022
d0832c9
Merge pull request #1761 from Groovylein/future3/spotify
Groovylein Feb 24, 2022
4d3c46c
Merge branch 'future3/develop' into future3/spotify
Groovylein Apr 30, 2022
731c9a9
Bugfixing: player.ctrl.list_backends show only keys
Groovylein May 1, 2022
23a0f82
Bugfixing: spotify player
Groovylein May 23, 2022
bd8af97
prepare Docker dor spotipy
Groovylein Jan 27, 2023
aa8443d
first attempt
Groovylein Jan 27, 2023
9d059b4
First successful attempt with cached data
Groovylein Feb 1, 2023
6ec73e2
Cleanup spotify player
Groovylein Apr 5, 2023
c7a3eab
Removed spotify code from playern
Groovylein Aug 4, 2023
20d7284
fist player content core
Groovylein Nov 6, 2023
6b54f47
populate content manager
Groovylein Nov 11, 2023
ef92b71
get_location for content, mpd fixes
Groovylein Nov 13, 2023
1547a42
Merge branch 'future3/develop' into future3/multi-player
Groovylein Nov 13, 2023
c8bc8c0
cleanup old player
Groovylein Nov 13, 2023
d0e851f
Update docker env
Groovylein Nov 18, 2023
fd04413
update from upstream
Groovylein Nov 18, 2023
aaa935a
update from upstream
Groovylein Nov 18, 2023
b910210
further update from upstream
Groovylein Nov 18, 2023
86e734e
correct flake8
Groovylein Nov 18, 2023
36bfd79
Fix docker; delete copy-paste-error
Groovylein Nov 18, 2023
b8fd417
Syntax error
Groovylein Nov 18, 2023
9006d6f
Added inheritance class for players
Groovylein Nov 18, 2023
5784f8d
Added missing functions for webapp
Groovylein Nov 18, 2023
3b4f448
first attempt for get_folder_content
Groovylein Dec 18, 2023
efbe969
Merge branch 'future3/develop' into future3/multi-player
Groovylein Dec 18, 2023
e85b294
Bring back spotify backend
Groovylein Dec 18, 2023
7a0d170
remove unnecessary files
Groovylein Dec 18, 2023
257d177
fix auth error during pip install in docker
Groovylein Dec 18, 2023
90cc33b
Docker bugfixing
Groovylein Dec 18, 2023
d43c6fe
implement Spotipy authentication via bottle
Groovylein Dec 21, 2023
e3ea953
Docker container for spotifyd with pulseaudio; Still problems
Groovylein Dec 28, 2023
e0faa44
Installation of spotifyd
Groovylein Jan 3, 2024
3d7195d
correct path of spotifyd config
Groovylein Jan 3, 2024
0deda1e
corrected relative path in jukebox yaml
Groovylein Jan 3, 2024
9a506f0
prepare for client_id, client_secret
Groovylein Jan 3, 2024
af3b281
extract player config into new file
Groovylein Jan 5, 2024
3e0c94a
make use of the new player.yaml
Groovylein Jan 5, 2024
8d65be3
create first basic documentation how to obtain client_id/client_secret
Groovylein Jan 5, 2024
bb24d8a
enhance installation method with client_id and client_secret
Groovylein Jan 5, 2024
f34815d
Adjust CI to handle spotify installation
Groovylein Jan 5, 2024
d24e16a
bugfixing spotifyd daemon
Groovylein Jan 6, 2024
190aaf7
Review changes
Groovylein Jan 8, 2024
2eccf39
Review changes #2
Groovylein Jan 8, 2024
633449e
Merge branch 'future3/develop' into future3/multi-player
Groovylein Jan 8, 2024
3510085
flake 8 fixes
Groovylein Jan 8, 2024
3aedd9c
reverted all spotify code; focus on multi-player
Groovylein Jan 10, 2024
8cb99d1
added missing functions to ABC
Groovylein Jan 13, 2024
afcafd1
cleanup old player calls for better development
Groovylein Jan 14, 2024
8be8ade
introduce necessary methods from abstract class
Groovylein Jan 14, 2024
e5ae214
enable read from new yaml file player.yaml
Groovylein Jan 22, 2024
3edfa67
display folder content in webapp
Groovylein Jan 31, 2024
c8f809b
enable playing from folder view
Groovylein Jan 31, 2024
fcf2ced
Make library available on webapp
Groovylein Feb 27, 2024
d38dc0c
Publish playerstatus, so that buttons work on the player
Groovylein Mar 11, 2024
d880d46
Merge branch 'future3/develop' into future3/multi-player
Groovylein Apr 9, 2024
ba72a18
Revert some changes
Groovylein Apr 16, 2024
8169592
transfer coverart_cache_manager
Groovylein Apr 23, 2024
b4ff177
<UNDER CONSTRUCTION> Status publishing via multitimer
Groovylein Apr 23, 2024
83692f1
<UNDER CONSTRUCTION> Correct status call in webapp
Groovylein May 2, 2024
42c15f4
Merge branch 'future3/develop' into future3/multi-player
Groovylein May 2, 2024
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
2 changes: 2 additions & 0 deletions ci/installation/run_install_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export ENABLE_WEBAPP_PROD_DOWNLOAD=true
# n - deactivate bluetooth
# n - disable on-chip audio
# - - mpd overwrite config (only with existing installation)
# n - setup Spotify
# n - setup rfid reader
# y - setup samba
# y - setup webapp
Expand All @@ -36,6 +37,7 @@ n
n
n
n
n
y
y
n
Expand Down
2 changes: 2 additions & 0 deletions ci/installation/run_install_faststartup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}"
# y - deactivate bluetooth
# y - disable on-chip audio
# - - mpd overwrite config (only with existing installation)
# n - setup Spotify
# n - setup rfid reader
# n - setup samba
# n - setup webapp
Expand All @@ -36,4 +37,5 @@ n
n
n
n
n
'
4 changes: 2 additions & 2 deletions docker/config/docker.mpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory "/home/pi/RPi-Jukebox-RFID/shared/audiofolders"
music_directory "~/RPi-Jukebox-RFID/shared/audiofolders"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use
Expand Down Expand Up @@ -98,7 +98,7 @@ port "6600"
# argument is recommended for troubleshooting, though can quickly stretch
# available resources on limited hardware storage.
#
log_level "default"
log_level "verbose"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't commit this :-) It'll be vey verbose and irrelevant

#
# Setting "restore_paused" to "yes" puts MPD into pause mode instead
# of starting playback after startup.
Expand Down
13 changes: 13 additions & 0 deletions docker/config/docker.spotifyd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[global]
username = USER
password = PASS
backend = pulse
device = default # Given by `aplay -L`
mixer = PCM
volume-control = alsa # or alsa_linear, or softvol
#onevent = command_run_on_playback_event
device_name = phoniebox_docker # Cannot contain spaces
bitrate = 160
cache_path = cache_directory
volume-normalisation = true
normalisation-pregain = -10
10 changes: 5 additions & 5 deletions docker/docker-compose.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ services:
environment:
- PULSE_SERVER=unix:/tmp/pulse-sock
volumes:
- ../shared/audiofolders:/home/pi/RPi-Jukebox-RFID/shared/audiofolders
- ../shared/playlists:/home/pi/.config/mpd/playlists
- ./config/docker.pulse.mpd.conf:/home/pi/.config/mpd/mpd.conf
- ../shared/audiofolders:${HOME}/RPi-Jukebox-RFID/shared/audiofolders
- ../shared/playlists:${HOME}/.config/mpd/playlists
- ./config/docker.pulse.mpd.conf:${HOME}/.config/mpd/mpd.conf
- $XDG_RUNTIME_DIR/pulse/native:/tmp/pulse-sock

jukebox:
Expand All @@ -24,6 +24,6 @@ services:
environment:
- PULSE_SERVER=unix:/tmp/pulse-sock
volumes:
- ../shared:/home/pi/RPi-Jukebox-RFID/shared
- ./config/docker.pulse.mpd.conf:/home/pi/.config/mpd/mpd.conf
- ../shared:${HOME}/RPi-Jukebox-RFID/shared
- ./config/docker.pulse.mpd.conf:${HOME}/.config/mpd/mpd.conf
- $XDG_RUNTIME_DIR/pulse/native:/tmp/pulse-sock
16 changes: 16 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ services:
- 5555:5555
- 5556:5556
- 5557:5557
- 3001:3001
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still belong to the Spotify PR?

restart: unless-stopped
tty: true
volumes:
Expand All @@ -61,3 +62,18 @@ services:
volumes:
- ../src/webapp:/home/node/webapp
- /home/node/webapp/node_modules

spotifyd:
build:
context: ../
dockerfile: ./docker/spotifyd.Dockerfile
container_name: spotifyd
ports:
- 1234:1234
restart: unless-stopped
environment:
- PULSE_SERVER=unix:/tmp/pulseaudio.socket
- PULSE_COOKIE=/tmp/pulseaudio.cookie
volumes:
- ../shared/spotify/docker.spotifyd.conf:/etc/spotifyd.conf
- $XDG_RUNTIME_DIR/pulse/native:/tmp/pulseaudio.socket
11 changes: 7 additions & 4 deletions docker/jukebox.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FROM debian:bullseye-slim
# Raspberry Pi environment as possible.
RUN apt-get update && apt-get install -y \
libasound2-dev \
libzmq3-dev \
pulseaudio \
pulseaudio-utils \
--no-install-recommends \
Expand All @@ -21,16 +22,17 @@ RUN usermod -aG pulse ${USER}
# Install all Jukebox dependencies
RUN apt-get update && apt-get install -qq -y \
--allow-downgrades --allow-remove-essential --allow-change-held-packages \
gcc at wget \
g++ at wget \
espeak mpc mpg123 git ffmpeg spi-tools netcat \
python3 python3-venv python3-dev python3-mutagen

USER ${USER}
WORKDIR ${HOME}

ENV VIRTUAL_ENV=${INSTALLATION_PATH}/.venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

USER ${USER}
WORKDIR ${HOME}
COPY --chown=${USER}:${USER} . ${INSTALLATION_PATH}/

RUN pip install --no-cache-dir -r ${INSTALLATION_PATH}/requirements.txt
Expand All @@ -45,7 +47,8 @@ RUN [ "$(uname -m)" = "aarch64" ] && ARCH="arm64" || ARCH="$(uname -m)"; \
rm -f libzmq.tar.gz;

RUN export ZMQ_PREFIX=${PREFIX} && export ZMQ_DRAFT_API=1
RUN pip install -v --no-binary pyzmq --pre pyzmq
#RUN pip install -v --no-binary pyzmq --pre pyzmq
RUN pip install -v --no-binary=:all: pyzmq --pre pyzmq
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the version of future3/develop here. these changes have already been made to this branch.


EXPOSE 5555 5556

Expand Down
40 changes: 40 additions & 0 deletions docker/spotifyd.Dockerfile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this file, there is a lot more happening compare to here for example. Why do we need Cargo in this picture?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used another repo because I wanted to use pulseaudio:
https://github.com/hvalev/spotifyd-docker/tree/main

To be clear, I was using this file:
https://github.com/hvalev/spotifyd-docker/blob/main/Dockerfile.pulseaudio-dbus

which includes dbus. I need to test if the file without dbus also works:
https://github.com/hvalev/spotifyd-docker/blob/main/Dockerfile.pulseaudio

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not important, so don't focus on it for now. We we maybe be able to tweak this a little.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#An extra layer to get around this bug https://github.com/docker/buildx/issues/395
#It's there simply to download add required libraries for cargo build
FROM --platform=$BUILDPLATFORM rust:bullseye AS rust_fix

ENV USER=root
ENV V_spotifyd=v0.3.5

WORKDIR /usr/src/spotifyd
RUN apt-get -y update && \
apt-get install --no-install-recommends -y apt-transport-https ca-certificates git && \
git clone --depth 1 --branch=${V_spotifyd} https://github.com/Spotifyd/spotifyd.git .

# Don't do `cargo init` or --> error: `cargo init` cannot be run on existing Cargo packages
# RUN cargo init
RUN mkdir -p .cargo \
&& cargo vendor > .cargo/config

FROM rust:bullseye as build

RUN apt-get -y update && \
apt-get install --no-install-recommends -y libasound2-dev build-essential pulseaudio libpulse-dev libdbus-1-dev
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need dbus? The official website says, it's "experimental" and it only provides features we might not even need? Or do we actually rely on them?


COPY --from=rust_fix /usr/src/spotifyd /usr/src/spotifyd
WORKDIR /usr/src/spotifyd

RUN cargo build -j 2 --release --features pulseaudio_backend,dbus_mpris --offline

FROM debian:bullseye-slim as release

CMD ["dbus-run-session", "/usr/bin/spotifyd", "--no-daemon"]

RUN apt-get update && \
apt-get install -yqq --no-install-recommends libasound2 pulseaudio dbus libssl1.1 && \
rm -rf /var/lib/apt/lists/* && \
groupadd -r spotify && \
useradd --no-log-init -r -g spotify -G audio spotify

COPY --from=build /usr/src/spotifyd/target/release/spotifyd /usr/bin/

USER spotify
1 change: 1 addition & 0 deletions documentation/builders/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
## Configuration

* [Audio](./audio.md)
* [Spotify](./spotify.md)
* [RFID](./rfid.md)
* [Card Database](./card-database.md)
* [Troubleshooting](./troubleshooting.md)
Expand Down
39 changes: 39 additions & 0 deletions documentation/builders/spotify.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Spotify Integration

The Spotify integration allows to play music directly from Spotify.

> [!IMPORTANT]
> You need a Spotify Premium subscription to use this functionality

## Needed credentials

For the spotifyd daemon, you need to provide username and password of your Spotify account
during installation. This is used to enable the Phoniebox to play music from Spotify.

To control the playback (spotipy), you need to create an app as Spotify developer and provide the
`client_id` and `client_secret` therefore follow the steps:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: For Builders, we don't need to be so technical (spotifyd, spotipy) as most of them have never heard of it and would potentially get lost. I'd suggest simplify this.

To allow your Phoniebox to play music from Spotify, you'll need to provide your Spotify username and password.
To control music playback, you'll also need to create a Spotify developer app and get a client_id and client_secret. Here's how to do it:

We could have docs in the Developers section for more advanced topics of this feature.


1. Access [Developers Dashboard](https://developer.spotify.com/dashboard)
2. Create an App via the button on the top right
3. Fill in following fields:
- App name: `your_desired_name`
- Redirect URI: `http://localhost:3001`
4. Save the `client_id` and `client_secret` for the installation

## Post installation configuration
### spotifyd

The spotifyd daemon is using the username and password of your Spotify account.

If the credentials have changed, you can update them in the config file located at `/etc/spotifyd.conf`

### spotipy

Spotipy is using `client_id` and `client_secret` to control the playback of the Phoniebox.

To update the credentials, please modify the file located at `~/RPi-Jukebox-RFID/shared/settings/player.yaml`

## Resources

- [spotifyd](https://spotifyd.rs/)
- [spotipy](https://spotipy.readthedocs.io)
5 changes: 5 additions & 0 deletions installation/includes/01_default_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ DISABLE_SSH_QOS=true
DISABLE_BOOT_SCREEN=true
DISABLE_BOOT_LOGS_PRINT=true
SETUP_MPD=true
ENABLE_SPOTIFY=false
SPOT_USERNAME=NONE
SPOT_PASSWORD=NONE
SPOT_CLIENT_ID=NONE
SPOT_CLIENT_SECRET=NONE
ENABLE_MPD_OVERWRITE_INSTALL=true
UPDATE_RASPI_OS=${UPDATE_RASPI_OS:-"true"}
ENABLE_RFID_READER=true
Expand Down
53 changes: 53 additions & 0 deletions installation/routines/customize_options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,58 @@ Would you like to overwrite your configuration? [Y/n]"
fi
}

_option_spotify() {
# ENABLE_SPOTIFY
clear_c
print_c "---------------------- SPOTIFY ----------------------

Installs an additional player, so that you can
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am adding this comment without having reviewed the actually player logic. We should not have different players. If a user does not install Spotify, we should still install the same player which only uses MPD.

With this logic, we would not install "an additional player" and instead, "just Spotify". But In understand that there is more to do than just providing credentials (e.g. Developer Account)

Install and configure Spoify for your Phoniebox

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really get what you mean.

The logic is:
MPD will always be installed.
The user can choose, if he wants to have an additional player (here Spotify). If he chooses "no" he will still have MPD

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's just different understand of wording. Ignore my comment for now.

play music from spotify. You will need to create
an app in the Spotify developer dashboard to use
Spotify properly

Note: Spotify Premium is needed to operate player!


Do you want to enable the spotify player? [y/N]"
read -r response
case "$response" in
[yY][eE][sS]|[yY])
ENABLE_SPOTIFY=true
;;
*)
;;
esac

if [ "$ENABLE_SPOTIFY" = true ]; then
print_c "To configure Spotify properly, you need to create
an App at https://developer.spotify.com/dashboard and provide the
client_id and client_secret in the following prompts."
print_c ""
print_c ""
print_c "Please provide the Spotify username"
read -r response_username
SPOT_USERNAME="${response_username}"

print_c "Please provide the Spotify password"
read -r response_password
SPOT_PASSWORD="${response_password}"

print_c "Please provide the client_id of the Spotify App"
read -r response_client_id
SPOT_CLIENT_ID="${response_client_id}"

print_c "Please provide the client_secret of the Spotify App"
read -r response_client_secret
SPOT_CLIENT_SECRET="${response_client_secret}"
fi

log "ENABLE_SPOTIFY=${ENABLE_SPOTIFY}"
if [ "$ENABLE_SPOTIFY" = true ]; then
log "Spotify service will be enabled with username ${SPOT_USERNAME} and client_id ${SPOT_CLIENT_ID}"
fi
}

_option_rfid_reader() {
# ENABLE_RFID_READER
clear_c
Expand Down Expand Up @@ -328,6 +380,7 @@ _run_customize_options() {
_option_bluetooth
_option_disable_onboard_audio
_option_mpd
_option_spotify
_option_rfid_reader
_option_samba
_option_webapp
Expand Down
1 change: 1 addition & 0 deletions installation/routines/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ install() {
init_git_repo_from_tardir
setup_jukebox_core
setup_mpd
setup_spotifyd
setup_samba
setup_jukebox_webapp
setup_kiosk_mode
Expand Down
1 change: 1 addition & 0 deletions installation/routines/setup_jukebox_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ _jukebox_core_build_and_install_pyzmq() {
_jukebox_core_install_settings() {
print_lc " Register Jukebox settings"
cp -f "${INSTALLATION_PATH}/resources/default-settings/jukebox.default.yaml" "${SETTINGS_PATH}/jukebox.yaml"
cp -f "${INSTALLATION_PATH}/resources/default-settings/player.default.yaml" "${SETTINGS_PATH}/player.yaml"
cp -f "${INSTALLATION_PATH}/resources/default-settings/logger.default.yaml" "${SETTINGS_PATH}/logger.yaml"
}

Expand Down
Loading