aboutsummaryrefslogtreecommitdiffstats
path: root/solo-tool-project/src/solo_tool
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2025-07-16 19:08:30 +0200
committerEddy Pedroni <epedroni@pm.me>2025-07-16 19:08:30 +0200
commitcd6a5068a81b775e545946dd591a3ab83412985d (patch)
tree31bb2ce5b37d766e93796fb907b9f11d40f48a2b /solo-tool-project/src/solo_tool
parent1dcde6cc9cb322b743e0b0355c697af869c2934a (diff)
Add filebrowser session manager stub
Diffstat (limited to 'solo-tool-project/src/solo_tool')
-rw-r--r--solo-tool-project/src/solo_tool/session_manager.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/solo-tool-project/src/solo_tool/session_manager.py b/solo-tool-project/src/solo_tool/session_manager.py
index ece67d8..be928a4 100644
--- a/solo-tool-project/src/solo_tool/session_manager.py
+++ b/solo-tool-project/src/solo_tool/session_manager.py
@@ -58,11 +58,33 @@ class _FileSystemSessionManager(SessionManager):
with open(self._sessionPath / f"{key}.json", "w") as f:
json.dump(session, f)
- def addSong(self, name: str, content: BinaryIO):
+ def addSong(self, name: str, content: BinaryIO) -> None:
from shutil import copyfileobj
newSong = self._songPool / name
with open(newSong, "wb") as f:
copyfileobj(content, f)
+class _FileBrowserSessionManager(SessionManager):
+ def __init__(self, songPool: str, sessionPath: str):
+ pass
+
+ def getSessions(self) -> list[str]:
+ pass
+
+ def loadSession(self, key: str, player=None) -> SoloTool:
+ pass
+
+ def saveSession(self, soloTool: SoloTool, key: str) -> None:
+ pass
+
+ def addSong(self, name: str, content: BinaryIO) -> None:
+ pass
+
def getSessionManager(songPool: str, sessionPath: str) -> SessionManager:
- return _FileSystemSessionManager(songPool, sessionPath)
+ from re import search
+ match = search(r"^([a-z0-9]+://)", sessionPath)
+ if not match or match.group(0) == "file://":
+ return _FileSystemSessionManager(songPool, sessionPath)
+ elif match.group(0) in ["http://", "https://"]:
+ return _FileBrowserSessionManager(songPool, sessionPath)
+