Generate a new UUID for each time the statemachine plays.
This commit is contained in:
parent
d139cb1b1f
commit
ae2f3fec34
2 changed files with 12 additions and 8 deletions
|
@ -12,12 +12,21 @@ Paths to files
|
|||
"""
|
||||
# Base paths
|
||||
_STORY_SOUNDS = '/home/pi/sounds/'
|
||||
_SFX_SOUNDS = 'sounds/'
|
||||
_REC_FILES = '/home/pi/pizzafiles/'
|
||||
|
||||
USB_STICK = _REC_FILES + '.stick'
|
||||
|
||||
|
||||
def generate_session_id():
|
||||
FileHandle.uuid = str(uuid4())
|
||||
logger.info(f'generated uuid for session: {FileHandle.uuid}')
|
||||
try:
|
||||
os.mkdir(_REC_FILES + FileHandle.uuid)
|
||||
FileHandle.uuid += '/'
|
||||
except OSError:
|
||||
FileHandle.uuid = ''
|
||||
|
||||
|
||||
class FileType(Enum):
|
||||
REC = 'r'
|
||||
STORY = 's'
|
||||
|
@ -36,13 +45,7 @@ class FileHandle:
|
|||
# Create a uuid and fitting folder if not present
|
||||
# All RecFiles for this session will be added to this foldere
|
||||
if FileHandle.uuid is None:
|
||||
FileHandle.uuid = str(uuid4())
|
||||
logger.info(f'generated uuid for session: {FileHandle.uuid}')
|
||||
try:
|
||||
os.mkdir(_REC_FILES + FileHandle.uuid)
|
||||
FileHandle.uuid += '/'
|
||||
except OSError:
|
||||
FileHandle.uuid = ''
|
||||
generate_session_id()
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
|
|
|
@ -159,6 +159,7 @@ class Statemachine:
|
|||
Select language, then run the storyboard
|
||||
"""
|
||||
self.story.hal = self.hal
|
||||
fs_names.generate_session_id()
|
||||
|
||||
while self.story.hasnext():
|
||||
self.story.play_chapter()
|
||||
|
|
Loading…
Reference in a new issue