aboutsummaryrefslogtreecommitdiffstats
path: root/solo-tool-project/src/solo_tool/solo_tool.py
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2025-02-26 18:09:06 +0100
committerEddy Pedroni <epedroni@pm.me>2025-02-26 18:25:41 +0100
commit3c065ceded2a58d5aadbcf64417f2cfc92268a08 (patch)
tree95e965feeb2313dd657c8335c57b16fffefff9a0 /solo-tool-project/src/solo_tool/solo_tool.py
parent0821b21761a6d47ac1d34c2142365dbaa361b79e (diff)
Refactor fixtures, introduce song pool argument
Diffstat (limited to 'solo-tool-project/src/solo_tool/solo_tool.py')
-rw-r--r--solo-tool-project/src/solo_tool/solo_tool.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/solo-tool-project/src/solo_tool/solo_tool.py b/solo-tool-project/src/solo_tool/solo_tool.py
index a55184e..349f3a0 100644
--- a/solo-tool-project/src/solo_tool/solo_tool.py
+++ b/solo-tool-project/src/solo_tool/solo_tool.py
@@ -1,10 +1,12 @@
import os
+from pathlib import Path
from .notifier import Notifier
from .player_mpv import Player
class SoloTool:
- def __init__(self, player=None):
+ def __init__(self, songPool: str, player=None):
+ self._songPool = Path(songPool)
self._player = Player() if player is None else player
self._notifier = Notifier(self._player)
self._songs = []
@@ -16,7 +18,7 @@ class SoloTool:
previousSong = self._song
self._song = index
self._player.pause()
- self._player.setCurrentSong(self._songs[index])
+ self._player.setCurrentSong(self._songPool / self._songs[index])
self._notifier.notify(Notifier.CURRENT_SONG_EVENT, index)
previousKp = self._keyPoint
@@ -35,12 +37,13 @@ class SoloTool:
def songs(self) -> list[str]:
return self._songs.copy()
- def addSong(self, path: str) -> None:
+ def addSong(self, fileName: str) -> None:
+ path = self._songPool / fileName
if not os.path.isfile(path):
raise FileNotFoundError(path)
if path in self._songs:
return
- self._songs.append(path)
+ self._songs.append(fileName)
self._keyPoints.append([])
self._notifier.notify(Notifier.SONG_LIST_EVENT, self.songs)
if self.song is None: