summaryrefslogtreecommitdiff
path: root/squaredeal/__init__.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2024-01-15 18:14:34 +0100
committeremkael <emkael@tlen.pl>2024-01-15 18:14:34 +0100
commit20ee8fce32373710be9da19b5be5bcb99fae3f44 (patch)
tree04bf276c9b1efc7c80c9fddd51953c9979902ecd /squaredeal/__init__.py
parent7f1a1d696567052993c7095598ce20575e99557b (diff)
Add phase and publish commands
Diffstat (limited to 'squaredeal/__init__.py')
-rw-r--r--squaredeal/__init__.py15
1 files changed, 14 insertions, 1 deletions
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)