blob: cd5ebf7c75c512da0325b795eb5ad9f50122aeae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import json
from . import SoloTool
def loadSession(file: str, songPool: str, player=None) -> SoloTool:
with open(file, "r") as f:
session = json.load(f)
st = SoloTool(songPool, player=player)
for i, entry in enumerate(session):
songPath = entry["path"]
keyPoints = entry["key_points"]
st.addSong(songPath)
st._keyPoints[i] = keyPoints
return st
def saveSession(soloTool: SoloTool, file: str) -> None:
session = []
for i, song in enumerate(soloTool.songs):
entry = {
"path": song,
"key_points" : soloTool._keyPoints[i]
}
session.append(entry)
with open(file, "w") as f:
json.dump(session, f)
|