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 all 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
1 change: 0 additions & 1 deletion documentation/developers/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Topics marked _in progress_ are already in the process of implementation by comm
- [Volume](#volume)
- [GPIO](#gpio)
- [WLAN](#wlan)
- [Spotify](#spotify)
- [Others](#others)
- [Start-up stuff](#start-up-stuff)
- [Debug Tools](#debug-tools)
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 @@ -95,6 +95,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
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ ruamel.yaml
requests
# For the publisher event reactor loop:
tornado
# for collecting audiofiles
pyyaml

# RPi's GPIO packages:
RPi.GPIO
Expand Down
19 changes: 1 addition & 18 deletions resources/default-settings/jukebox.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ modules:
jingle: jingle
jingle.alsawave: jingle.alsawave
jingle.jinglemp3: jingle.jinglemp3
player: playermpd
player: player.plugin
cards: rfid.cards
rfid: rfid.reader
timers: timers
Expand Down Expand Up @@ -76,23 +76,6 @@ jinglemp3:
alsawave:
# Config of the Wave through ALSA Jingle Service
device: default
playermpd:
host: localhost
status_file: ../../shared/settings/music_player_status.json
second_swipe_action:
# Note: Does not follow the RPC alias convention (yet)
# Must be one of: 'toggle', 'play', 'skip', 'rewind', 'replay', 'none'
alias: toggle
library:
update_on_startup: true
check_user_rights: true
mpd_conf: ~/.config/mpd/mpd.conf
# Must be one of: 'none', 'stop', 'rewind':
end_of_playlist_next_action: none
# Must be one of: 'none', 'prev', 'rewind':
stopped_prev_action: prev
# Must be one of: 'none', 'next', 'rewind':
stopped_next_action: next
rpc:
tcp_port: 5555
websocket_port: 5556
Expand Down
17 changes: 17 additions & 0 deletions resources/default-settings/player.default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# IMPORTANT:
# Always use relative path from settingsfile `../../`, but do not use relative paths with `~/`.
# Sole (!) exception is in playermpd.mpd_conf
players:
content:
audiofile: /../../shared/audiofolders/audiofiles.yaml
playermpd:
host: localhost
status_file: ../../shared/settings/music_player_status.json
second_swipe_action:
# Note: Does not follow the RPC alias convention (yet)
# Must be one of: 'toggle', 'play', 'skip', 'rewind', 'replay', 'none'
alias: toggle
library:
update_on_startup: true
check_user_rights: true
mpd_conf: ~/.config/mpd/mpd.conf
55 changes: 0 additions & 55 deletions src/jukebox/components/player/__init__.py

This file was deleted.

96 changes: 96 additions & 0 deletions src/jukebox/components/player/backends/__init__.py
Copy link

Choose a reason for hiding this comment

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

I think this may be a case where implementing an Abstract base class could be appropriate:
https://stackoverflow.com/a/3571946

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for the recommendation.
I am not that experienced in Abstract classes. Feel free to create a PR :)

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
from abc import ABC, abstractmethod


class BackendPlayer(ABC):
"""
Abstract Class to inherit, so that you can build a proper new Player
"""

@abstractmethod
def next(self):
pass

@abstractmethod
def prev(self):
pass

@abstractmethod
def play(self):
pass

@abstractmethod
def play_single(self, uri):
pass

@abstractmethod
def play_album(self, albumartist, album):
pass

@abstractmethod
def play_folder(self, folder: str, recursive: bool):
"""
Playback a music folder.

:param folder: Folder path relative to music library path
:param recursive: Add folder recursively
"""
pass

@abstractmethod
def toggle(self):
pass

@abstractmethod
def shuffle(self):
pass

@abstractmethod
def pause(self):
pass

@abstractmethod
def stop(self):
pass

@abstractmethod
def get_queue(self):
pass

@abstractmethod
def repeat(self):
pass

@abstractmethod
def seek(self):
pass

@abstractmethod
def get_albums(self):
pass

@abstractmethod
def get_single_coverart(self, song_url):
pass

@abstractmethod
def get_album_coverart(self):
pass

@abstractmethod
def list_dirs(self):
pass

@abstractmethod
def get_song_by_url(self, song_url):
pass

@abstractmethod
def get_folder_content(self, folder):
"""
Get the folder content as content list with meta-information. Depth is always 1.

Call repeatedly to descend in hierarchy

:param folder: Folder path relative to music library path
"""
pass
Loading
Loading