Skip to content

Commit ad1ad1c

Browse files
committed
Add SGF_DIR setting
1 parent b65f009 commit ad1ad1c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

go_capture/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,6 @@
126126

127127
IMAGES_DIR = BASE_DIR / 'images'
128128
IMAGES_DIR.mkdir(exist_ok=True)
129+
130+
SGF_DIR = BASE_DIR / 'sgf'
131+
SGF_DIR.mkdir(exist_ok=True)

go_capture/tasks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pathlib import Path
33

44
from celery import Celery
5+
from django.conf import settings
56

67
from go_capture.sgf.process_image import process_image
78

@@ -28,6 +29,7 @@ def debug_task(self):
2829
@app.task
2930
def process_image_task(image_filename):
3031
sgf_filename = f'{Path(image_filename).stem}.sgf'
32+
sgf_path = settings.SGF_DIR / sgf_filename
3133
with open(image_filename, 'rb') as image_file:
32-
with open(sgf_filename, 'w') as sgf_file:
34+
with open(sgf_path, 'w') as sgf_file:
3335
process_image(image_file, sgf_file)

0 commit comments

Comments
 (0)