aboutsummaryrefslogtreecommitdiffstats
path: root/solo-tool-project/src/solo_tool/session_manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'solo-tool-project/src/solo_tool/session_manager.py')
-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)
+