From 20ee8fce32373710be9da19b5be5bcb99fae3f44 Mon Sep 17 00:00:00 2001 From: emkael Date: Mon, 15 Jan 2024 18:14:34 +0100 Subject: Add phase and publish commands --- squaredeal/__init__.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'squaredeal/__init__.py') diff --git a/squaredeal/__init__.py b/squaredeal/__init__.py index c08f946..742b28d 100644 --- a/squaredeal/__init__.py +++ b/squaredeal/__init__.py @@ -1,4 +1,4 @@ -import hashlib, os, shutil +import hashlib, os, random, string, shutil class SquareDealError(Exception): @@ -129,3 +129,16 @@ class SquareDeal(object): sqd_contents.append('PU\n') with open(sqdpath, 'w') as sqdfile: sqdfile.writelines(sqd_contents) + + def _generate_session_key(self): + return ''.join(random.choices(string.ascii_letters + string.digits, k=60)) + + def add_phase(self, session_count, board_count, file_prefix, description=None): + phase = SquareDealPhase() + phase.sessions = session_count + phase.boards = board_count + phase.prefix = file_prefix + phase.info = description + for i in range(0, phase.sessions): + phase.s_keys.append(self._generate_session_key()) + self.phases.append(phase) -- cgit v1.2.3