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

[Bugfix] Webapp allows to assign single song to card #2143

Merged
merged 3 commits into from
Dec 10, 2023
Merged
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
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ services:
restart: unless-stopped
tty: true
volumes:
- ../src/jukebox:/root/RPi-Jukebox-RFID/src/jukebox
- ../shared:/root/RPi-Jukebox-RFID/shared
- ./config/docker.pulse.mpd.conf:/root/.config/mpd/mpd.conf
command: python run_jukebox.py
Expand Down
6 changes: 6 additions & 0 deletions src/jukebox/components/playermpd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
# Toggle (und 2nd Swipe generell) ist immer vom Status des Zielsystems abhängig und kann damit nur vom Zielsystem geändert
# werden. Bei Wifi also braucht man 3 Funktionen: on / off / toggle. Toggle ist dann first swipe / second swipe

import os
import mpd
import threading
import logging
Expand Down Expand Up @@ -574,6 +575,11 @@ def list_song_by_artist_and_album(self, albumartist, album):

@plugs.tag
def get_song_by_url(self, song_url):
# MPD can play absolute paths but can find songs in its database only by relative path
# In certain situations, `song_url` can be an absolute path. Then, it will be trimed to be relative
_music_library_path_absolute = os.path.expanduser(components.player.get_music_library_path())
song_url = song_url.replace(f'{_music_library_path_absolute}/', '')

with self.mpd_lock:
song = self.mpd_retry_with_mutex(self.mpd_client.find, 'file', song_url)

Expand Down
4 changes: 2 additions & 2 deletions src/webapp/src/components/Library/lists/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const LibraryLists = () => {
const [cardId] = useState(searchParams.get('cardId'));
const [musicFilter, setMusicFilter] = useState('');

const handleMusicFilder = (event) => {
const handleMusicFolder = (event) => {
setMusicFilter(event.target.value);
};

Expand All @@ -49,7 +49,7 @@ const LibraryLists = () => {
{isSelecting && <SelectorHeader />}
<Grid container sx={{ padding: '10px' }}>
<LibraryHeader
handleMusicFilder={handleMusicFilder}
handleMusicFolder={handleMusicFolder}
musicFilter={musicFilter}
/>
<Grid
Expand Down