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
Changes from 1 commit
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
Prev Previous commit
[get_song_by_url] Search for relative paths in MPD database only
pabera committed Dec 9, 2023
commit 63f5bd22c352c03bb71182f1f7b3336c232d73c0
6 changes: 6 additions & 0 deletions src/jukebox/components/playermpd/__init__.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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)