diff --git a/resources/audio/shutdownsound.mp3 b/resources/audiofolders/shutdownsound.mp3 similarity index 100% rename from resources/audio/shutdownsound.mp3 rename to resources/audiofolders/shutdownsound.mp3 diff --git a/resources/audio/shutdownsound.wav b/resources/audiofolders/shutdownsound.wav similarity index 100% rename from resources/audio/shutdownsound.wav rename to resources/audiofolders/shutdownsound.wav diff --git a/resources/audio/startupsound.mp3 b/resources/audiofolders/startupsound.mp3 similarity index 100% rename from resources/audio/startupsound.mp3 rename to resources/audiofolders/startupsound.mp3 diff --git a/resources/audio/startupsound.wav b/resources/audiofolders/startupsound.wav similarity index 100% rename from resources/audio/startupsound.wav rename to resources/audiofolders/startupsound.wav diff --git a/src/jukebox/components/player/backends/__init__.py b/src/jukebox/components/player/backends/__init__.py new file mode 100644 index 000000000..64607751d --- /dev/null +++ b/src/jukebox/components/player/backends/__init__.py @@ -0,0 +1,36 @@ +class BackendPlayer: + """ + Class to inherit, so that you can build a proper new Player + """ + def __init__(self): + raise NotImplementedError + + def next(self): + raise NotImplementedError + + def prev(self): + raise NotImplementedError + + def play(self, idx=None): + raise NotImplementedError + + def toggle(self): + raise NotImplementedError + + def pause(self): + raise NotImplementedError + + def stop(self): + raise NotImplementedError + + def get_queue(self): + raise NotImplementedError + + def play_uri(self, uri): + raise NotImplementedError + + def repeatmode(self): + raise NotImplementedError + + def seek(self): + raise NotImplementedError diff --git a/src/jukebox/components/player/backends/mpd/interfacing_mpd.py b/src/jukebox/components/player/backends/mpd/interfacing_mpd.py index 9ffd31445..9e5f8b0d8 100644 --- a/src/jukebox/components/player/backends/mpd/interfacing_mpd.py +++ b/src/jukebox/components/player/backends/mpd/interfacing_mpd.py @@ -10,6 +10,7 @@ import jukebox.cfghandler from mpd.asyncio import MPDClient +from components.player.backends import BackendPlayer logger = logging.getLogger('jb.mpd') cfg = jukebox.cfghandler.get_handler('jukebox') @@ -19,7 +20,7 @@ def sanitize(path: str): return os.path.normpath(path).lstrip('./') -class MPDBackend: +class MPDBackend(BackendPlayer): def __init__(self, event_loop): self.client = MPDClient() diff --git a/src/jukebox/components/player/core/__init__.py b/src/jukebox/components/player/core/__init__.py index 5dfc0192a..b474ec009 100644 --- a/src/jukebox/components/player/core/__init__.py +++ b/src/jukebox/components/player/core/__init__.py @@ -108,6 +108,10 @@ def prev(self): def play(self): self._active.play() + @plugin.tag + def play_single(self, uri): + self.play_uri(uri) + @plugin.tag def toggle(self): self._active.toggle() @@ -126,6 +130,14 @@ def stop(self): def get_queue(self): self._active.get_queue() + @plugin.tag + def repeatmode(self): + self._active.repeatmode() + + @plugin.tag + def seek(self): + self._active.seek() + def _save_state(self): # Get the backend to save the state of the current playlist to the URI's config file self._active.save_state() diff --git a/src/webapp/src/commands/index.js b/src/webapp/src/commands/index.js index bd8fd782e..f8ab46bec 100644 --- a/src/webapp/src/commands/index.js +++ b/src/webapp/src/commands/index.js @@ -4,27 +4,32 @@ const commands = { plugin: 'ctrl', method: 'get_by_filename_as_base64', }, + // ToDo: Implement directoryTreeOfAudiofolder: { _package: 'player', plugin: 'ctrl', method: 'list_all_dirs', }, + // ToDo: Implement new player albumList: { _package: 'player', plugin: 'ctrl', method: 'list_albums', }, + // ToDo: Implement songList: { _package: 'player', plugin: 'ctrl', method: 'list_song_by_artist_and_album', }, + // ToDo: Implement getSongByUrl: { _package: 'player', plugin: 'ctrl', method: 'get_song_by_url', argKeys: ['song_url'] }, + // ToDo: Implement folderList: { _package: 'player', plugin: 'ctrl', @@ -60,12 +65,14 @@ const commands = { method: 'play_single', argKeys: ['song_url'] }, + // ToDo: verify if this is really needed? play_folder: { _package: 'player', plugin: 'ctrl', method: 'play_folder', argKeys: ['folder'] }, + // ToDo: Implement play_album: { _package: 'player', plugin: 'ctrl', diff --git a/src/webapp/src/components/Library/lists/albums/index.js b/src/webapp/src/components/Library/lists/albums/index.js index b8d61b089..3e915a9fa 100644 --- a/src/webapp/src/components/Library/lists/albums/index.js +++ b/src/webapp/src/components/Library/lists/albums/index.js @@ -44,7 +44,7 @@ const Albums = ({ musicFilter }) => { <> {isLoading ? - : }