diff --git a/resources/default-settings/jukebox.default.yaml b/resources/default-settings/jukebox.default.yaml index eabacf7c0..8a96ca6f5 100644 --- a/resources/default-settings/jukebox.default.yaml +++ b/resources/default-settings/jukebox.default.yaml @@ -94,7 +94,7 @@ playermpd: playerspot: host: localhost status_file: ../../shared/settings/spotify_player_status.json - collection_file: ../../shared/audio/spotify/spotify_collection.yaml + collection_file: ../../shared/audiofolders/spotify/spotify_collection.yaml second_swipe_action: # Note: Does not follow the RPC alias convention (yet) # Must be one of: 'toggle', 'play', 'skip', 'rewind', 'replay', 'none' diff --git a/src/jukebox/components/playern/backends/mpd/interfacing_mpd.py b/src/jukebox/components/playern/backends/mpd/interfacing_mpd.py index b5d364245..9ffd31445 100644 --- a/src/jukebox/components/playern/backends/mpd/interfacing_mpd.py +++ b/src/jukebox/components/playern/backends/mpd/interfacing_mpd.py @@ -210,6 +210,7 @@ def get_files(self, path, recursive=False): :returns: List of file(s) and directories including meta data """ path = sanitize(path) + self._run_cmd(self.client.update, path) if os.path.isfile(path): files = self._run_cmd(self.client.find, 'file', path) elif not recursive: @@ -220,6 +221,8 @@ def get_files(self, path, recursive=False): @plugin.tag def get_track(self, path): + path = sanitize(path) + self._run_cmd(self.client.update, path) playlist = self._run_cmd(self.client.find, 'file', path) if len(playlist) != 1: raise ValueError(f"Path decodes to more than one file: '{path}'") @@ -265,6 +268,7 @@ def get_podcast(self, path): * file: List podcast playlist """ + path = sanitize(path) pass def _get_livestream_items(self, path): @@ -280,6 +284,7 @@ def get_livestream(self, path): * file: List livestream playlist """ + path = sanitize(path) pass # ----------------------------------------------------- diff --git a/src/jukebox/components/playern/core/player_content.py b/src/jukebox/components/playern/core/player_content.py index 6433bdcab..55ab4ce6e 100644 --- a/src/jukebox/components/playern/core/player_content.py +++ b/src/jukebox/components/playern/core/player_content.py @@ -1,4 +1,6 @@ import logging +import os.path + import yaml import jukebox.plugs as plugin @@ -11,10 +13,10 @@ class PlayerData: def __init__(self): - self.audiofile = cfg.setndefault('players', 'content', 'audiofile', value='../../shared/audio/audiofiles.yaml') - self._database = {'audio': [], - 'podcasts': [], - 'livestreams': []} + self.audiofile = cfg.setndefault('players', 'content', 'audiofile', value='../../shared/audiofolders/audiofiles.yaml') + self._database = {'music': [{}], + 'podcasts': [{}], + 'livestreams': [{}]} self._fill_database(self.audiofile) def _fill_database(self, yaml_file): @@ -30,8 +32,10 @@ def read_player_content(self, content_type): return self._database.get(content_type, "empty") @plugin.tag - def get_location_of_file(self, filename): - [v.get('x', None) for v in self._database.values()] + def get_location(self, titlename): + for key, value in self._database.items(): + for elem in value: + return f"mpd:{key}:{elem['location']}" if elem['name'] == titlename else None @plugin.tag def list_content(self):